Skip to content

fix(cli): headless auto approval waits for Jev when jev_approval is on - #215

Merged
lg2m merged 7 commits into
fix/eng-971-jev-approval-activationfrom
fix/eng-972-headless-jev-reviewer
Sep 29, 2026
Merged

lg2m merged 7 commits into
fix/eng-971-jev-approval-activationfrom
fix/eng-972-headless-jev-reviewer

Conversation

@lg2m

@lg2m lg2m commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Stack ENG-968 (v0.1.5 readiness), 4 of 9. Merge in order; diff shown is this layer only.

Bug (Jev audit finding 4)

qq run --approval auto set reviewer_configured only for reviewer_model, so a Jev-only configuration denied root held calls the instant they were published, before Jev answered. The existing test forced the flag and hid this.

Fix

approval_delegate_configured covers the run's resolved jev_approval with plan-compile precedence (override → selected profile → top level).

Tests

headless_auto_waits_for_jev_when_the_run_resolves_jev_approval_on (precedence table). Linear: ENG-972.

Verification (top of stack)

cargo test --workspace 1970 passed / 0 failed / 7 ignored; cargo clippy --workspace --all-targets --all-features -- -D warnings clean; cargo fmt --all -- --check clean; cargo test -p qq-provider --no-default-features --features test-support passed.

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
@lg2m
lg2m added this pull request to stack #221 September 29, 2026 02:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24ba1103a0

ℹ️ 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".

Comment thread src/main.rs Resolved
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T06:35:36.367920Z 66be494 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7b6316030

ℹ️ 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".

Comment thread src/main.rs Resolved
Comment thread src/main.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8d45a0fd0

ℹ️ 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".

Comment thread src/headless.rs Resolved
…ests 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66be49457c

ℹ️ 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".

Comment thread src/headless.rs
Comment on lines +1031 to +1032
if (ours && handle.wait_for_delegate)
|| (!ours && handle.child_waits_for_delegate) =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover disabled delegation for supervised child calls

Fresh evidence after the prior child-call report is that the final patch fixes the !ours bypass through child_waits_for_delegate, but its new disabled-delegate test exercises only a fresh root and a resumed root; no test spawns a supervised child with approval_delegate: off. That leaves the exact child regression—waiting the 20-second grace despite having no consulted delegate—unguarded, so add a headless parent/child case that verifies immediate denial.

AGENTS.md reference: AGENTS.md:L146-L150

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't fix now: this is a test gap. The child path is fixed (child_waits_for_delegate uses the inherited setting under supervised), and a headless parent/child spawn fixture would be sizeable for one assertion. Noted for the Jev JV2 follow-up tests.

Comment thread src/main.rs
cli::RunApproval::Full => headless::HeadlessApproval::Full,
},
reviewer_configured: snapshot.reviewer_model().is_some(),
reviewer_configured,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the Jev-only headless runbook guidance

This wiring makes a Jev-only headless auto run wait for Jev, but docs/runbooks/jev.md:170-171 still lists immediate denial as a current limitation and tells operators to configure a reviewer_model. After this commit ships, that procedure is false and can cause users to configure an unnecessary additional inference route; update or remove the limitation in this change.

AGENTS.md reference: AGENTS.md:L207-L210

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: removed the stale limitation and the reviewer_model advice from docs/runbooks/jev.md.

Review (Codex, #215): headless auto now waits for a Jev-only delegate, so
the runbook's known-limitation entry and its advice to add a reviewer_model
are no longer true.

Refs: ENG-972
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@lg2m
lg2m merged commit 0e2eb64 into main Sep 29, 2026
@lg2m
lg2m deleted the fix/eng-972-headless-jev-reviewer branch September 29, 2026 18:56
lg2m added a commit that referenced this pull request Sep 29, 2026
…ns (#216)

* fix(runtime): make the empty-truncation cap raise reachable in sessions

A session run starts at the resolved cap, which was also the raise limit, so
max_output_tokens >= ceiling always held: RR8.1's raise-once never fired and
the error called the configured cap the "model ceiling". Compiled plans now
carry a separate output ceiling (catalog limit, bounded by policy); the raise
doubles toward it and the error names it.

A turn that streamed a complete tool call and was then cut dropped the call
and was resent unchanged up to three times; while the cap can still grow it
now takes the same raise, otherwise it continues as before.

Refs: ENG-973

* fix(runtime): record the raised cap per turn; ceiling edits replace the plan; honest empty-turn count

Review (Codex, #216):
- The raised retry cap was sent, but model_turns.model_json and
  model_turn_completed kept the claim-time cap. Each Prepared now updates
  the per-turn model record to the cap actually sent. Regression:
  a_raised_output_cap_is_what_the_retried_turn_records (fails without).
- output_ceiling is outside the digest, so lowering only a managed
  policy.max_output_tokens revalidated the old plan. It joins the live
  bindings (RuntimeSwitches) beside jev_approval. The ceiling test now
  lowers the managed file and expects the new ceiling (fails without).
- A call-then-cut turn consumed the raise and then counted as a
  reasoning-only turn in the terminal diagnostic. A separate count of
  genuinely empty turns drives the message. Regression:
  the_reasoning_diagnostic_counts_only_turns_that_produced_nothing.

Also merges #215 into this branch.

Refs: ENG-973
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