delete the claude-done hook and its unauthenticated endpoint

The chain was: a Stop hook in Claude's settings curls POST /api/hooks/claude-done,
the platform POSTs /_officer/panel-refresh to the pty sidecar, the sidecar sends a
`panel-refresh` frame to every attached terminal, and the Claude Code panel bumps
`preview:refresh` and `files:refresh-signal`.

It has never fired. generateClaudeSettings writes settings.json into the MANAGED
home under DATA_PATH, but HOME_DIR points terminals at the owner's real login home
— which is where Claude reads its settings from. Verified on this machine: no
claude-done hook exists in ~/.claude/settings.json, and DATA_PATH/*/home/.claude
does not exist at all.

Deleting rather than repairing it, because the Chat panel already does exactly this
job from onTurnComplete — in-process, conditioned on the turn having made tool
calls, with no hook, no HTTP round trip, and no endpoint. The chat UI is where agent
work happens; the terminal TUI is not the destination.

Also removes /api/hooks/claude-done, which was mounted above protectedRouter and so
was the one unauthenticated write-ish endpoint on the API surface.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 01:36:35 +00:00
co-authored by Claude Opus 5
parent 4eeaa3c93d
commit 96ceb3aca6
10 changed files with 31 additions and 83 deletions
+9 -4
View File
@@ -255,10 +255,15 @@ Now the structural fix, which is also most of the Pass 1 claude findings:
The rest of the Pass 1 claude findings, now unblocked: the transcript reader
(`chat/claude-sessions.ts`, 361 lines), the turn-loop state machine (`chat/websocket.ts:168-312`),
session CRUD (`chat/chat.ts`), the model catalogue (`chat/list-models.ts:5-9`), CLI install/auth
(`server-settings/claude-code.ts`), and `generate-container-context.ts`'s settings writer. Also point
the `Stop` hook at the sidecar instead of `http://localhost:5000/api/hooks/claude-done`
(`generate-container-context.ts:144-153`, `hono.ts:79-86`) — as written, that hook silently fails
during exactly the restart window we care about.
(`server-settings/claude-code.ts`), and `generate-container-context.ts`'s settings writer.
The `Stop` hook that used to be part of this stage is gone rather than moved. It curled
`http://localhost:5000/api/hooks/claude-done` so the file browser would refresh when the terminal's
Claude finished a turn, and it had never once fired: the writer installs it into the managed home under
`DATA_PATH`, while `HOME_DIR` points terminals at the owner's real login home, which is where Claude
reads its settings from. The whole chain — unauthenticated endpoint, sidecar `POST /_officer/panel-refresh`,
`panel-refresh` frame, `onPanelRefresh` prop — was deleted on 2026-08-04. The Chat panel already does the
same job from `onTurnComplete`, in-process, with no hook and no HTTP round trip.
### Stage 5 — the harder question: surviving a *sidecar* restart