mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
agentydragon(tasks): add tasks 24/25 guard missing tool output sequencing in JS and Rust
This commit is contained in:
27
agentydragon/tasks/24-guard-tool-output-sequencing-js.md
Normal file
27
agentydragon/tasks/24-guard-tool-output-sequencing-js.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: 24
|
||||
title: Guard Against Missing Tool Output in JS Server Sequencing
|
||||
status: Not started # one of: Not started, Started, Needs manual review, Done, Cancelled
|
||||
summary: Prevent out-of-order chat messages and missing tool outputs when user input interrupts tool execution in the JS backend.
|
||||
goal: |
|
||||
Ensure the JS server never emits a user or model message before the corresponding tool output has been delivered. Add sequencing guards to the message dispatcher so that aborted rollouts or interleaved user messages cannot cause "No tool output found" errors.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- When a tool invocation is interrupted or user sends a message mid-rollout, the JS server buffers subsequent messages until the tool output event arrives or the invocation is explicitly cancelled.
|
||||
- The server must never log or emit an error like "No tool output found for local shell call" due to sequencing mismatch.
|
||||
- Add automated tests simulating mid-rollout user interrupts in the JS test suite, verifying correct buffering and eventual message delivery or cancellation.
|
||||
|
||||
## Implementation
|
||||
|
||||
**How it was implemented**
|
||||
- In the JS message dispatcher, track pending tool invocations by ID and delay processing of new chat messages until the pending invocation resolves (success, failure, or cancel).
|
||||
- Add a guard in the `handleUserMessage` path to check for unresolved tool IDs before appending user content; if pending, queue the message.
|
||||
- On receiving `toolOutput` or `toolError` for an invocation ID, flush any queued messages in order.
|
||||
- Implement explicit cancellation paths so that if a tool invocation is abandoned, queued messages still flow after cancellation confirmation.
|
||||
- Add unit and integration tests in the JS test harness to cover normal, aborted, and concurrent message scenarios.
|
||||
|
||||
## Notes
|
||||
|
||||
- This change prevents 400 Bad Request errors from tool retries where the model requests a tool before the output is streamed.
|
||||
- Keep diagnostic logs around sequencing logic for troubleshooting but avoid spamming on normal race cases.
|
||||
27
agentydragon/tasks/25-guard-tool-output-sequencing-rust.md
Normal file
27
agentydragon/tasks/25-guard-tool-output-sequencing-rust.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: 25
|
||||
title: Guard Against Missing Tool Output in Rust Server Sequencing
|
||||
status: Not started # one of: Not started, Started, Needs manual review, Done, Cancelled
|
||||
summary: Prevent out-of-order chat messages and missing tool output errors when user input interrupts tool execution in the Rust backend.
|
||||
goal: |
|
||||
Ensure the Rust server implementation sequences tool output and chat messages correctly. Add synchronization logic so that an in-flight tool invocation either completes or is cancelled before new messages are processed, avoiding "No tool output found" invalid_request errors.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- The Rust message broker must detect pending tool invocations and pause delivery of subsequent user or model messages until the tool result or cancellation is handled.
|
||||
- No panic or 400 Bad Request errors should occur due to missing tool output in edge cases of interrupted rollouts or mid-stream user input.
|
||||
- Add Rust integration tests simulating tool invocation interruption and user message interleaving, verifying correct ordering and delivery.
|
||||
|
||||
## Implementation
|
||||
|
||||
**How it was implemented**
|
||||
- Introduce a pending-invocation registry (`HashMap<InvocationId, PendingState>`) in the Rust message pipeline.
|
||||
- Modify `handle_user_message` and `handle_model_event` in the broker to check for unresolved pending invocations and enqueue incoming events accordingly.
|
||||
- On receiving the corresponding tool output or tool abort event, dequeue and dispatch any buffered messages in order.
|
||||
- Implement a timeout or explicit cancel path to avoid stuck invocations in case of unresponsive tools.
|
||||
- Extend the Rust test suite (e.g. in `broker/tests/`) with scenarios covering normal, aborted, and concurrent messages.
|
||||
|
||||
## Notes
|
||||
|
||||
- Mirror the JS implementation guard patterns for consistency across backends.
|
||||
- Provide clear logging at the debug level to trace sequencing steps during development.
|
||||
Reference in New Issue
Block a user