Skip to content

fix(test): restart shared gateway after migration convergence - #120089

Merged
vincentkoc merged 2 commits into
mainfrom
fix/test-gateway-convergence-restart-dc0b-20260806
Aug 7, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/test-gateway-convergence-restart-dc0b-20260806

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Related: #109291
Related: #119051

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Resolves a problem where shared test gateway startup could exit with the exact
doctor migration-convergence refusal before Codex/auth assertions ran. An exited
child with inherited stdio still open could also be mistaken for a running
Gateway, leaving mixed-profile and other shared consumers flaky or continuing
without a live Gateway.

Why This Change Was Made

The shared test helper now treats only a non-exited child as running. It
boundedly reaps an exited child before starting another Gateway, preserves the
original exit status and error, and retries only exit code 1 with no signal and
the exact refusal prefix under one overall startup deadline with identical
launch state. Failed launches terminate and reap the owned process tree through
the established managed-child helper; Windows retry cleanup uses its canonical
taskkill /T /F path and waits for actual stdio closure. Product runtime
behavior is unchanged.

User Impact

No product runtime change. Maintainers get deterministic shared gateway startup
for Codex/auth and other integration tests when doctor convergence completes
during the first launch, including when descendants temporarily retain inherited
stdio.

Evidence

  • Shared helper suite: 21/21 passed with
    node scripts/run-vitest.mjs test/helpers/openclaw-test-instance.test.ts.
  • Focused regressions cover terminal exit with inherited stdio open, a second
    start spawning a distinct ready Gateway, Windows descendant-tree cleanup,
    original exit status/error preservation, and process cleanup without leaks.
  • Formatting, shared-helper import boundary, git diff --check, and structured
    autoreview are clean.
  • Exact-head AWS Linux changed gate passed in Crabbox run run_3a1370530539:
    head 47dcc69ff1144e3509ab13366d54d6a822cdacce, Node v24.18.1,
    testRoot + tooling lanes, exit 0, and lease released.
  • Durable exact-head ClawSweeper run
    https://github.com/openclaw/clawsweeper/actions/runs/31141412453 found no
    actionable findings and confirmed the prior restart and Windows cleanup
    findings are resolved.
  • Node.js 26.7 child-process source and the @types/node contract were inspected:
    process exit can precede stdio closure, while close reflects the fully closed
    child-process surface.
  • Sibling Codex origin/main at 4d7e3e90d9781514f9b3b99c95169a2386868ad9
    was inspected directly. AuthManager::shared_from_config initializes cached
    auth and auth() exposes or refreshes it for consumers; no Codex behavior is
    modified. The failure and retry remain owned by OpenClaw's shared Gateway
    process lifecycle before downstream auth assertions.
  • Current origin/main has zero touched-path overlap and produces a clean
    merge-tree.

Branch base: dc0b9958999b114a8f7f5547c80f303c250b37cf

Current main checked: 0f92db6a5ad55b2cfb46e71ed7da04889a31fc35

Head: 47dcc69ff1144e3509ab13366d54d6a822cdacce

AI-assisted: yes.

Punchcard-Session: cobalt-valley-meadow-mg

Punchcard-Session: cobalt-valley-meadow-mg
@vincentkoc vincentkoc self-assigned this Aug 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 7, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 6, 2026, 10:36 PM ET / August 7, 2026, 02:36 UTC.

ClawSweeper review

What this changes

The PR makes the shared Gateway test helper reap a failed child and retry once after the precise migration-convergence refusal, with regression coverage for restart and cleanup behavior.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for normal maintainer review: the exact head resolves the prior restart and Windows-cleanup findings, but the shared helper still needs its exact-head hosted gate before merge.

Priority: P2
Reviewed head: 47dcc69ff1144e3509ab13366d54d6a822cdacce

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has strong focused lifecycle coverage and resolves the earlier review findings, with hosted exact-head consumer proof still outstanding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored draft changes test infrastructure; the focused spawned-child regressions are useful validation, while hosted exact-head coverage remains the merge check.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored draft changes test infrastructure; the focused spawned-child regressions are useful validation, while hosted exact-head coverage remains the merge check.
Evidence reviewed 6 items Refusal owner: Current main emits the exact migration-convergence refusal through ExitError(1) when the post-convergence migration identity changes.
Retry lifecycle owner: The PR records an absolute deadline, reaps an exited prior child, and retries only one classified code-1/no-signal refusal.
Regression coverage: Exact-head tests spawn fake Node Gateways and cover exact versus near refusal classification, bounded retry, inherited-stdio draining, and the Windows taskkill contract.
Findings None None.
Security None None.

How this fits together

Integration tests launch an isolated Gateway before consumer assertions such as Codex-auth flows. The shared helper owns child-process readiness, failure cleanup, and the handoff to all test consumers.

flowchart LR
  A[Integration test] --> B[Shared Gateway helper]
  B --> C[Gateway child process]
  C --> D{Startup outcome}
  D -->|Ready| E[Consumer assertions]
  D -->|Exact migration refusal| F[Reap child and retry once]
  F --> C
  D -->|Other failure| G[Surface startup error]
Loading

Before merge

  • Resolve merge risk (P1) - The shared helper affects many integration consumers, and its exact-head Linux/Node 24 changed gate has not yet produced a result.
  • Resolve merge risk (P1) - The cleanup guarantee is limited to descendants observable through the owned stdio/process cleanup path; an independent-stdio descendant is an existing unproven edge, so the PR body should not be read as universal orphan prevention.
  • Complete next step (P2) - No mechanical repair is outstanding; the remaining action is maintainer review after exact-head shared-consumer validation.
Agent review details

Security

None.

PR surface

