Skip to content

fix: implement v2 session wait#33583

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

fix: implement v2 session wait#33583
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

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Co-authored-by: Starchild <noreply@iamstarchild.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 24, 2026
@github-actions github-actions Bot closed this Jun 24, 2026
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