feat(cli): guide onboarding and diagnose session readiness - #54
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.
Initial CLI use currently opens a long manual and an unready attach eventually ends in an unexplained WebSocket 503. This change adds compact command help, honest build version reporting, a bounded
doctorreadiness report, and observed readiness guidance with an exact reattach command after initial retries expire.Doctor uses the existing identity, runner, environment, and agent routes. Basic session checks require authentication and observed runner capacity; environment/agent setup remains a warning, with installed binaries and provider validity explicitly unverified. It uses a 15-second total budget including ordinary token refresh, bounds requests and bodies, and avoids raw diagnostic bodies, URL secrets, and terminal controls. Existing established-stream reconnect and lifecycle behavior remain intact. The quickstart documents prerequisites, environment/agent setup, and detach/reattach.
Validation:
make verifypassed (all Go tests, contract gates, builds, vet). Focused tests cover help/version subprocesses, config/auth/status/transport failures, bounded refresh, safe output, runner evidence, optional endpoints, and attach reconnect. A separate built-CLI run against a temporary local synthetic HTTP/WebSocket server verified doctor, new, Ctrl-] detach, reattach, the actual 60.2-second initial wait, Ctrl-C session retention, exactly one creation per command, zero deletions, and unchanged temporary config. Full live infrastructure/GitHub login end-to-end tests are outside this change's authorized verification scope.No release, tag, npm artifact, provisioning, image, or credential-flow changes. These improvements require a separately authorized future binary/package release to reach installed users; published 0.0.3 is untouched.
Independent and adversarial read-only reviews both pass at
1fa0b5e. Review findings were fixed with permanent regressions: original/rotated credential redaction, normalization and overlapping-token handling, strict bounded JSON validation, malformed optional rows, and optional environment permission warnings.Follow-up review fixes
Both requested findings are fixed in f765954 and 4e4995d. Development builds now stamp the actual source worktree revision and dirty state; direct unstamped builds report plain dev. Synthetic nested-worktree tests cover distinct parent/worktree commits, opposing dirty states, and exported source without a repository. The timeout/unsafe-ID test uses an atomic counter and waits for the timed-out handler before comparing request counts.
Follow-up adversarial review identified linker-flag precedence; 4ad1e84 preserves effective GOFLAGS and explicit linker arguments. Release overrides and stripping-only builds have permanent regressions and documented version behavior.
Final verification passed: make verify; uncached race tests for cmd/rainier, internal/cli, and internal/attachio; real clean-worktree make build produced rainier dev (4ad1e84), matching git HEAD. Both focused independent and adversarial reviews pass at 4ad1e84. No source changes remain uncommitted; no merge or release was performed. Live credentialed cloud qualification remains outside these fixes.