Skip to content

fix(brainstorming): keep visual companion server alive on fs errors - #2764

Open
Sakibpedia wants to merge 1 commit into
obra:mainfrom
Sakibpedia:fix/brainstorming-visual-companion-crash
Open

Sakibpedia wants to merge 1 commit into
obra:mainfrom
Sakibpedia:fix/brainstorming-visual-companion-crash

Conversation

@Sakibpedia

Copy link
Copy Markdown

Fixes #2757 (visual companion crash + JSON escaping).

Changes:

  • server.cjs: wrap request handler in try/catch so a failing fs call (e.g. unreadable/replaced screen file) returns 500 instead of killing node; read file before writeHead; guard appendFileSync/unlinkSync; change choice check to !== undefined && !== null.
  • helper.js: include choice field in choice events.
  • start-server.sh: add json_escape and use it in both error JSON outputs.

All three files pass syntax checks (node --check, bash -n).

@danishkumar26 danishkumar26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. Persistence gate now keeps falsy choices (event.choice !== undefined && !== null), event and file read failures become logged errors or 500 responses instead of server crashes, and unknown arguments plus the killed-server message are JSON-escaped in start-server.sh.

Companion note: PR #2761 on dev fixes the same dropped-choice-event bug from the server side by normalizing choice-shaped events there; both approaches converge on the same persisted event shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brainstorming visual companion: one failing request kills the server; start-server.sh emits invalid JSON on quotes

2 participants