test(sandbox): cover gateway restart forward recovery and marker precedence - #8163
Conversation
…edence Add regression tests for restartSandboxGateway forward recovery: combined auxiliary forward failure detail in declaration order, the null-means-not-enabled contract for each auxiliary forward, and the primary forward failure reported ahead of auxiliary failures. Add classification precedence tests for co-occurring supervisor markers: each specific marker ahead of the health timeout it causes, a stopped supervisor ahead of the generic control markers, the replacement-stage layer with a generic marker present, MCP drift ahead of the co-reported config hash mismatch, and precedence across stdout and stderr. Signed-off-by: Kushagar Garg <dreamstick909@gmail.com>
📝 WalkthroughWalkthroughThe PR adds gateway restart tests for failure-classification precedence and forward-recovery result reporting. The tests cover combined output streams, auxiliary-forward aggregation and filtering, successful recovery, and primary-forward failure precedence. ChangesGateway restart recovery
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
1 additional E2E selection from the second opinionAdvisory only. The primary lane did not select these E2E jobs or targets.
Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate. 2 semantic terminology decisionsTerminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.
E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: None 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
apurvvkumaria
left a comment
There was a problem hiding this comment.
Reviewed exact head 042ad6b. This test-only change accurately exercises existing gateway restart marker precedence and forward-recovery result contracts without changing production behavior. I found no blocking defect. The failed primary advisor lane published an informational assessment with zero findings; the second opinion completed cleanly.
Summary
Adds regression tests for two risky gateway restart paths in
src/lib/actions/sandbox/gateway-restart.ts: host-forward recovery after a successful restart and failure-layer classification when supervisor markers co-occur. Behavior is unchanged; the tests lock the current contracts so a future edit to marker ordering or forward recovery fails fast.Changes
nullmeans not enabled and onlyfalsefails the restart, including the full success result when no auxiliary forward is enabled.classifyGatewayRestartFailureprecedence for co-occurring markers: each specific marker ahead of the generic health timeout it causes, a stopped supervisor ahead of the generic control markers, the replacement-stage layer with a generic control marker present, MCP drift ahead of a co-reported config hash mismatch, and the same precedence when markers split across stdout and stderr.Type of Change
Quality Gates
Documentation Writer Review
no-docs-neededsrc/lib/actions/sandbox/gateway-restart.test.ts(+154 test lines). Every asserted layer name and detail string pre-exists insrc/lib/actions/sandbox/gateway-restart.ts, and that file is unchanged. Docs pages that mention gateway restart (docs/manage-sandboxes/gateway-lifecycle-control.mdx,docs/reference/troubleshooting.mdx,docs/manage-sandboxes/runtime-controls.mdx) do not enumerate the tested failure layers or detail strings, so no page claim is affected. A change with no user-visible surface requires no pre-tag changelog entry.DGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run validate:prpassed after refreshingorigin/mainwhen hooks were skipped or unavailable — pre-commit and commit-msg ran on the local commit, andnpm run validate:prpassed after refreshingorigin/main.npx vitest run --project cli src/lib/actions/sandbox/gateway-restart.test.ts→ 32 passed (18 pre-existing + 14 new);npm run test:changed→ 32 passed;npm run typecheck:cli→ clean. Each of the 14 new tests was also observed to fail under a deliberate implementation break before the break was reverted (seven mutations: reversed join order,nulltreated as failed, health-timeout check hoisted first, auxiliary failures checked before the primary forward, stopped-supervisor check demoted, replacement-stage check demoted, config-hash check moved ahead of MCP drift).npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)Signed-off-by: Kushagar Garg dreamstick909@gmail.com