Usage reports: retry on the heartbeat, time real first runs, honest respawn hooks, Windows shell and CLI versions - #1928
Merged
Conversation
A boot check-in that failed (a login item started before the network was up) or a UTC day with no "active" yet waited for the six-hour timer, which does not run while the machine sleeps. The beat now checks in first when something is due, and never beside a check-in that is still running.
An install upgraded from a version without reports had no id, so its first check-in made one dated now, and its next session went out as a new install that activated within minutes. The id now carries an install time only when the boot read found no settings file at all.
PSModulePath and ComSpec are set machine-wide, so every Windows deck said pwsh. The shell is now read off what each one leaves for what it starts: PowerShell's user module folder (pwsh or powershell) or cmd's PROMPT. With neither, as for the desktop app from the Start menu, none is sent.
The probe started on the first report's facts, which went out without them, so install, update and every active sent at a boot carried no Claude Code or Codex version, and a deck left running kept the ones it booted with. The reporter now starts the probe once reports are known to be on, waits up to eight seconds for it before an install, update or active, and asks again on each new UTC day.
A respawned deck said the Claude hooks were ok before it had done anything, so the update a self-update sends said so even when the re-install had just refused settings.json. A respawn that re-installed now says how that went; one that installed nothing says what the first boot said, which the supervisor hands down in AGENTS_DECK_BOOT_HOOKS, and nothing at all when none was handed down.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
AGENTS_DECK_BOOT_HOOKS(the worker tells it over the existing IPC channel); and one under a supervisor that handed nothing down leaves the field out.PSModulePathandComSpecare set machine-wide, so every Windows deck said "pwsh". The shell is now read off what each one leaves for what it starts: PowerShell's user module folder under the user's profile ("pwsh" for PowerShell 7, "powershell" for Windows PowerShell) or cmd'sPROMPT("cmd"). With none of them, as for the desktop app started from the Start menu, no shell is sent. Nothing about the profile path leaves: the field is still one of those fixed words.What leaves is unchanged in kind: the same fields, each still a count, a bucket or a short fixed token, and a field that cannot be told is left out.
Verification
npm run typecheck: clean.npx vitest run --maxWorkers=3 --minWorkers=1): 845 files, 11388 tests passed.reports-checkin-retry.test.ts: a boot check-in that failed offline was followed by pings only (expected [] to deeply equal ['install', 'active']), and a day woken into got no "active" on the next beat. Two guards also cover a beat with nothing due and a beat during a check-in that is still running.reports-upgrade-first-run.test.ts: an upgrader's id gotinstalledAt= now (expected '2026-10-04T10:00:00.000Z' to be ''). It also checks the boot read itself: no file means a first run, while a settings file or a corrupt one does not.shell-token-windows.test.ts: machine-wide variables alone read as "pwsh" (expected 'pwsh' to be undefined), and so did cmd and Windows PowerShell.reports-cli-version-probe.test.ts: install, update and the first "active" had noclaudeVersion, and a new day's "active" kept the boot-time version. Guards also cover a hanging probe (bounded wait) and no probe while reports are off or vetoed.respawn-hooks-report.test.ts: spawns the realbin/deck.jsas a respawn, with fetch replaced before it loads. The "update" carriedclaudeHooks: "ok"after "Claude hooks not updated … could not be read as JSON", and also with a handed-down "failed" or with nothing handed down. A second case runs the shippedbin/agent-dag.jsover a stub worker, which got nothing handed down before the change.activation.test.ts(the respawn'snoteSetupline),second-deck-attaches.test.ts(the boot read'sprefsReadline) andreports-1853.test.ts(the two Windows shell cases, plus the harness now says it is a first run instead of reading this machine's settings).