fix(opencode): surface and render session defect errors - #42516
fix(opencode): surface and render session defect errors#42516DatScreamer wants to merge 4 commits into
Conversation
…s in the UI When a session run fails with an unexpected defect, no error reached the UI: the session just went idle. The real session.error event was published only after the session.status idle event, so clients that stop consuming on idle never rendered it. Also, when a custom tool file fails to load, the registry previously died the whole run instead of skipping it. - session/prompt.ts: publish Session.Event.Error inside the run loop before the runner transitions to idle, so clients that stop on idle still receive the real error. Guards against double-publishing errors already surfaced at their source. - server/httpapi/handlers/session.ts: promptAsync skips die causes (the loop publishes those), still publishing typed failures. - cli/cmd/run.ts: finish() returns the loop's captured error; drain it before falling back to the masked body. - session/tools.ts: surface skipped tools (from the registry) as a session.warning event and attach a warning to the assistant message. - tool/registry.ts: expose a skipped() accessor for tools that failed to load. - schema: add an optional warning field to Assistant messages and a session.warning event. - app: render tool-load warnings as an inline warning card in the session timeline. Depends on the registry skip behavior in the companion PR (anomalyco#42252) to populate skipped().
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one highly relevant related PR: Related PR:
The other search results show related error-handling PRs (#39200, #42176, #39877) that deal with session/message finalization, but they address different scopes of error handling and are not duplicates of the current PR. Conclusion: No duplicate PRs found. PR #42516 is a targeted follow-up to #42253 with a specific focus on concise error message rendering for session defects. |
|
PR #39200 overlaps the assistant-message finalization and concise-error portion of this PR through its broader |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #42515
Related to #42259.
This is a stacked PR. Its first commit is the propagation work from #42253; the following commits complete the UI fix.
Type of change
What does this PR do?
Unexpected session defects were previously lost when the run went idle. This PR contains the complete error path:
session.errorfrom the run loop before the runner transitions to idle.finish: "error"so the timeline can render it.The branch also includes the warning propagation and rendering changes from #42253 for failed custom tool loads.
How did you verify your code works?
bun run --cwd packages/opencode typechecksession.errorarrives before idle.finish: "error"and a conciseUnknownErrormessage.PR #39200 contains a broader related assistant-finalization approach based on an older
devstate; maintainers can choose to port that approach instead.Screenshots / recordings
Checklist