fix(assistant-actions): read a run that closes mid-review as nothing to review

Merged
WA
3d ago
+65-3

Summary

  • The Assistant action review read returned 409 when a run closed while the read was in progress. It now returns the same empty result as a chat with no live run
  • The use case finds the live run without a lock, then requireAssistantRun waits on the chat row lock. A turn that closes in between makes the second step throw conflict, which is right for a decision or claim but wrong for a read
  • Decide, prepare, and claim still refuse closed runs

Why

The review query polls while a turn runs, so this race surfaces whenever a turn ends during a poll. It also fails the e2e (org-redesign) health check, which treats any failed same-origin request as a failure, and that check gates staging deploys.

Type of Change

  • Bug fix

Testing

  • New case in tool-permissions.integration.ts holds the chat row lock while the run closes, waits until the read is blocked on it through pg_blocking_pids, then commits
  • Red on the pre-fix code with This conversation is no longer accepting actions; the file passes 72/72 with the fix
  • Biome on the changed files; type-check, audits, and full suites left to CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)