fix(crew): stop startup validation logging a false-positive error on healthy boots - #99
Open
abhishekmishragithub wants to merge 1 commit into
Open
fix(crew): stop startup validation logging a false-positive error on healthy boots#99abhishekmishragithub wants to merge 1 commit into
abhishekmishragithub wants to merge 1 commit into
Conversation
The crew server dry-runs setup_handler at startup to catch node __init__ /
import / missing-env / graph errors before accepting traffic. The canonical
handler ends with `await session.start()`, but the dry-run intentionally skips
`session.initialize()`, so start() hit `raise ValueError('Session not
initialized')` on every healthy boot. That logged:
ERROR | Startup validation failed — pod will not accept sessions.
ValueError: Session not initialized
and left the pod _ready=False, for perfectly correct code. Users had to be
told in the docs to ignore it.
Add a dry-run mode: in `session.start()`, when _dry_run is set, build the graph
(still surfaces node/edge/cycle errors) and raise an internal
_StartupProbeComplete to halt cleanly, without requiring the init handshake or
starting nodes. The validator swallows that sentinel and marks the pod ready.
Genuinely broken handlers (node __init__ raising, imports, cycles) still fail
validation and keep the pod not-ready. The real session path is untouched
(_dry_run is only set by the validator).
Tests: canonical handler passes, broken handler fails, dry-run start() builds
the graph and raises the sentinel without an init event.
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.
Problem
The crew server dry-runs your
setup_handlerat startup to catch node__init__/ import / missing-env / graph errors before accepting traffic. But the canonical handler ends withawait session.start(), and the dry-run intentionally skipssession.initialize(), sostart()hitraise ValueError("Session not initialized")on every healthy boot:It also left the pod
_ready = Falsefor perfectly correct code. The docs had to tell users to ignore this scary error (quickstart "Expected boot output" note).Fix
Add a dry-run mode to
CrewSession:_dry_runis set only by the server's validator (real sessions never set it).session.start(), when_dry_runis set: build the graph (still surfaces node/edge/cycle errors), then raise an internal_StartupProbeCompleteto halt cleanly, without requiring the init handshake or starting nodes (no external connections).Genuinely broken handlers (node
__init__raising, imports, cycles) still fail validation and keep the pod not-ready, with a real reason. The live session path is untouched.Result
Tests
session.start()) passes validation,_readytrue.__init__raises fails validation,_readyfalse with the reason.start()builds the graph and raises the sentinel with no init event.Green locally: ruff 0.16.1 (check + format), mypy 1.13.0, pytest (crew suite 26 passed).
Held for review.