Repository navigation
feat(klaud): status labels, close-to-stop, run-end wakes and clearer outcomes / feat(klaud):状态标签、关闭即停止、运行结束即唤醒与更清晰的结果 #4484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Klaud Cold wake on run end | ||
| run-name: Klaud Cold wake on run end - ${{ github.event.workflow_run.display_title }} | ||
|
|
||
| # A parked Klaud session resumes only after recovery sees its owned runs end. Rather than wait | ||
| # for the next :15/:45 wake, start a recovery-only planner pass as soon as a Klaud-owned | ||
| # targeted run (e2e Test - klaud-*) or PR sweep (klaud/auto-* branch) completes. No checkout and | ||
| # no event data reaches a shell; the event only gates the job. | ||
| on: # zizmor: ignore[concurrency-limits] | ||
| workflow_run: # zizmor: ignore[dangerous-triggers] runs no code from the triggering run | ||
| workflows: [End-to-End Tests, Run Sweep] | ||
| types: [completed] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| wake: | ||
| name: Wake Klaud recovery | ||
| if: >- | ||
| github.event.workflow_run.head_repository.full_name == github.repository | ||
| && github.event.workflow_run.conclusion != 'skipped' | ||
| && (startsWith(github.event.workflow_run.display_title, 'e2e Test - klaud-') | ||
| || startsWith(github.event.workflow_run.head_branch, 'klaud/auto-')) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: write # Dispatch the planner's recovery-only wake. | ||
| steps: | ||
| - name: Dispatch a recovery-only planner pass | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: gh workflow run klaud-plan.yml --repo "$GITHUB_REPOSITORY" --ref main -f wake=true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 (optional) Recovery passes can now overlap more often, which can push concurrent Klaud sessions past the MAX_CANDIDATES_PER_RUN cap of 5. Only dispatched wakes share the 'klaud-wake' concurrency group. Scheduled :15/:45 wakes and the 4-hourly planner each run in their own
github.run_idgroup. Run-end wakes now arrive at any minute, so they can runrecoveralongside those passes. Fix: serialize every recovery pass, for example with job-levelconcurrency: {group: klaud-recover, cancel-in-progress: false}on therecoverjob. Schedule-only runs keep their own group today.Why this was flagged
klaud-wake.yml:237 dispatches
klaud-plan.yml -f wake=truewhenever a Klaud-owned E2E run or klaud/auto-* Run Sweep completes, at any minute. klaud-plan.yml:11 puts only those runs in the 'klaud-wake' group. A scheduled15,45 * * * *wake or the0 */4 * * *planner usesgithub.run_id, so itsrecoverjob runs at the same time as a dispatched wake'srecover. In lifecycle.pyrecover(), each pass countsrunning_sessions()(lifecycle.py:1285). Each then resumes approved sessions untilrunning + resumed >= max_sessions(lifecycle.py:1293). Two overlapping passes both see, say, 4 running sessions, and each grants a different parked candidate, so 6 sessions run against a cap of 5.recovery_leaseis per candidate (claims.py:126), so it does not stop this. On the base branch, recovery ran only at :00, :15 and :45, so passes rarely overlapped. The PR text says bursts collapse, but that holds only among dispatched wakes.Verification: klaud-plan.yml:11 sets
group: ${{ inputs.wake && 'klaud-wake' || github.run_id }}, so only dispatched wakes queue behind each other. In lifecycle.pyrecover(), each pass readsrunning = len(running_sessions(repository))once (line 1285) and only counts its ownresumed(line 1293).claims.recovery_lease(claims.py:126-155) is per candidate.