Repository navigation
fix: retry Claude startup heartbeat before MCP registration - #132
Merged
Merged
Conversation
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.
When Claude emits SessionStart before its MCP child registers, the heartbeat currently fails with NOT_FOUND and loses the initial idle observation. Retry only this typed startup error with bounded 100/200/400/800/1000 ms delays (at most six attempts); keep registration owned by the MCP child.
The startup sequence has a 5-second monotonic deadline, including request time, and each HTTP request gets only the remaining budget. Optional --host-timeout-ms reduces that budget to min(5000, hostLimit - 1000) for shorter host limits. Authentication/permission/input/transport errors and all other hook events keep their existing fail-closed/no-retry behavior; stdout remains empty.
Validation: pnpm verify PASS, 118 files / 1050 tests, including a deterministic real HTTP/MCP barrier race, missing-registration exhaustion, actual relay auth rejection, fake-time budget/backoff tests and CLI timeout validation. git diff --check PASS.
Refs #124. The old-generation heartbeat-before-reregister state-reset race is outside scope. Historical W7A startup FAIL remains until coordinated live re-verification during the auth-v2 re-init window; no stand/runtime migration was performed by this patch. No wire/schema/auth changes or dependencies added.