Skip to content

Conversation

@evalstate
Copy link
Owner

Implements elegant handling of overlapping prompt requests per ACP protocol:

  • Added _active_prompts set to track sessions with in-flight prompts
  • Detects when a second prompt arrives for a session with an active prompt
  • Immediately returns PromptResponse(stopReason="refusal") for overlapping requests
  • Uses try/finally to ensure session is always removed from active set
  • Added comprehensive test coverage for overlapping request scenarios

Per ACP protocol spec: "Once a prompt turn completes, the Client may send another session/prompt..." - prompts must be sequential per session. This change prevents race conditions and ensures compliance with the protocol requirement.

Addresses the ACP protocol requirement that only one prompt can be active per session at a time. If concurrent execution is needed, clients should use multiple sessions.

Implements elegant handling of overlapping prompt requests per ACP protocol:

- Added `_active_prompts` set to track sessions with in-flight prompts
- Detects when a second prompt arrives for a session with an active prompt
- Immediately returns PromptResponse(stopReason="refusal") for overlapping requests
- Uses try/finally to ensure session is always removed from active set
- Added comprehensive test coverage for overlapping request scenarios

Per ACP protocol spec: "Once a prompt turn completes, the Client may send another
session/prompt..." - prompts must be sequential per session. This change prevents
race conditions and ensures compliance with the protocol requirement.

Addresses the ACP protocol requirement that only one prompt can be active per
session at a time. If concurrent execution is needed, clients should use multiple
sessions.
The previous test had a timing issue - it assumed the first prompt would still
be active after 0.1s sleep, but the passthrough model completes too quickly.

New approach:
- Send both prompts truly concurrently (no sleep between them)
- Don't assume which arrives first due to async scheduling
- Verify that exactly one succeeds and one is refused
- Confirm subsequent prompts work after both complete

This makes the test more robust and accurately tests the overlap detection
logic regardless of model execution speed.
@evalstate evalstate merged commit ed3f98b into main Nov 9, 2025
6 checks passed
@evalstate evalstate deleted the claude/acp-overlapping-requests-011CUxyLzM3jq96EGjgwSio3 branch November 27, 2025 21:52
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.

3 participants