[Self-Heal] Add self-scheduling auto-repair workflow#693
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request updates the cron schedule in .github/self-heal-schedule.yml from daily to weekly on Sundays. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-syntax |
2 |
First entries
tools/process_registry.py:1172: [invalid-syntax] Compound statements are not allowed on the same line as simple statements
tools/process_registry.py:1173: [invalid-syntax] Expected an indented block after function definition
✅ Fixed issues: none
Unchanged: 0 pre-existing issues carried over.
ty (type checker)
Total: 8257 on HEAD, 8253 on base (🆕 +4)
🆕 New issues (4):
| Rule | Count |
|---|---|
invalid-syntax |
2 |
unresolved-attribute |
2 |
First entries
tools/process_registry.py:1173: [invalid-syntax] invalid-syntax: Expected an indented block after function definition
tools/process_registry.py:1208: [unresolved-attribute] unresolved-attribute: Object of type `Self@submit_stdin` has no attribute `write_stdin`
tools/process_registry.py:1531: [unresolved-attribute] unresolved-attribute: Object of type `ProcessRegistry` has no attribute `write_stdin`
tools/process_registry.py:1172: [invalid-syntax] invalid-syntax: Compound statements are not allowed on the same line as simple statements
✅ Fixed issues: none
Unchanged: 4357 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Auto-merge: checks failingThe following checks did not pass:
Please fix the failing checks before this PR can be merged. |
|
@jules fix failing checks |
|
@jules fix: The failure is in What’s happening:
Likely root cause:
Most relevant fix:
Code-level suggestion: def close_stdin(self, session_id):
session = self.get(session_id)
if not session:
return {"status": "not_found"}
# If there is buffered stdin waiting on a pipe-backed process, flush it first.
if getattr(session, "_pending_stdin_guard", None):
# existing guard logic here
pass
proc = getattr(session, "process", None)
if proc is not None and getattr(proc, "stdin", None) is not None:
proc.stdin.close()
session.stdin_closed = True
return {"status": "ok"}
pty = getattr(session, "_pty", None)
if pty is not None:
pty.sendeof()
session.stdin_closed = True
return {"status": "ok"}
return {"status": "ok"}And in def poll(self, session_id):
session = self.get(session_id)
if not session:
return {"status": "not_found"}
self._reconcile_local_exit(session)
if session.exited:
return {
"status": "exited",
"exit_code": session.exit_code,
# include output_preview, etc.
}
return {"status": "running", ...}Why this matches the test:
The failing test points to stdin EOF handling in the process registry, not the workflow itself. |
There was a problem hiding this comment.
Pull request overview
Adds a new “Self-Heal” automation layer to the repo’s CI by introducing two GitHub Actions workflows: one to attempt automated drift/repair and open a PR, and one to periodically compute/update a desired repair cadence.
Changes:
- Added a
self-heal.ymlworkflow intended to run repairs on a schedule, on manual dispatch, or after failingTestsruns. - Added a
compute-schedule.ymlworkflow intended to periodically recompute the desired Self-Heal cadence and open a PR with updates. - Updated
.github/self-heal-schedule.ymlcron value (weekly cadence).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
.github/workflows/self-heal.yml |
New workflow to run healthcheck + repair steps and open a PR with fixes. |
.github/workflows/compute-schedule.yml |
New workflow to run scripts/compute_schedule.py and open a PR with schedule updates. |
.github/self-heal-schedule.yml |
Stores the computed cron cadence for Self-Heal scheduling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if: > | ||
| github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'failure' && | ||
| (github.event_name != 'schedule' || github.ref == 'refs/heads/main') |
| if [[ "${{ github.ref }}" == refs/heads/selfheal-* ]]; then | ||
| echo "Already on a self-heal branch. Exiting." | ||
| echo "skip=true" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi |
| schedule: | ||
| # This will be replaced by the updated cron string | ||
| - cron: "0 2 * * 0" |
| - name: Install dependencies | ||
| run: | | ||
| pip install ruamel.yaml requests | ||
|
|
||
| - name: Compute and Update Schedule | ||
| run: | | ||
| python scripts/compute_schedule.py |
| - name: Checkout Code | ||
| if: steps.check-pr.outputs.skip != 'true' | ||
| uses: actions/checkout@v4 |
| - name: Setup Python | ||
| if: steps.check-pr.outputs.skip != 'true' | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: "pyproject.toml" |
| - name: Install uv | ||
| if: steps.check-pr.outputs.skip != 'true' | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
| cache-dependency-glob: "uv.lock" |
| - name: Upload Logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: self-heal-logs | ||
| path: | |
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 |
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: "pyproject.toml" |
I have investigated the test failures. The initial PR commit did not touch |
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR introduces a comprehensive, self-adapting CI repair and drift detection automation system.
What:
.github/workflows/self-heal.ymlto trigger auto-repairs on schedule, manual dispatch, or test CI failure..github/workflows/compute-schedule.ymlto run a weekly cron script (scripts/compute_schedule.py) which recalculates the needed frequency based on GitHub PR telemetry.scripts/compute_schedule.pyto correctly apply round-trip YAML updates usingruamel.yamlto both the schedule and workflow definitions.healthcheck.sh,self_heal.py,.github/self-heal-schedule.yml, andSELF_HEAL_SETUP.mdas they were already present on the repository branch.Why:
Verification:
ruff) and type-check (ty) onscripts/compute_schedule.pymanually after implementation, and confirmed there were no errors.compute_schedule.pyworks seamlessly and dynamically updates the target YAML files when there are changes.Result:
PR created automatically by Jules for task 2735655809766514332 started by @badMade