Skip to content

sessions: ✨ Lift settled-dispatch closes and own-teammate TaskStops - #280

Merged
yasyf merged 2 commits into
mainfrom
feat/sessions-grants-2
Oct 3, 2026
Merged

yasyf merged 2 commits into
mainfrom
feat/sessions-grants-2

Conversation

@yasyf

@yasyf yasyf commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Context: the session guard refused closes covered by standing owner rulings and refused
TaskStop for aig-no-delete-plan@session-67c0e5da from resumed session 900424b6.
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 Orca
terminals, and OwnTeammate evidence for sessions.task-stop. Update the changelog and
grant reference, and add tests for these lifts and existing orca-gc acceptance.
Restrict settled closes to the dispatch's Run coordinator and recheck the dispatch
and idle prompt after the Judge allows.

Motivation: honor owner rulings c9b27c1 for settled-dispatch orca-gc closes and
6190a4a for failed-launch orphans. The grants Judge uses capt-hook's small model;
owner ruling 2d2c6c8 specifies the luna-low judge default. An agent's own spawn record
permits its teammate stop without treating a matching session id as proof of ownership.

Details: StandingRulings reads answers by id with ccn answer show, accepts only
revisions written before the acting session, and checks them live before each spend.
After sessions.close denies, the new lift requires a readable process tree, an Orca
dispatchStatus of completed or failed, successful tui-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. OwnTeammate requires
a <name>@session-<8 hex> id matching an Agent or Task result with
status: teammate_spawned and that exact teammate_id in the acting agent's transcript;
the stop spends a one-use deterministic grant. Grants.mint accepts None for unlimited
uses, and ccn_answer returns None on not-found, exit 3. Tests pin
orca-gc --run <run> [--dispatch <ctx>] acceptance without a guard code change.
Eligibility requires no agent_id and a request ORCA_TERMINAL_HANDLE matching
the Run's coordinator_handle; a failed dispatch or idle recheck after the Judge
allows 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.py
    passed.
  • capt-hook --hooks captain_hook/builtin_packs/general/hooks test: 988 passed.

yasyf added 2 commits October 2, 2026 22:27
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
@yasyf
yasyf merged commit 3a8ad75 into main Oct 3, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant