Skip to content

feat(status): warn when the daemon is running an older config#102

Merged
rgao-coreweave merged 3 commits into
mainfrom
feat/status-drift-via-socket
Jun 17, 2026
Merged

feat(status): warn when the daemon is running an older config#102
rgao-coreweave merged 3 commits into
mainfrom
feat/status-drift-via-socket

Conversation

@rgao-coreweave

@rgao-coreweave rgao-coreweave commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

Adds the status drift warning, using a socket query instead of a file so nothing is written to disk and the daemon's loaded config stays purely in memory.

When a daemon is alive but loaded a different config than settings.json now resolves to, status prints (right under the agent-name line from #103):

✓ Agent name: goober
⚠ Daemon is running an older config. Run: weave-claude-code restart

How it works

  • The daemon answers a new read-only config-hash control message over its existing socket with a fingerprint of the config it loaded (the API key is hashed, never sent).
  • status queries it, computes the current fingerprint from settings.json, and warns on mismatch. Any error or missing reply (for example an older daemon) leaves the warning off, so status never breaks.
  • The socket server gains allowHalfOpen so it can reply after the client half-closes. Every branch now closes the socket explicitly, so the high-frequency hook-event path still ends promptly.

New exports (why)

  • resolveDaemonConfig / daemonConfigFingerprint / DaemonConfig (daemon.ts): exported so status computes the fingerprint exactly the way the daemon does, from one shared resolver rather than duplicated precedence logic. resolveDaemonConfig also replaces the inline resolution in runDaemon.
  • requestFromSocket (utils.ts): a reply-reading sibling of sendToSocket, so status can query the daemon and read its config-hash response.

Tests

npm run check: 64 pass, clean build. Adds tests/config-drift.test.ts (fingerprint unit, status warning via a stand-in server, and an end-to-end check against a real daemon). The existing hook-handler and daemon-signal integration tests still pass, confirming allowHalfOpen did not regress event forwarding.

Stack

Top of a 3-PR stack: restart (#101) -> surface agent_name in status (#103) -> this. Based on #103's branch; retarget down the stack as each merges.

🤖 Generated with Claude Code

@rgao-coreweave rgao-coreweave force-pushed the feat/daemon-restart-and-status-agent-name branch from e7c4a3f to d1b34eb Compare June 17, 2026 00:02
@rgao-coreweave rgao-coreweave force-pushed the feat/status-drift-via-socket branch from 636e3c4 to e585c99 Compare June 17, 2026 00:04
@rgao-coreweave rgao-coreweave force-pushed the feat/daemon-restart-and-status-agent-name branch 2 times, most recently from 4b0569c to f9fed60 Compare June 17, 2026 00:18
@rgao-coreweave rgao-coreweave force-pushed the feat/status-drift-via-socket branch from e585c99 to 18f331e Compare June 17, 2026 00:21
@rgao-coreweave rgao-coreweave changed the base branch from feat/daemon-restart-and-status-agent-name to feat/status-agent-name June 17, 2026 00:21
@rgao-coreweave rgao-coreweave force-pushed the feat/status-agent-name branch from db031c5 to 15cc467 Compare June 17, 2026 16:35
- daemon replies to a config-hash socket query with its loaded config fingerprint
- status compares it to settings.json and warns to restart on drift (no disk write)
- socket server gains allowHalfOpen to reply; every branch closes the socket

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rgao-coreweave rgao-coreweave force-pushed the feat/status-drift-via-socket branch from 18f331e to f6dd39e Compare June 17, 2026 16:54
@rgao-coreweave rgao-coreweave changed the base branch from feat/status-agent-name to main June 17, 2026 16:54

@drtangible drtangible left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Comment thread src/daemon.ts Outdated
Comment thread src/daemon.ts Outdated
Comment thread src/utils.ts Outdated
Comment thread src/daemon.ts Outdated
@w-b-hivemind

w-b-hivemind Bot commented Jun 17, 2026

Copy link
Copy Markdown

HiveMind Sessions

1 session · 5m · $1.53

Session Agent Duration Tokens Cost Lines
Code Review Reception And Pr Fixes
7dde1aba-91c0-4c44-a8bf-9a147e593889
claude 5m 32.8K $1.53 +19 -12
Total 5m 32.8K $1.53 +19 -12

View all sessions in HiveMind →

Run claude --resume 7dde1aba-91c0-4c44-a8bf-9a147e593889 to pickup where you left off.

rgao-coreweave and others added 2 commits June 17, 2026 14:56
- isControlMessage: prove object-ness before reading `command` instead
  of casting to the target type within the guard
- DaemonConfig: un-export; the type flows to `status` via inference
  through resolveDaemonConfig/daemonConfigFingerprint
- formatting: expand the socket end-handler guard clauses and the
  requestFromSocket timeout to multi-line

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Converts DaemonConfig and the other plain object shapes in daemon.ts
(ControlMessage, PendingToolCall, ActiveChatSpan, SubagentTracker,
TeamMember, SessionState) from interface to type for consistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rgao-coreweave rgao-coreweave marked this pull request as ready for review June 17, 2026 22:53
@rgao-coreweave rgao-coreweave requested a review from a team as a code owner June 17, 2026 22:53
@rgao-coreweave rgao-coreweave merged commit 8a03d50 into main Jun 17, 2026
4 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants