Skip to content

fix: implement v2 session wait#33643

Open
Xiaxinyuuu wants to merge 1 commit into
anomalyco:devfrom
Xiaxinyuuu:fix-v2-session-wait
Open

fix: implement v2 session wait#33643
Xiaxinyuuu wants to merge 1 commit into
anomalyco:devfrom
Xiaxinyuuu:fix-v2-session-wait

Conversation

@Xiaxinyuuu

@Xiaxinyuuu Xiaxinyuuu commented Jun 24, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #33605

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

POST /api/session/:sessionID/wait is documented as waiting for a session agent loop to become idle, but SessionV2.wait() currently returns OperationUnavailableError, so the endpoint always responds with 503 for existing sessions.

This PR wires SessionV2.wait() to the local session execution coordinator:

  • idle sessions return immediately
  • active sessions wait for the current drain to finish
  • coalesced follow-up drains are also awaited until the coordinator is idle
  • wait() does not start new work by itself

It also updates the HTTP API contract so the wait endpoint no longer documents ServiceUnavailableError.

How did you verify your code works?

  • Added coordinator tests for waiting while active and waiting while idle
  • Updated HTTP API tests to expect 204 from /api/session/:sessionID/wait
  • Updated OpenAPI tests so /wait no longer documents a 503 unfinished-operation response
  • Ran git diff --check

I could not run the full test suite in this workspace because dependencies were not installed and Bun is not available here.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-authored-by: Starchild <noreply@iamstarchild.com>
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.

Session wait endpoint always returns unavailable

1 participant