Repository navigation
fix(runtime): Jev approval follows the run's plan; explicit off wins - #214
Conversation
The Jev approval reviewer decided activation by reloading the workspace configuration without the run's profile and cached the answer per workspace until the credential epoch changed. Turning jev_approval off kept calling TypeSafe until a credential mutation, a profile's jev_approval was ignored, and the per-workspace cache had no bound. The compiled plan now carries the merged jev_approval (profile and overrides, trust-gated) to every held call as ReviewRequest::jev_approval; the reviewer consults Jev only when it is set and never reloads config. Its cache is a single TypeSafe client per credential epoch. jev_approval joins the plan cache key beside jev_review and jev_routing. Refs: ENG-971
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c45a413c7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…x review Conflict: docs/runbooks/jev.md (#210 rewrote it on main). Resolved by keeping main's text and re-applying this PR's activation paragraph. Review (Codex, #214): - jev_approval is outside the plan digest, so an on-disk edit to only that field revalidated the cached generation and kept the old plan: on->off kept sending previews to Jev. The value is now part of the generation's live bindings (RuntimeSwitches), so the edit compiles a replacement. Regression: an_on_disk_jev_approval_edit_replaces_the_cached_plan (fails with the binding removed). - ADR-0041 decision 5 still prescribed per-hold config reads and a per-workspace cache. ADR-0052 supersedes that sentence only; ADR-0041's status, the index and root reservations say so. - Runbook drops the restart-needed limitation and restart step this fixes; design/jev.md findings 4-5 marked fixed (kept as recorded); Jev ledger JV1/JV2 rows point at #214/#215. Refs: ENG-971
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2421bac62f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01fa3a3488
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… reloads Review (Codex, #214): - Activation lived only in cache live bindings, so a run's durable plan could not say whether it authorized an external delegate (Jev plan A1). The descriptor gains approval_delegate (the Jev approval identity, or absent); DESCRIPTOR_VERSION 11 -> 12, digest domain v12, golden re-pinned, field added to the mutation test. An edit to jev_approval now yields a new digest; the RuntimeSwitches binding for it is removed. - Routed reloads and owned children re-read configuration, so an edit mid-run could turn Jev on inside a run tree whose root had it off. RuntimeLoadRequest gains approval_delegate (ApprovalDelegateSelection), inherited exactly like checkpoint and routing: the claim reads it from the parent descriptor, a reload passes the current plan's, the loader applies it as an override and refuses an unknown identity, and a claim whose load did not preserve it fails. Regression a_reload_keeps_the_parent_approval_delegate_whatever_the_file_now_says. - A transient key-read or client-builder failure was cached for the whole credential epoch. Only a built client is cached now. Regression a_transient_key_read_failure_is_retried_at_the_next_hold (fails when failures are cached). - qq config show lists each profile's jev_approval / jev_routing / jev_review; the runbook documents the profile-aware reading. - ADR-0052 revised to match (digest, inheritance, alternatives). BREAKING CHANGE: qq-core's public ReviewRequest and RuntimeLoadRequest gain a field and ApprovalDelegateSelection is new; struct literals in embedders must add them (qq-core is publish = false; every in-repo caller is updated). Plan digests change (descriptor 12). Refs: ENG-971
Review (Codex, #220): the rollback backup copied only sessions.sqlite3, but the store runs in WAL mode, so recent history can sit in the -wal file. The Upgrading block now says to stop every QQ process and copy the -wal/-shm files too, or take a consistent copy with sqlite3 .backup. Also: descriptor is 9 -> 12 after #214, and the guide pins stay at 0.1.4 here; they move in a post-release docs PR per the runbook (#219). Refs: ENG-977
#215) * fix(cli): headless auto approval waits for Jev when jev_approval is on qq run --approval auto set reviewer_configured only when reviewer_model was set, so a Jev-only configuration denied root held calls the moment they were published, before Jev could answer. The flag now also covers the run's resolved jev_approval, with the same precedence plan compilation uses (override, then the selected profile, then the top level). Refs: ENG-972 * fix(cli): headless waits only for a delegate that will be consulted Review (Codex, #215): with a delegate configured but approval_delegate: off (configured, from the profile, or the resumed session's own override), the gate never consults it, yet headless auto waited the full 20 s reviewer grace before denying. The run now resolves approval_delegate with plan precedence (override, profile, top level), lets a resumed session's persisted override win as the gate does, and waits only when that setting consults a reviewer under the run's mode. Regression: a_delegate_that_is_configured_but_switched_off_does_not_delay_the_denial (configured off and session override off; fails with the check removed). Also merges #214 (via main) into this branch. Refs: ENG-972 * fix(cli): headless denies escalations at once, covers children, and tests the real config path Review (Codex, #215): - The delegate chain publishes tool_approval_escalated the moment it gives up, but headless auto only logged it and waited the 20 s grace per call. Unattended runs (auto, and owned children) now answer the escalation with a denial immediately. Regression an_escalation_is_denied_at_once_not_after_the_reviewer_grace (times out without the change). - Child holds bypassed the effective-delegate check (|| !ours). Children copy the root session's approval_delegate override at spawn and run supervised, so they now wait only when that setting consults a reviewer under supervised. - The Jev headless test set reviewer_configured by hand, as A2 forbids. prepare_headless's delegate resolution is extracted to headless_delegate_options and the test calls it on a real Jev-only config loaded by the config loader; the fake Jev approves after 100 ms. Also merges #214 into this branch. Refs: ENG-972
* chore(release): v0.1.5 * chore(release): v0.1.5 cargo xtask release 0.1.5 on the reviewed stack: workspace 0.1.4 -> 0.1.5, Cargo.lock, first CHANGELOG.md. Adds the hand-written Upgrading block the release workflow publishes as the GitHub release body (ADR-0051), and moves the guide's version pins and example outputs to 0.1.5 in this PR only. Note: stacked entries carry no (#N) until the stack is squash-merged; rerun the bump on the merged main before tagging (Codex review, #220). Refs: ENG-977 * Merge #219 into chore/eng-977; address Codex review Review (Codex, #220): the rollback backup copied only sessions.sqlite3, but the store runs in WAL mode, so recent history can sit in the -wal file. The Upgrading block now says to stop every QQ process and copy the -wal/-shm files too, or take a consistent copy with sqlite3 .backup. Also: descriptor is 9 -> 12 after #214, and the guide pins stay at 0.1.4 here; they move in a post-release docs PR per the runbook (#219). Refs: ENG-977
Stack ENG-968 (v0.1.5 readiness), 3 of 9. Merge in order; diff shown is this layer only.
Bug (Jev audit finding 5)
JevApprovalReviewer::preparereloaded workspace config without the run's profile and cached activation per workspace until the credential epoch changed. Consequences: on→off kept calling TypeSafe until a credential mutation; a profile'sjev_approvalwas ignored (profile-only on did nothing, profile off could not beat top-level on); the cache map was unbounded.Fix
The compiled plan carries the merged
jev_approval(profile + overrides, trust-gated) →Runtime→SessionToolGate→ newReviewRequest::jev_approval. The reviewer consults Jev only when set and never reloads config; its cache is one TypeSafe client per credential epoch.jev_approvaljoinsPlanKeybesidejev_review/jev_routing. Not part of the plan digest (likeapproval_delegate).Tests
a_held_call_whose_plan_is_off_never_reaches_jev_whatever_was_cachedjev_approval_reaches_the_plan_from_config_profile_and_override_and_follows_editsTouches approval (workflow §4: second-agent review required). Docs:
design/tools.md,runbooks/jev.md. Linear: ENG-971.Verification (top of stack)
cargo test --workspace1970 passed / 0 failed / 7 ignored;cargo clippy --workspace --all-targets --all-features -- -D warningsclean;cargo fmt --all -- --checkclean;cargo test -p qq-provider --no-default-features --features test-supportpassed.