Repository navigation
feat(protocol)!: name the delegate on approvals and add the session off switch (DA6) - #152
Merged
Merged
Conversation
…ff switch (DA6)
An operator could not see who settled a held call or stop delegating for
one session without editing config and restarting. This is the last
delegated-approval slice; it closes the plan.
Protocol 27 -> 28:
- `ApprovalDelegate` and `DelegateIdentity` move to qq-protocol as the one
source (`by_mode|on|off`, `reviewer|jev`); qq-core re-exports them.
- `tool_approval_resolved` gains optional `delegate` beside
`approved_by_reviewer` / `denied_by_reviewer`, so a supervisor can tell
Jev's decision from the reviewer model's from the stream alone.
- New advisory `tool_approval_escalated { tool_call_id, delegate?, reason }`
when a delegate passes: an escalate, an advisory deny under `ask`, or the
delegate clock running out (no identity). Written only while the call is
still awaiting approval.
- New `set_approval_delegate { session_id, delegate? }` on
`/v1/sessions/approval-delegate` with `approval_delegate_set`; optional
`SessionSummary.approval_delegate` carries the override. `/delegate`
reserved as a client slash command.
- Goldens under v28/ and headless/v28/; harbor trace fixtures bumped.
Store schema 35 -> 36: nullable `sessions.approval_delegate`. The gate reads
`session override or configured` at each hold, so the switch takes effect at
a running session's next held call with no restart and no config write.
Spawned children inherit the parent's override. No authority check: the mode
stays the ceiling.
TUI: `/delegate` picker (configured, by_mode, on, off; needs a focused
session). Status badge reads `MODE . delegate off` while overridden. The
client keeps who settled each call beside its timing; expanded detail shows
`approved by jev` / `approved for session` / `denied by you`, a delegate
denial's row reads `denied by jev|reviewer`, and the approval block shows
why a delegate passed. Headless text prints `[tool] NAME approved by jev`
and `[tool] reviewer passed to the human: ...`.
Docs: tools.md (session override, wire identity), protocol.md (version 28,
route, command, resolution text), guide/tui.md, guide/permissions.md,
ADR-0041 s6; docs/design/delegated-approval.md deleted as the plan required
(fully absorbed); plan status, ledger, root ledger row for the bump.
BREAKING: PROTOCOL_VERSION 28. Older clients reject the new command, outcome,
event tag, and summary field; version negotiation refuses the pair.
Verification: cargo test --workspace, fmt --check, clippy -D warnings.
Refs ENG-862
lg2m
added a commit
that referenced
this pull request
Sep 24, 2026
Every slice of docs/plans/delegated-approval.md is on main (#125, #133, #135, #143, #144, #150, #123, #152). The plan's own acceptance 5 says it is deleted once shipped and the ledger remains as the receipt; this does that. - Delete docs/plans/delegated-approval.md. The goal, slice table, and acceptance checklist move to the head of the ledger so it stands alone; index rows in docs/README.md, docs/plans/README.md, and docs/plans/progress/README.md point at the as-built text and the receipt. - Close acceptance 2's blocked-host half, which only had a test under `full` with no delegate: `a_blocked_host_never_reaches_the_delegate_even_when_one_would_approve` runs under `auto` with `approval_delegate: on` and a Jev-attributed reviewer that would approve, and asserts the link-local fetch is denied with no hold, no escalation, no reviewer call, and no delegate host grant. - Acceptance 3 (one week of real use) stays open until 2026-09-30; the ledger records the two queries to run and the entry to write. Verification: cargo test --workspace, fmt --check, clippy -D warnings. Refs ENG-862
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.
Last slice of the delegated-approval plan (ENG-862). Against
main; nothing is stacked on it. When this merges the plan is closed.User-visible behavior
You can see who decided. A settled call now says who settled it: in the TUI the expanded call detail reads
approved by jev/approved by reviewer/approved for session/denied by you, and a delegate's denial shows on the row asdenied by jevordenied by reviewer. When a delegate passed the hold to you, the approval prompt says why (reviewer passed to you: …ordelegate timed out: …).qq run --format textprints[tool] NAME approved by jev; JSONL carries"delegate": "jev" | "reviewer"ontool_approval_resolved.You can stop delegating for one session.
/delegatein the TUI (rows:configured,by_mode,on,off) changes who settles the focused session's held calls for the rest of that session. It takes effect at the next held call — running sessions included — writes nothing to.qq/config.ron, and children spawned afterwards inherit it. The status badge readsMODE · delegate offwhile an override is set.Design
ApprovalDelegateandDelegateIdentitymove toqq-protocolas the one source;qq-corere-exports them. New: optionaldelegateontool_approval_resolved(only beside the two reviewer resolutions); advisory eventtool_approval_escalated { tool_call_id, delegate?, reason }for an escalate, an advisory deny underask, or the delegate clock running out (no identity), written only while the call is still awaiting approval so a lost race publishes nothing;set_approval_delegate/approval_delegate_seton/v1/sessions/approval-delegate; optionalSessionSummary.approval_delegate;/delegatereserved. Goldens underv28/andheadless/v28/; harbor trace fixtures bumped.reviewer_model's, and the plan's acceptance ("headless output names the delegate on the approval event") requires it.sessions.approval_delegate.load_approval_policyreturns it with the mode and grants; the gate appliesoverride.unwrap_or(configured)per hold. No authority check on the command: the mode is the ceiling and every value asks at least as much of a human as the configured choice could.ToolCallTiming.settled), bounded and evicted with the body; the escalation reason joins the hold'sApprovalPreviewand leaves with the hold.docs/runbooks/delegated-approval.mdwas not written: the operator text fitsguide/permissions.md§ "Who decides a held call" andrunbooks/jev.mdalready covers the Jev lane.docs/design/delegated-approval.mdis deleted — every section is now as-built intools.md,protocol.md, and ADR-0041 — as the plan required.Verification
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings: cleancargo test --workspace: all green (719 core, 323 TUI, 226 root, protocol goldens, headless goldens, harbor fixtures)the_session_off_switch_withdraws_the_reviewer_at_the_next_hold_without_a_restart,a_session_delegate_override_reaches_the_reviewer_under_ask_and_children_inherit_it,setting_the_delegate_on_an_unknown_session_is_refused,a_reviewer_escalation_is_published_with_its_reason_before_the_human_is_asked,an_advisory_denial_under_ask_is_published_as_an_escalation_naming_the_delegate; the DA2 delegate-clock test now asserts the cut-off escalation. Protocol: round-trips for the command, outcome, resolution field, and escalation event; four new goldens. Client:a_reviewer_resolution_records_who_settled_the_call_and_evicts_with_it,an_escalation_lands_on_the_pending_holds_preview_and_nowhere_else. TUI:delegate_picker_switches_the_focused_session_off_and_reports_the_receipt,delegate_picker_needs_a_focused_session. Headless:a_delegated_approval_names_the_delegate_in_jsonl_and_text. Migrations re-pinned to 36.Performance / compatibility
Hot path: one extra nullable column read in the per-hold policy query (already one round trip) and one advisory event write on the escalation path (not the approve/deny path). Existing stores migrate in place (one
ALTER TABLE ADD COLUMN). Breaking: older clients reject the new command, outcome, event tag, and summary field; version negotiation refuses a 27/28 pair, as for every prior bump.Refs ENG-862