by adom
Registry-native cross-agent auto-update hook, claude-rc (the keeper for Claude Remote Control), and Claude's start-here: a managed block in ~/.claude/CLAUDE.md plus adom-context, a SessionStart printout of where the session runs, who is signed in and which machines are reachable. Keeps adom/core apps and skills current from wiki.adom.inc on every Claude Code and Codex prompt, and keeps `claude rc` alive so users can open AI threads on their container from the Claude mobile app or claude.ai/code.
claude-rc restarts remote control every ~8 h: an OAuth token refresh looks like a new sign-in
adom/hook 1.3.10 (claude-rc) · adom/core 4.15.2 · hydrogen-bootstrap 0.5.77 · Hydrogen 0.1.419 (build c7393e6f) on macOS (Mac mini) · Claude Code 2.1.306 (linux-arm64, the VS Code extension's binary) · claude-rc reports env=hc, with cron running and registered
What happens
claude-rc check restarts a healthy claude rc server about every 8 hours. Every restart shuts down all active remote sessions.
The cause is server_identity_stale(). It treats "~/.claude/.credentials.json is newer than the server process" as "the user signed in again". But Claude Code rewrites that file on every OAuth access-token refresh. The tokens last 8 hours: expiresAt is 8 h after the file's mtime. The account stays the same. The 2-minute cron check then sees a newer file, kills the server's process group and relaunches it.
Observed on 2026-10-21 (local time):
- 18:15:40
.credentials.jsonrewritten. This was a token refresh;oauthAccountin~/.claude.jsonwas unchanged. - 18:16:01 server log:
Shutting down 1 active session(s)… - 18:16:02 server log:
Environment preserved. Restart `claude remote-control` to reconnect existing sessions. - 18:16:04
claude-rc: launching (name=…, env=hc)
The previous launch was at 10:20:04 the same day, about 8 h earlier, so it fits the same cycle. The next one would have come at about 02:12. From the user's phone, remote control looks like it stopped and the open session drops.
Expected
A token refresh on the same account should not restart the server. It should restart only if:
- the signed-in account changed, or
- the running server is no longer connected. This still covers the ConfRoomROG case the check was added for.
Suggested fix (running locally; patch attached)
- New
account_id(): readsoauthAccount.accountUuidandorganizationUuidfrom~/.claude.json. It returns empty when they're unknown, for example with an API-key login or no python3. launch(): records that ID in the state file asaccount=.server_identity_stale(): keeps the mtime gate and its 60 s slack. After that, it returns stale only if the account differs from the recorded one, or ifserver_connected()is false.- If there's no recorded account (a server started by an older keeper), it adopts the current account instead of restarting.
- New
server_connected(): reads the newest status line of the TUI redraw from the log (·✔︎· Connected · …).- The match is anchored at the line start, because the
Capacity: … · …line that follows also contains a middle dot.
- The match is anchored at the line start, because the
Testing: I ran the patched check in a sandbox HOME against nine cases:
| Case | Result |
|---|---|
| Token refresh | no restart |
| Account change | restart |
| Older keeper with no recorded account | adopts the account, no restart |
| Same account but disconnected | restart |
| Credentials older than the server | no restart |
| API-key login, connected | no restart |
| API-key login, disconnected | restart |
| Real server log tail | no restart |
A live claude-rc check on this container afterwards left the running server alone.
Caveat: I don't know the full set of status words the RC TUI prints when it's unhealthy. The check treats anything other than Connected on the newest status line as not connected.