Skip to content

fix(gateway-state): accept Running phase as alive alongside Ready#3146

Merged
cv merged 1 commit into
mainfrom
issue-3138-accept-running-phase
May 7, 2026
Merged

fix(gateway-state): accept Running phase as alive alongside Ready#3146
cv merged 1 commit into
mainfrom
issue-3138-accept-running-phase

Conversation

@jyaunches

@jyaunches jyaunches commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #3138 — On some deployments (e.g. Brev launchables) the sandbox stays in Running phase which is functionally equivalent to Ready. The CLI previously treated this as "not ready", causing false-negative health reports, dashboard showing the agent as stopped, and recovery logic not triggering.

Changes

File Change
src/lib/state/gateway.ts isSandboxReady() now matches both Ready and Running columns
src/lib/actions/sandbox/gateway-state.ts ensureLiveSandboxOrExit() no longer exits on Running phase
test/onboard-readiness.test.ts +2 tests for Running phase detection (plain text + ANSI-wrapped)

Testing

  • test/onboard-readiness.test.ts — 36/36 passed
  • test/gateway-state.test.ts — 37/37 passed

Context

This is the CLI-side prerequisite for brevdev/nemoclaw-image#10, which replaces the onboard-ui's reinvented health checks with NemoClaw CLI calls. Originated from #2258 (sub-item #4), which was closed with work redirected to the nemoclaw-image repo.

Summary by CodeRabbit

Release Notes

  • New Features

    • Sandboxes in "Running" state are now recognized as operational, expanding support for different sandbox phase conditions.
  • Tests

    • Added test coverage for sandbox readiness detection with "Running" state and ANSI-encoded outputs.

On some deployments (e.g. Brev launchables) the sandbox stays in
"Running" phase which is functionally equivalent to "Ready" — the
agent is live and the gateway is reachable inside. Previously the CLI
treated this as "not ready" which caused false-negative health reports.

Changes:
- isSandboxReady() now matches both "Ready" and "Running" columns
- ensureLiveSandboxOrExit() no longer exits on "Running" phase
- Two new tests for Running phase detection (plain + ANSI)

Fixes #3138
@jyaunches jyaunches added bug Something fails against expected or documented behavior platform: brev Affects Brev hosted development environments Getting Started labels May 6, 2026
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 94302974-2757-4081-aca3-ea0172f2aa8c

📥 Commits

Reviewing files that changed from the base of the PR and between ca1d6b8 and 3318c4d.

📒 Files selected for processing (3)
  • src/lib/actions/sandbox/gateway-state.ts
  • src/lib/state/gateway.ts
  • test/onboard-readiness.test.ts

📝 Walkthrough

Walkthrough

The PR expands sandbox liveness detection to recognize both Ready and Running phases as indicating a live sandbox. The logic change is applied to the readiness check function and used in the gateway state action, with new test cases validating the expanded behavior.

Changes

Sandbox Phase Liveness Detection

Layer / File(s) Summary
Core Readiness Logic
src/lib/state/gateway.ts
isSandboxReady now returns true when sandbox phase contains "Ready" or "Running" (while still excluding "NotReady"). Documentation expanded to explain column variability across OpenShell versions and functional equivalence of both phases.
Gateway State Action
src/lib/actions/sandbox/gateway-state.ts
ensureLiveSandboxOrExit updates phase-gating logic to permit Running alongside Ready, preventing premature exit when sandbox reports this phase.
Test Coverage
test/onboard-readiness.test.ts
Two new regression test cases verify that Running phase is accepted as ready/alive, including scenarios where status is ANSI-colored.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

The sandbox runs with vibrant grace,
We thought Ready was the only face—
But Running flows through digital veins,
Our CLI's wisdom now sustains
Both states as one! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: accepting Running phase as alive alongside Ready in gateway-state logic.
Linked Issues check ✅ Passed All objectives from issue #3138 are met: isSandboxReady() updated to accept both Ready and Running phases, ensureLiveSandboxOrExit() updated accordingly, and tests added for Running phase detection.
Out of Scope Changes check ✅ Passed All changes directly address issue #3138 requirements; no out-of-scope modifications detected across the three modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-3138-accept-running-phase

Comment @coderabbitai help to get the list of available commands and usage tips.

@cv cv merged commit fa99a37 into main May 7, 2026
21 checks passed
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: install Install, setup, prerequisites, or uninstall flow area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression and removed priority: high bug Something fails against expected or documented behavior labels Jun 3, 2026
@jyaunches jyaunches deleted the issue-3138-accept-running-phase branch June 12, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: install Install, setup, prerequisites, or uninstall flow area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression platform: brev Affects Brev hosted development environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(gateway-state): accept Running phase as alive alongside Ready

4 participants