Repository navigation
One turn view for wait, interrupt and turns - #95
Conversation
wait, interrupt and turns answer with the same view of a turn, read from its row: identity, status, what a parked turn waits on, tokens, rounds and timing. A pending turn in a client's wait shows its view, read for all pending turns in one job on the reader. interrupt answers with the view and interrupt_requested, and succeeds on a turn that already ended. Protocol 8. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eac2622474
ℹ️ 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".
turn_answer gives a turn's outcome once finished, its view marked pending while it runs, and its view with turn_result_pruned once retention removed how it ended. The pending read after a deadline uses it too, so a turn that finished meanwhile answers with its outcome, not as pending. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
|
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: 753a9fa66f
ℹ️ 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 read of a wait's pending turns runs in the registry's JoinSet; shutdown lets it finish within the drain deadline, then ends it before stdout is joined, so it cannot hold an output open. A failed read gives each turn the error, and only a vanished turn stays pending. interrupt takes --pretty. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
|
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: 3540f4e533
ℹ️ 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 model's wait dropped every outcome field outside a fixed list, so facts like budget_tokens never reached it. It now removes only the turn view's accounting fields, for pending and ended turns alike. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
|
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: f88993cf9d
ℹ️ 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".
…-7oycm8 # Conflicts: # src/server/turn.rs # src/store/db.rs
|
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: 12d47ad990
ℹ️ 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".
| .into_iter() | ||
| .filter_map(|(text, bot, turn)| match db.turn_answer(&bot, turn) { | ||
| Ok(answer) => Some((text, answer)), | ||
| Err(error) if error.code == "turn_not_found" => None, |
There was a problem hiding this comment.
Read turn answers from one SQLite snapshot
When a timed-out or --any wait reads a turn while explicit or automatic retention is pruning it, this reader job can assemble an incoherent outcome: turn_answer separately queries the turn view, terminal event, last message, and node on an autocommit connection, so pruning may commit after the terminal-event query but before the message query. The response then reports a terminal turn with empty text instead of either its complete pre-prune outcome or turn_result_pruned; wrap the whole batch in one read transaction or fetch each answer from a single snapshot.
AGENTS.md reference: AGENTS.md:L32-L32
Useful? React with 👍 / 👎.
main's one turn view (#95) already moved the protocol to 8, so this branch's required `workspaces` field moves it to 9. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L7djWGZLxGzzTF3RkEShDN
Before: each reply described a turn its own way.
waitshowed a running turn as only{"pending": true}.interruptanswered{turn, interrupt_requested}. A second interrupt that crossed the turn's own end failed withno_active_turn. A client that wanted the turn's status, tokens or what it was parked on had to make another call.After:
wait,interruptandturnsall answer with one turn view, read from the turn's row:bot,bot_id,turn,handle,request_id,status,waiting_on, tokens, rounds, retries and timing.interruptis idempotent. A turn that already ended answers with how it ended andinterrupt_requested: false.This is C3 of the CLI feedback plan (
agent-notes/shipping-plan/PLAN.md) and follows the "one turn view" rule inAPI_DESIGN.md. It sets no defaults of its own;--effortand duration flags come in C4. Protocol goes to 8.What a client sees
Captured with the synthetic model on a scratch store. One held turn:
waitwithtimeout_ms: 0, theninterrupt, theninterruptagain after it ended.How
db.rshas oneTURN_VIEWcolumn list and one row reader,turn_view.waiting_onis null,{call_id, approval, deadline_ms},{call_id, handles, any, deadline_ms}, or{resume_at_ms}for a paced turn. A finished turn'swaitoutcome and eachturnsitem extend the view.Database::turn_answeris how a client'swaitreports a turn: a finished turn gives its outcome, a live one its view withpending: true, and one whose outcome retention pruned gives its view pluserror: turn_result_pruned.waitreads the views of all its still-pending turns in one job on the reader connection, off the registry lock. The registry owns those reads, so shutdown ends them before stdout closes. A model'swaittool gets the turn's status and what its end recorded, error facts included, without the view's usage, timing and identity fields.store::Reader, not the writerStore. Holding the writer kept the publication stream open at shutdown.interruptanswers with the view plusinterrupt_requested. A queued, ready or parked turn ends in place, so its view already saysinterrupted. A turn the bot never had isturn_not_found. A turn that is starting, or is not the running one, isstale_turn.no_active_turnis gone from the protocol; the CLI keeps it for "this bot is running nothing".agent interrupt [--pretty]prints the view. The app's swarm code drops itsno_active_turncase.bench/query_plans.pyknowsTURN_VIEW, so the view's queries are in the plan audit.docs/RUST_PROTOTYPE.mdanddocs/CLI.mddescribe the view.Performance
Daemon CPU, median of 15 runs (IQR), synthetic model on Linux. Before is main at #94, after is this branch. The script is in the ignored local directory.
waiton 32 finished turnswaiton 32 pending turnsFinishing turns costs the same, within noise. A pending
waitnow reads each turn's row, about 45 µs per turn, in one reader job. Before, it read nothing and answered onlypending: true. The finished-turn wait adds the view's columns to the outcome read it already made.Checks
cargo fmt --check.cargo clippy -p agent-runtime -p agent-client --all-targets -- -D warnings.cargo test -p agent-runtime -p agent-client: all pass.AGENT_TEST_RUNTIME=1 python3 -m unittest discover -s tests: 403 tests, OK (39 skipped).node --test app/tests/state.test.cjs: 140 pass.tests/test_query_plans.py) plans everyTURN_VIEWquery.The app crate doesn't build on Linux. Its one change is a removed match arm in
swarm.rs.Declined review findings for this series are listed in #96.
🤖 Generated with Claude Code