Repository navigation
ipc: surface early runner.send rejections to caller in thread:send - #61
Conversation
|
Hi @BunsDev, whenever you have a moment, could you please review this thread:send error handling fix? Built, tested locally, and signed. Thanks! |
BunsDev
left a comment
There was a problem hiding this comment.
Thanks! Returning early runner.send rejections means the renderer's existing if (!r.ok) setError(...) in App.tsx finally runs for them. These are the rejections runner.send / runTurn raise before the turn starts: the thread is still working, it's unknown, or its working directory is missing. All three happen before the user's message is recorded, so showing them as the app toast instead of a notice item inside the thread fits.
A few notes:
- Please mention the behaviour change in the PR description. These errors move from an inline notice in the thread to the toast. Rejections that arrive after the first tick still become notices. It's a reasonable change, but it's visible to users.
- Test. Nothing covers the new path yet. A runner-level or e2e test of "send while a turn is running" that expects
{ ok: false, error: /still working/ }and no new notice item would pin it down. - Optional follow-up, not introduced here.
Composerclears its text right afteronSend(Composer.tsx:73-74), so after an early failure the typed message is gone. Now thatthread:sendreports the failure, the composer could put the text back whenokis false.
Before merge
- GitHub shows
399558das unverified (unknown_key), andmainrequires verified signatures. Add the SSH key you sign with as a Signing key under Settings → SSH and GPG keys. The rebase below then produces a verified commit. mainrequires branches to be up to date, so please rebase onto the currentmain.
CI passed on the last run of this branch.
399558d to
3a8e661
Compare
|
Thanks for the clear feedback and review, @BunsDev! I've updated the PR accordingly: Behaviour Change in Description: Updated the PR description explaining that pre-turn rejections (busy, missing cwd, deleting) now surface via the app toast (setError) rather than inline notice items, while later turn failures continue to be emitted as thread notices. |
BunsDev
left a comment
There was a problem hiding this comment.
Reviewed and verified locally on top of current main.
runner.sendthrows every early rejection (busy, unknown/deleting thread, project removal, shutdown, missing cwd) before its firstawait, so each one lands inside the one-tick window and is returned as{ ok: false, error }. Once a turn has started,runTurnturns backend failures into notice items itself, so late errors keep their existing path.- The new e2e assertion fails against
main's handler ({ ok: true }returned for a busy thread) and passes with this change:app.spec.ts14/14. npm run build && npm test: 148/148.
Two nits, neither blocking: a stray double blank line in each test file, and the outer try/catch can no longer fire since runner.send is async. Thanks for the fix.
🤖 Generated with Claude Code
…67) The three contributor bug fixes landed today: send rejections reach the caller (#61), staged renames diff as renames (#60, with its follow-ups noted), and worktree.sh survives a failed fetch (#62). #39's branding images merged yesterday. Drop all four from "Open contributor PRs". Co-authored-by: Claude Opus 5.5 <[email protected]>
Fixes #57
Summary
Surfaces early
runner.send()rejections (e.g., thread busy, missing working directory, unknown thread, or thread being deleted) back to the caller inthread:sendIPC as{ ok: false, error: string }instead of unconditionally returning{ ok: true }.User-Visible Behaviour Change
runner.send()were caught and emitted as an inline error notice item inside the thread transcript, while the IPC handler returned{ ok: true }. Now, early rejections are surfaced to the renderer via{ ok: false, error }, triggering the existingif (!r.ok) setError(...)inApp.tsxand displaying as an app toast banner.Tests
apps/desktop/test/runner.test.ts): Verified that callingrunner.send()on a busy thread rejects with/still working/, records no error notice item, and does not record the second user prompt.apps/desktop/e2e/app.spec.ts): Added an assertion in the approval workflow ensuringbridge.invoke("thread:send", ...)while a turn is in flight resolves to{ ok: false, error: /still working/ }and leaves 0 notice items in the thread.