Repository navigation
Add agent approver and --approval auto: a judge model decides every gated call - #47
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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. |
6d3c31f to
c324bc2
Compare
…ated call `agent approver` serves a gate tag (default `auto`) and asks a judge about every round waiting on it: Jev over its API when picked and keyed, or any model the daemon serves, run as a hidden no-tool bot through the daemon. `--approval auto` gates a new bot's tools under the `auto` tag and starts the approver when no session serves it. The daemon records who wrote each prompt (`submit` takes `from`, tools get `AGENT_TURN`, schema 36), reads a turn's prompts and calls for the judge (`prompts`), marks failed calls on `tool_completed`, and keeps `TYPESAFE_API_KEY` out of tool environments. `bench.approval_judges` replays labeled rounds through the daemon and approver per judge, with no labeled call ever run. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d3c31f1c8
ℹ️ 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".
c324bc2 to
2721659
Compare
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2721659633
ℹ️ 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".
- A bot named approver.TAG that is not a judge is refused (approver_name_taken), not deleted; the sweep removes only the base's own tool-less forks. - The judge's turn is queued when every active slot is taken, so it starts within the round's deadline instead of failing. - run on an existing bot and fork start the approver whenever an auto gate answers the bot, and fork does so before the fork is committed. - The CLI waits for the approver's own serving line, printed once the judge is ready, rather than for the lease alone. - Dedupe keeps only each bot's latest turn; delegations are walked in the order they were written; rounds are grouped in linear time. - Paths are redacted; a write or edit planned earlier in the same round is named in a later call's files; a written file is read only if regular, without blocking, and no further than 48 KiB. - prompts counts 64 bytes per call and earlier prompt and reports calls_more; a cut call list asks no consent question. - A round takes its judge slot before reading anything; a Jev answer past 64 KiB fails; an earlier request's answer keeps a newer backoff. Follow-ups, in APPROVALS: a fork's inherited turns in earlier prompts, and rotation for the CLI-started approver's log. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
aed1669 against 74f726b, interleaved: Jev adds 2.2 against 2.3 ms and a general model 8.8 against 9.7 ms over the direct client, same commits. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81458d214c
ℹ️ 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".
- prompts counts 64 bytes per steer too and reports prompts_more; a turn whose steers do not all fit is judged too long, since the person's latest word may be missing. - A malformed Retry-After falls back to the local backoff, and a valid one is capped at 60 s. - A written file is read on the blocking pool, off the runtime thread that renews the lease. - A file is named only by its path or file name as a whole word in the call's strings, so ./configure does not send a file named config. - A model judge's tag is at most 87 bytes, so its forks' names fit. - Cut calls' arguments are read whole only up to the text limit; past it only writes and edits are read, for their paths, and the allowed list is marked cut. Follow-ups, in APPROVALS: readiness of an approver already serving, one-time consent across calls of a round, questions in the request limit, and stdout backpressure. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
George's Mac, 81458d2, two passes of opposite order over 341 benign calls: gpt-6-luna at low reasoning allowed 303 and 309, Jev 275 and 276; Jev answered in about 165 ms p50 against about 2.9 s. The set has no calls that should not run, so false allows stay unmeasured. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73e2b5437c
ℹ️ 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".
- A delegating turn whose steers do not all fit is judged too long, as the judged turn already is. - Only a bot with exactly the judge's instructions and no tools is taken for an old judge and replaced. - Planned calls' arguments are read whole only up to the text limit; past it the round is too long to judge anyway. - A write or edit that failed shows no file. - Jev is typesafe/jev-*, so a daemon provider named typesafe still runs through the daemon. - A Retry-After shorter than the local backoff waits the backoff. Follow-up, in APPROVALS: reading completions in prompts only for the calls that fit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dfe59380e
ℹ️ 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".
- A delegation chain deeper than 8, or more than 64 delegating turns for one round, is judged too long rather than read in part. - A judge probability outside 0 to 1 is a failed check, for Jev as for a general model. Follow-up, in APPROVALS: forgetting a bot's judged requests once its turn ends. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d8496b71a
ℹ️ 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".
The fork PR took schemas 36 and 37, so prompt authors move to 38. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
A cut call no gate covers has no planning node: a write or edit is now matched by the path its preview holds, and judged too long without one; any other such call keeps its preview with consent not counted. The delegating turns share one 128 KiB budget with the turn's prompts. The judge's stale forks are found by name prefix, not by listing every bot. The note is a bounded regular file, Jev is typesafe/jev-* exactly, and a provider that names TYPESAFE_API_KEY keeps it in the daemon. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01CQhx9X5f5c9cNiajDFZpck
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Line 1065 in 5960e1e
This newly added section records the automatic approver as built, but the document's opening status still says that it is not built and directs readers to this section, even though agent approver and --approval auto are implemented by this change. Update the status header so the design record does not give the opposite availability state from the current code and its own implementation section.
AGENTS.md reference: AGENTS.md:L31-L31
ℹ️ 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".
| if bot["created_by"] == base.as_str() | ||
| && bot["tools"].as_array().is_some_and(Vec::is_empty) | ||
| { |
There was a problem hiding this comment.
Verify stale judge forks by identity before deleting
When a former user bot named approver.<tag> left a tool-less child under this prefix and that base name is later reused by the judge, this test matches only the textual created_by name and empty tools. On the next approver restart it therefore deletes the old child even though its created_by_id refers to the former bot identity and its instructions may not be the judge's; require the current base identity and an unambiguous judge signature before deletion.
AGENTS.md reference: AGENTS.md:L32-L32
Useful? React with 👍 / 👎.
| // before, so every stored prompt reads as a person's. | ||
| conn.execute_batch( | ||
| "ALTER TABLE turns ADD COLUMN from_bot TEXT; | ||
| ALTER TABLE turns ADD COLUMN from_turn INTEGER;", |
There was a problem hiding this comment.
Do not grant human authorship during migration
When a schema-37 store contains a prompt submitted by another bot—for example, queued delegated work that survives until the upgraded daemon runs—adding nullable columns leaves that prompt indistinguishable from a human prompt, and prompt_entry consequently omits from so the approver treats it as consent-bearing person text. A later delegated risky call can therefore be allowed based on words written by a model; migrate legacy authors as unknown/untrusted (or reject data whose author cannot be converted) rather than silently assigning human authority.
AGENTS.md reference: AGENTS.md:L27-L30
Useful? React with 👍 / 👎.
| back. A gated call with no approver waits, parked and visible in | ||
| `approvals`, rather than running or failing silently, until its gate's | ||
| 15 s expiry denies it and ends the turn. So if the approver dies and |
There was a problem hiding this comment.
Update the documented auto expiry to 45 seconds
This section still says an unattended auto gate expires after 15 seconds, but AUTO_EXPIRE_MS now creates these gates with a 45-second expiry to accommodate the general model's 30-second deadline, and the same document describes 45 seconds elsewhere. Controllers using this operational documentation will wait for or declare failure at the wrong time, so update this remaining value with the implementation.
AGENTS.md reference: AGENTS.md:L31-L31
Useful? React with 👍 / 👎.
| if reason.startswith('not reviewed'): | ||
| counts['not_reviewed'] += 1 | ||
| risky += reason.startswith('judged risky') | ||
| unclear += reason.startswith('judged unclear') | ||
| if got == expected: |
There was a problem hiding this comment.
Keep failed checks out of label accuracy counts
When a judge returns not reviewed because it timed out, overloaded, or failed, this increments not_reviewed but then continues into the label comparison: an expected denial is also counted as right, while an expected allow is also counted as false_deny. The reported outcome categories therefore overlap and can make a failing judge appear accurate or inflate its false-denial rate; stop classification after recording not_reviewed so the comparison preserves distinct measurement outcomes.
AGENTS.md reference: AGENTS.md:L44-L48
Useful? React with 👍 / 👎.
Before: the daemon could serve a gate tag to one approver under a lease, but no approver existed.
--approval autowas refused withapproval_mode_unsupported, so the only way to gate a bot wasmanual, where a person or a script answers every call.After:
agent approverserves a gate tag (defaultauto) and has a judge model decide every call waiting on it, one request per round.run --new --approval autogates the new bot's tools underautoand starts the approver detached when nobody serves that tag. So does continuing or forking any bot anautogate answers. The judge is Jev (typesafe/jev-*) when it is picked, or whenTYPESAFE_API_KEYis set and nothing else is picked. Otherwise it is whatever model is configured, run through the daemon with the providers and logins the bots already use. Per George (2026-09-27): no rules sit in front of the judge, and auto must work without a Jev key.How:
Retry-Afterand the local backoff.approver.TAG, and the tag can be at most 87 bytes.approver_name_taken).approver.TAG.prefix, not by listing every bot.servingline, printed once the judge is ready.--note): a regular file of at most 96,000 bytes.submittakesfrom {bot, turn}(schema 38:turns.from_bot,turns.from_turn), and tool shells getAGENT_TURN, so the approver can tell a person's words from a bot's.promptsread op returns a turn's prompts with their authors, its started calls, and the bot's earlier prompts.prompts_more,calls_more, andmorewhen entries are left out.tool_completedcarriesfailed, and a gatedtool_startedcarries its planningnode.TYPESAFE_API_KEYis kept out of tool environments. A daemon the CLI starts keeps it only when a--providernames it as its key variable.bench.approval_judgesreplays labeled rounds through the real daemon and approver, once per judge. A second gate that nobody allows keeps every labeled call from running.Measured:
bench.approval_overhead, compared with a client that answers directly:74f726b, Jev adds 2.7 ms p50 and no commit. A general model through the daemon adds 11.5 ms p50, 8.6 ms of daemon CPU, and 11 commits a round.aed1669against74f726b, interleaved: Jev adds 2.2 against 2.3 ms, and a general model 8.8 against 9.7 ms, with the same commits.81458d2, 341 labeled calls that should all run, two passes in opposite order:gpt-6-lunaat low reasoning allowed 303 and 309, with a p50 of about 2.9 s. Its slowest round took 25.4 s, against its 30 s deadline.Follow-ups, listed in APPROVALS under "Not built yet":
earlier.promptsonly for the calls that fit.--approval autoputs every consequential tool under one tag, so only a mixed setup hits this.Not in this PR: a labeled set of calls that should not run, and the app's approval cards.
Checks at
5960e1e, after merging main (the fork PR took schemas 36 and 37):cargo fmt --check,clippy --all-targets, all Rust tests (318), and the Python suite (380 tests, OK, 23 skipped). The Python tests use a stand-in judge server, so they spend nothing on Jev.🤖 Generated with Claude Code