A Codex RPC can deadlock the reader it waits on

This commit is contained in:
Ian Gulliver
2026-10-16 14:21:23 -07:00
parent 6ee2421d97
commit 66ff641bbd
5 changed files with 109 additions and 39 deletions
-2
View File
@@ -2,8 +2,6 @@
- Inbox answer validation isn't atomic with resolving the question
`CheckResponse` reads open state outside the write transaction and `Respond` updates by id alone (`internal/agents/respond.go:26–34`, `:93`; `internal/store/inbox.go:140`), so two concurrent answers both land, or a withdrawal is overwritten. Condition the update on `state='open'`, check RowsAffected, roll back the batch on conflict and return 409.
- A Codex RPC can deadlock the reader it waits on
`drive` calls `Steer` synchronously while `readLoop` pushes notifications into a 256-entry channel (`internal/codex/session.go:186`, `:440–476`, `:598`); if it fills before the response is read, each waits on the other. Route RPC responses separately from notification consumption and give RPCs bounded deadlines, without replacing backpressure with an unbounded queue.
- A malformed file image URL breaks transcript rendering
`decodeURI` throws on e.g. `file:///tmp/100%.png` (`web/src/markdown.ts:347`), and `renderAll` appends events before mounting the composer (`web/src/task.ts:608–609`), so the rest of the transcript and the composer don't render. Catch the decode error and render the plain fallback link.
- Stale reload and focus responses overwrite newer state