GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): handle JSON parse error on double-escape abort by zerone0x · Pull Request #7959 · anomalyco/opencode

Conversation

@zerone0x

@zerone0x zerone0x commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #7946

When aborting a session with double-escape (pressing Esc twice), the session.abort() call races with the in-flight session.prompt() request. If the server terminates the response mid-stream, the response body is incomplete or empty, causing the SDK's JSON parser to throw SyntaxError: Unexpected end of JSON input.

Changes

  • Added .catch(() => {}) to the session.abort() call in the TUI prompt component to silently ignore expected errors during abort

This matches the existing pattern used in routes/session/index.tsx:400 and app/src/pages/session.tsx:577 for the same scenario.

Test plan

  • Run bun run typecheck on the opencode package (passes)
  • Manual test: Start a task, press Esc twice to abort mid-work
  • Verify no crash occurs, session aborts cleanly

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zerone0x
zerone0x requested a review from adamdotdevin as a code owner January 12, 2026 09:30
@github-actions

github-actions Bot commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #7939: "fix: add error handling to RPC system to prevent crashes on session abort"
#7939

Why it's related: This PR addresses the same underlying issue of handling errors during session abort to prevent crashes. Both PRs target the scenario where a session abort races with in-flight requests, though PR #7939 focuses on the RPC system while PR #7959 (current) targets the TUI prompt component specifically.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zerone0x
zerone0x force-pushed the fix/abort-json-parse-crash branch from 88785d6 to a29bca8 Compare January 12, 2026 09:46
@zerone0x @claude
fix(tui): handle JSON parse error on double-escape abort
dda8368
When aborting a session with double-escape, the abort races with the
in-flight prompt request. If the response is incomplete or empty, the
SDK's JSON parser throws "Unexpected end of JSON input". Adding .catch()
silences this expected error during abort, matching the pattern used
elsewhere for session.abort() calls.

Fixes anomalyco#7946

Co-Authored-By: Claude <[email protected]>
@zerone0x
zerone0x force-pushed the fix/abort-json-parse-crash branch from a29bca8 to dda8368 Compare January 12, 2026 09:47
This was referenced Jan 12, 2026
fix: handle prompt abort to prevent JSON parse crash #8025
Closed
fix: gracefully handle invalid json response #8104
Closed
@mrlubos

mrlubos commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

@zerone0x this will be handled upstream, not sure if your change is still relevant after that hey-api/hey-api#3202

zerone0x reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jan 16, 2026
fix: skip corrupted session files when listing sessions #8825
Closed
chore(sdk): update @hey-api/openapi-ts to 0.90.4 #8921
Merged
@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@github-actions

github-actions Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Crash on double-escape abort: JSON parse error from prompt response

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@zerone0x @mrlubos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.