sessions: ✨ Lift settled-dispatch closes and own-teammate TaskStops - #280
Merged
Merged
Conversation
Context: standing owner rulings permit closes of settled dispatches' idle terminals and failed-launch orphans, while a resumed session was refused a TaskStop for the teammate its own transcript proves it spawned. Summary: add the judged sessions.close-settled grant and OwnTeammate evidence for sessions.task-stop; document both lifts and pin acceptance of orca-gc invocations in tests. Motivation: honor the owner's settled-dispatch and failed-launch rulings without lifting closes of live dispatches or stops of teammates the acting agent did not spawn. Details: StandingRulings reads c9b27c1 and 6190a4a by id, requires revisions predating the acting session, and checks them live before each spend. Settled closes require a readable process tree, completed or failed dispatch, and idle prompt; the small-model Judge checks each close against an unlimited-use grant with empty scope and no expiry. OwnTeammate proves the exact teammate_spawned result instead of matching session ids after a resume, then records a one-use deterministic grant spend. Grants.mint accepts None for unlimited uses, and ccn_answer returns None on not-found. Claude-Session-Id: 900424b6-7393-480c-a26a-f1bd21da6e57
Context: an astra finder pass on #280 found that a lane could get the root's class lift and that the Orca record could go stale while the judge ran. Summary: offer `sessions.close-settled` only to the root session coordinating the dispatch's Run, then recheck the dispatch and idle prompt after the judge allows. Motivation: keep the root's class lift with its Run's coordinator and prevent a judge's allow from closing a terminal whose dispatch or idle state changed. Details: require no hook `agent_id` and a request `ORCA_TERMINAL_HANDLE` matching `result.run.coordinator_handle` from `orca orchestration run-show` for the worker row's `runId`. Name the Run in the proposal payload and the caller's coordinator role in its summary. After the judge allows, require the same dispatch to remain `completed` or `failed` and its agent to remain idle; otherwise block, release the reserved spend, and report the change in `systemMessage`. Update the changelog, grant reference, and PR description. Claude-Session-Id: 900424b6-7393-480c-a26a-f1bd21da6e57
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context: the session guard refused closes covered by standing owner rulings and refused
TaskStopforaig-no-delete-plan@session-67c0e5dafrom resumed session900424b6.The teammate's team id comes from the Claude process's session at spawn, so it need not
match the resumed hook payload's session id.
Summary: add
sessions.close-settled, a judged grant for settled dispatches' idle Orcaterminals, and
OwnTeammateevidence forsessions.task-stop. Update the changelog andgrant reference, and add tests for these lifts and existing
orca-gcacceptance.Restrict settled closes to the dispatch's Run coordinator and recheck the dispatch
and idle prompt after the Judge allows.
Motivation: honor owner rulings
c9b27c1for settled-dispatchorca-gccloses and6190a4afor failed-launch orphans. The grantsJudgeuses capt-hook's small model;owner ruling
2d2c6c8specifies the luna-low judge default. An agent's own spawn recordpermits its teammate stop without treating a matching session id as proof of ownership.
Details:
StandingRulingsreads answers by id withccn answer show, accepts onlyrevisions written before the acting session, and checks them live before each spend.
After
sessions.closedenies, the new lift requires a readable process tree, an OrcadispatchStatusofcompletedorfailed, successfultui-idle, and an idle prompt.Each allowed close spends a grant with empty scope, unlimited uses, and no expiry after
the Judge rechecks the ruling against the terminal's Orca record.
OwnTeammaterequiresa
<name>@session-<8 hex>id matching anAgentorTaskresult withstatus: teammate_spawnedand that exactteammate_idin the acting agent's transcript;the stop spends a one-use deterministic grant.
Grants.mintacceptsNonefor unlimiteduses, and
ccn_answerreturnsNoneon not-found, exit 3. Tests pinorca-gc --run <run> [--dispatch <ctx>]acceptance without a guard code change.Eligibility requires no
agent_idand a requestORCA_TERMINAL_HANDLEmatchingthe Run's
coordinator_handle; a failed dispatch or idle recheck after the Judgeallows blocks the close and releases the reserved spend.
Test plan
uv run pytest tests/test_pack_sessions.py tests/test_grants.py tests/test_dispatch_mandatory.pypassed.
capt-hook --hooks captain_hook/builtin_packs/general/hooks test: 988 passed.