Tests +371. Total +371 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 444 73 +371
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 444 73 +371

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; test support +190/-72; tests +254/-1 The change is confined to shared test infrastructure and its regression suite, so its merge risk is CI-process behavior rather than product runtime.

Stored data model

Persistent data-model change detected: migration/backfill/repair: test/helpers/openclaw-test-instance.test.ts, migration/backfill/repair: test/helpers/openclaw-test-instance.ts, serialized state: test/helpers/openclaw-test-instance.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Run the shared-helper changed gate (recommended)
    Require the exact-head Linux/Node 24 changed gate across helper consumers before merging this process-lifecycle change.
  2. Accept focused local coverage
    Merge based on the focused spawned-child regressions while accepting that broad hosted consumer coverage is still absent.

Technical review

Best possible solution:

Retain the bounded helper-level retry, obtain exact-head shared-consumer proof, and scope any cleanup claim to behavior covered by the lifecycle contract or add separate process-group-liveness coverage.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: the migration preflight intentionally exits with the classified refusal, while the helper owns the failed child and its restart path; the exact-head tests model that child lifecycle without a full hosted run.

Is this the best way to solve the issue?

Yes for the scoped failure: retrying at the shared lifecycle owner matches the sibling release harness and resolves the earlier findings; its cleanup wording should remain limited to the tested process-tree cases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 21e9634f1084.

Labels

Label changes:

  • add merge-risk: 🚨 automation: Changing shared child-process cleanup and restart behavior can affect CI reliability across Gateway test consumers.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored draft changes test infrastructure; the focused spawned-child regressions are useful validation, while hosted exact-head coverage remains the merge check.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 other: Current PR review merge-risk labels are merge-risk: 🚨 automation.

Label justifications:

  • P2: This is a bounded shared integration-test reliability repair with no product-runtime behavior change.
  • merge-risk: 🚨 automation: Changing shared child-process cleanup and restart behavior can affect CI reliability across Gateway test consumers.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored draft changes test infrastructure; the focused spawned-child regressions are useful validation, while hosted exact-head coverage remains the merge check.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored earlier process-group and signaled-exit fixes in this helper, the merged cross-OS retry sibling, and this PR. (role: shared-helper lifecycle contributor; confidence: high; commits: 6835f05cd03c, 912946ff9415, 53006a289e76; files: test/helpers/openclaw-test-instance.ts, scripts/lib/cross-os-release-checks/process.ts)
  • Shakker: Current-main blame attributes the existing shared-helper start and stop lifecycle region to this recent area change. (role: recent current-main contributor; confidence: medium; commits: e118e607bc68; files: test/helpers/openclaw-test-instance.ts)
  • steipete: Local history and shortlog show repeated early work on the shared helper, although the checkout history is shallow. (role: historical helper contributor; confidence: medium; commits: 5a0702ecf828, 29f5e9d35c33; files: test/helpers/openclaw-test-instance.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Run the exact-head Linux/Node 24 changed gate across shared-helper consumers.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-07T00:39:07.874Z sha 1c473ab :: found issues before merge. :: [P2] Restart after an exited child rather than returning success | [P2] Terminate the Windows process tree before retrying

Punchcard-Session: cobalt-valley-meadow-mg
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 7, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 7, 2026 02:41
@vincentkoc
vincentkoc merged commit a6b2078 into main Aug 7, 2026
153 checks passed
@vincentkoc
vincentkoc deleted the fix/test-gateway-convergence-restart-dc0b-20260806 branch August 7, 2026 02:51
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 7, 2026
* origin/main: (58 commits)
  fix(test): restart shared gateway after migration convergence (openclaw#120089)
  fix(ui): make active-run steering reliable (openclaw#120083)
  fix(telegram): preserve voice fallback text
  test(swift): preserve queued websocket frames (openclaw#120106)
  fix: reject missing oxlint shard selectors (openclaw#120096)
  test(channels): align prerelease fallback catalog spec (openclaw#120092)
  fix(node-cli): warn when systemd user lingering is disabled after install (openclaw#118430)
  fix(diagnostics): preserve CLI turn usage totals (openclaw#120100)
  fix(gateway): derive lock and coordinator paths from the resolved state dir (openclaw#120110)
  fix(release): isolate private Telegram QA harness (openclaw#120088)
  test(agents): exercise execution attribution ingress guard
  fix(gateway): defer attribution until admission succeeds
  refactor(agents): centralize exact execution attribution
  fix(google): accept base64url provider media (openclaw#116204)
  fix(plugins): warn when registerHook uses a typed hook event name (openclaw#118601)
  fix(canvas): serve Content-Length on A2UI HEAD responses (openclaw#117961)
  fix(gateway): make doctor dreaming timestamp comparators NaN-safe (openclaw#118749)
  fix(heartbeat): explain target-none skips (openclaw#119689)
  fix(security): stop recommending retired install-policy bypasses (openclaw#120011)
  fix(plugins): preserve startup release during repair (openclaw#120085)
  ...

# Conflicts:
#	CHANGELOG.md
#	src/config/sessions/session-accessor.sqlite-transcript-write.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 7, 2026
…aw#120089)

* fix(test): restart shared gateway after migration convergence

Punchcard-Session: cobalt-valley-meadow-mg

* fix(test): restart shared gateway after migration convergence

Punchcard-Session: cobalt-valley-meadow-mg
tomorrowflow pushed a commit to tomorrowflow/openclaw that referenced this pull request Aug 16, 2026
…aw#120089)

* fix(test): restart shared gateway after migration convergence

Punchcard-Session: cobalt-valley-meadow-mg

* fix(test): restart shared gateway after migration convergence

Punchcard-Session: cobalt-valley-meadow-mg
(cherry picked from commit a6b2078)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant