Skip to content

fix(desktop): surface token on WS + CLI; harden pull/cleanup/health - #255

Merged
robdmac merged 1 commit into
mainfrom
fix/desktop-surface-ws
Jul 9, 2026
Merged

robdmac merged 1 commit into
mainfrom
fix/desktop-surface-ws

Conversation

@robdmac

@robdmac robdmac commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

…p/health

Addresses a code review of the desktop surface-token gate + robustness:

P1 (WS omit surface token): the surface gate wasn't propagated to WebSocket URL
builders, so terminal streaming, live collaboration, and session-control WS all
401 on desktop (WS can't send the header). Append ?surface= (+ user_id for the
control WS, which had no params). Fixes desktop terminals/collaboration.

P1 (CLI): cp_call and open_pty_ws now send the surface token (header) like
apply_auth already did — CLI/TUI commands were 401ing under the gate.

P2 (pull symlink): route the pull write through an O_NOFOLLOW open (new
safe_write), mirroring the folder-import path, so a pre-planted terminal-component
symlink can't be written through (safe_workspace_dest already guards ancestors).

P2 (PID reuse): cleanup_stale_processes verifies a PID's command line is actually
ours (data-dir/bundle/binary markers) before SIGTERM/SIGKILL — no longer kills an
unrelated process that recycled the PID after a crash.

P3 (health): wait_for_health now requires a real HTTP response (any status — the
d1-shim/frontend legitimately 404), not just a TCP connect, so a stray listener
isn't mistaken for readiness.

Both bins + frontend typecheck clean. Revision markers bumped.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014t8Ukp4NPWtqJ55X261wMZ
@robdmac
robdmac merged commit 2e1b305 into main Jul 9, 2026
1 check passed
@robdmac
robdmac deleted the fix/desktop-surface-ws branch July 9, 2026 14:03
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.

1 participant