Repository navigation
feat(runtime): Jev decides held approvals when jev_approval is on (DA5) - #144
Merged
lg2m merged 1 commit intoSep 23, 2026
Merged
Conversation
A third Jev capability, jev_approval: true (QQ_JEV_APPROVAL=on), makes Jev the first delegate for tool calls the session's approval mode holds, ahead of reviewer_model and the human. It is independent of jev_review and jev_routing, default off, trust-gated in project files and profiles, and refused by the credential-free --tui-qa-root fixture. A stored TypeSafe key with it off is never read (ADR-0030). Jev sees the approval preview only (command or diff, host, brief, recent action names, grants, mode), each section bounded to 8 KiB and secret-masked, the whole request refused past 64 KiB. It answers one typed choice over approve / deny / abstain; the answer counts only under the pinned jev-1.13.0 contract with confidence and winning probability both at least 0.7. abstain, low confidence, a malformed reply, a transport failure, a 5 s timeout, or a missing key falls through to the composed reviewer_model reviewer and then the human, with the reason attached to the escalation. Jev is never failed open to approve. Its spend is charged as reviewer spend; on fall-through both spends are summed and unknown stays unknown. ReviewVerdict gains a DelegateIdentity (Reviewer | Jev). A delegate-recorded exact grant (DA4) writes source = 'jev' or 'delegate' so an audit can tell them apart; the gate reads both as exact-match rows and the per-run cap counts both. No protocol change; no schema change (the column exists since 35). ADR-0041 supersedes ADR-0030's "Jev never authorizes side effects" for this lane only. ENG-862
lg2m
added a commit
that referenced
this pull request
Sep 23, 2026
…d-approval ledger The plan's status block, task index, and ledger now say what shipped: #125 grant storage rule, DA1 (#133), DA4 (#135), DA3 (#143), DA5 (#144, ADR-0041 accepted), DA2 in review (#150). The target contract reflects the as-built knob name (approval_delegate: by-mode|on|off), the 20 s delegate backstop, and no server deadline by default; the delegate identity on the wire is left to DA6. Index rows in docs/README.md and docs/plans/README.md no longer call the plan proposed. Refs ENG-862
lg2m
added a commit
that referenced
this pull request
Sep 23, 2026
* docs(plans): propose delegated approval An opt-in delegate settles the calls an approval mode already holds: Jev when jev_approval is on, otherwise reviewer_model, otherwise the human. Forbidden, blocked hosts, and ask_user never reach a delegate. DA1-DA6 in docs/plans/delegated-approval.md; target contract in docs/design/delegated-approval.md. ADR-0041 reserved for DA5, which supersedes ADR-0030's "Jev never authorizes side effects" for the approval lane only. DA2 consumes run-reliability RR9 rather than re-owning the interactive approval deadline. ENG-862 * docs(guide): a grant that cannot be stored approves once, and no grant lifts forbidden The permissions guide offered a session grant for every prompt and the troubleshooting guide told the operator to session-approve an exact forbidden command. Neither is true: a grant past 256 bytes or past the session cap approves the call once and records nothing, and the Forbidden floor is above every grant. ENG-862 * docs(plans): a delegate grant must not lift Forbidden An exact-string human grant lifts Forbidden today, and the guide had been corrected to deny that. The guide now states the rule and the 256-byte bound that limits it. DA4 must record a delegate grant so the evaluator can tell it from a human one; otherwise approving an exact forbidden command would open the floor the plan says it does not touch. ENG-862 * docs(plans): record DA1 in review on the delegated-approval ledger DA1 (`feat/eng-862-da1-reviewer-deny-final`, stacked on #125) makes a reviewer denial final under `auto` and starts the human wait at the escalation. The ledger records what shipped, what did not, and that DA2 keeps the delegate's own bound while the wait-restart half is done. ENG-862 * docs(plans): record DA4 in review on the delegated-approval ledger DA4 (`feat/eng-862-da4-delegate-grants`, stacked on DA1) gives every session grant a `source` and records a reviewer's exact-command or exact-host grant on its Approve, capped per run, never lifting Forbidden and never promoted. Store schema 34 -> 35. The ledger notes that the jev-vs-reviewer identity on a delegate row is DA5's. ENG-862 * feat(runtime): give the delegate and the human separate approval clocks (DA2) A held tool call used one wait timer for both the reviewer and the human, so a prompt left unattended was denied by timeout while the person was away. - The delegate (reviewer or Jev) gets its own clock, DEFAULT_DELEGATE_TIMEOUT (20 s). When it expires the pending review is dropped and the human is asked. - The human prompt has no server deadline by default (DEFAULT_APPROVAL_TIMEOUT = None). With a delegate on, the human clock only starts at Escalate, a non-final Deny, or the delegate cut-off. - approval_timeout_seconds (1..=86400) opts a workspace back into a bounded human wait; zero and out-of-range values fail config validation. The key is not trust-gated because it can only shorten a wait. - RuntimeHandler::open_with(factory, approval_timeout) threads the configured wait through qq run, the TUI, and qq serve. Headless keeps the 20 s REVIEWER_DENY_GRACE for an immediate deny without a delegate. - explain approval_timeout and show print the setting. This ships RR9's minimum (no silent timeout denial); the rest of RR9 stays planned. Tests cover a reviewer that never answers, a stuck reviewer with an absent human, and the no-deadline default. Refs ENG-862, ENG-871 * docs(plans): record DA3, DA5 merged and DA2 in review on the delegated-approval ledger The plan's status block, task index, and ledger now say what shipped: #125 grant storage rule, DA1 (#133), DA4 (#135), DA3 (#143), DA5 (#144, ADR-0041 accepted), DA2 in review (#150). The target contract reflects the as-built knob name (approval_delegate: by-mode|on|off), the 20 s delegate backstop, and no server deadline by default; the delegate identity on the wire is left to DA6. Index rows in docs/README.md and docs/plans/README.md no longer call the plan proposed. 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.
Summary
DA5 of docs/plans/delegated-approval.md: Jev as the approval delegate. A third Jev capability,
jev_approval: true(orQQ_JEV_APPROVAL=on), makes Jev the first delegate for tool calls the session's approval mode already holds, ahead ofreviewer_modeland the human.jev_reviewandjev_routing, default off, trust-gated in project files and profiles. Enables neither review nor routing. A stored TypeSafe key with it off is never read (ADR-0030).--tui-qa-rootrejects it like the other Jev capabilities.choicequestion overapprove/deny/abstainagainst the approval preview (command or diff, host, task brief, recent action names, grants, mode). Each section bounded to 8 KiB and secret-masked; the whole request refused (abstain) past 64 KiB; the transcript is never sent. Accepted only under the pinnedjev-1.13.0contract with confidence and winning probability both ≥ 0.7.abstain, low confidence, a malformed reply, a transport failure, a 5 s timeout, or a missing key falls through to the composedreviewer_modelreviewer, then the human, with the reason prepended to the escalation. A Jev deny is a delegate deny: final underauto/supervised, advice underask(DA3).ReviewVerdictgainsDelegateIdentity { Reviewer, Jev }. A delegate-recorded exact grant (DA4) writessource = 'jev'or'delegate'; the gate reads both as exact-match rows and the per-run cap counts both.GateDecision::Reviewedpath. On fall-through both spends are summed; unknown on either side stays unknown.Design
src/runtime/approval.rs:JevApprovalReviewerimplements the existingApprovalReviewertrait and composes theModelApprovalRevieweras its fallback. Whether Jev is consulted is read from the held call's workspace configuration per hold and cached per credential epoch (like the model reviewer's route), so one handle serves every workspace and a missing key falls through at the first hold rather than refusing startup.qq-corelearns neither Jev nor a provider (ADR-0004): onlyDelegateIdentityand thesourcestring it writes.JEV_APPROVAL_IDENTITYpins the contract; changing labels or thresholds is a new identity.approved_by_reviewer/denied_by_reviewer. No schema change:session_grants.sourceexists since 35 and gains a value.docs/adr/0041-jev-delegated-approval.md) supersedes ADR-0030's "Jev never authorizes side effects" for this lane only. Root ledger: 0041 accepted, next free 0042.Verification
runtime::approval::tests: strict contract parsing (labels, distribution, confidence, pinned model, spend); bounded masked preview and 64 KiB refusal;jev_approvaloff never resolves a key or contacts the endpoint (panicking keyring + unreachable endpoint); no key falls through with the reason; transport failure falls through and a reviewer approve is attributed to the reviewer with unknown spend; a loopback HTTP server exercises approve / deny / abstain end to end (bearer header, request body, fallback count, delegate identity, summed spend).sessions/tests/approvals.rs: a Jev approve records asource = 'jev'row that matches exactly and is not a human prefix.jev_approvaloff by default, independent of review/routing, override provenance, trust required in a project file and profile, re-trust on change.--tui-qa-rootrejection case added.cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo test --workspaceall clean.Stack
Based on
feat/eng-862-da3-delegate-opt-in(#143). Retarget tomainwhen #143 merges. DA6 (surfaces and the session off switch) stacks on this branch.ENG-862