Skip to content

fix(server): scrub inherited Claude session env; desktop-aware update banner - #28

Merged
stretchcloud merged 1 commit into
mainfrom
fix/claude-env-scrub-and-desktop-updates
Jul 8, 2026
Merged

fix(server): scrub inherited Claude session env; desktop-aware update banner#28
stretchcloud merged 1 commit into
mainfrom
fix/claude-env-scrub-and-desktop-updates

Conversation

@stretchcloud

Copy link
Copy Markdown
Owner

Summary

  • 401 fix: the server now scrubs inherited Claude Code session env markers (CLAUDECODE, CLAUDE_CODE_SESSION_ID, CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH, …) from its own process.env at bootstrap. When Campfire was started from inside a Claude Code session, spawned claude CLIs inherited these markers, expected host-managed OAuth, skipped their keychain credentials, and 401'd on every API call. Deliberate config (CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_*) survives.
  • Desktop update UX: inside the Electron app the update banner links to the GitHub releases page ("Download update") instead of showing the-campfire install / Update & Restart, which update the npm server rather than the app bundle.

Root cause evidence

Protocol recording of the failing session shows {"subtype":"api_retry","error_status":401,"error":"authentication_failed"}; the sidecar's process env contained the full set of host-session markers; the identical CLI invocation succeeded once the app was relaunched with a clean environment.

Testing

  • 1640 tests green, including 3 new env-sanitizer tests (real incident marker set, allowlist preservation, prefix classification) and 2 new UpdateBanner desktop tests
  • Live verification: relaunched the desktop app with a clean env, created a session via the API, sent a prompt over the browser WebSocket — assistant replied, result success

… banner

A Campfire server started from inside a Claude Code session (agent-run
terminal, or the desktop app opened from such a shell) inherited the host
session's SDK env markers (CLAUDECODE, CLAUDE_CODE_SESSION_ID,
CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH, ...). Spawned claude CLIs then expected
host-managed OAuth, skipped their keychain credentials, and failed every
API call with 401 authentication_failed. The server now strips these
runtime markers from its own process.env at bootstrap, preserving
deliberate configuration (CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_*).

The update banner now shows a Download link to the GitHub releases page
inside the desktop app instead of CLI update instructions, which only
update the npm-installed server, not the app bundle.
@stretchcloud
stretchcloud merged commit 4e72c09 into main Jul 8, 2026
1 check passed
@stretchcloud
stretchcloud deleted the fix/claude-env-scrub-and-desktop-updates branch July 8, 2026 09:30
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