Skip to content

fix(test): isolated setup Gateway exits before readiness - #182990

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1900
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1900

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #182968, #182957

What Problem This Solves

Fixes interactive setup conformance tests exiting before authenticated Gateway readiness after the runtime-profile validation change in #182856.

User Impact

No production behavior, configuration, or migration changes. Restores the existing onboarding, setup, and crestodian persistence and Gateway ownership-handoff proof.

Why This Change Was Made

The real published package already includes standalone-runtime-profile.mjs. The shared createSourceRuntime fixture omitted it, so its linked packages/llm-core/src/validation.ts import failed when each isolated Gateway started. Copy that root module through the existing fixture owner. No timeout, readiness detection, or assertion changes are needed.

Production: +0/-0 LOC. Test support: +1/-0 LOC. The author simplification pass retained this single required file-list entry; existing integration tests already reproduce the defect and protect the complete handoff.

Evidence

  • Fetched the full log for PostgreSQL conformance 2/3, job 121002491409 once. All seven failing handoffs report Cannot find module .../runtime/standalone-runtime-profile.mjs, imported from packages/llm-core/src/validation.ts, followed by child exit 1. This is a deterministic missing fixture asset, not a PTY readiness race.
  • Clean main baseline 273fe5a0e97d92401762c92eebacd95b1b5c11b6: all three SQLite cases fail identically (3 failed, 5 PostgreSQL cases skipped). Two additional Node-only onboard runs also fail identically (1 failed, 7 skipped each). Vitest durations: 99.63 s, 29.24 s, 27.65 s; wrapper wall times: 206.31 s, 38.64 s, 37.51 s. The first run used the default pinned Bun test runner; repeat runs and the fixed proof used Node 26.12.1.
  • Fixed real-flow run: 3 passed, 5 PostgreSQL cases skipped. Each real CLI completes interactive setup, persists state, starts an isolated Gateway child, authenticates, handles Ctrl-C, and proves the parent retained its CLI role. Case times: onboard 21.512 s, setup 22.221 s, crestodian 18.950 s. Vitest duration: 74.22 s; wrapper wall time including runtime preparation: 167.86 s. No inference call is needed for this storage/ownership contract.
  • Focused source-runtime Doctor ownership test: 1 passed, 19 unselected; test time 809 ms, Vitest duration 34.99 s (93% transform), wrapper wall time 43.21 s. This verifies source fixtures still keep Doctor UI checks inside their package root.
  • Targeted Doctor test typecheck, scoped type-aware oxlint, oxfmt, git diff --check, and Madge pass; Madge reports 0 cycles. Independent Codex autoreview through P2: scoped-clean, no actionable findings.
  • All runtime proof used isolated HOME and OPENCLAW_STATE_DIR; no operator Gateway or state was used. No remote lease was used. Full check:changed/SQLite inventory was omitted under the campaign's local gate budget; PR CI supplies broad proof. PostgreSQL was not exercised locally. The earlier PTY-exit timeout reported on fix(doctor): stop doctor --lint from creating empty PostgreSQL workboard schemas #182827 has a different signature; this PR does not claim to fix it.

Commands (with isolated state exported before each runtime/check command):

node scripts/run-vitest.mjs src/infra/database-engine/interactive-setup.integration.test.ts --maxWorkers=1 -t 'sqlite interactive setup'
OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/infra/database-engine/interactive-setup.integration.test.ts --maxWorkers=1 -t 'sqlite interactive setup.*onboard saves interactive setup'
OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/commands/doctor-config-preflight.process.test.ts --maxWorkers=1 -t 'keeps Doctor UI checks inside the source runtime fixture'
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.commands-doctor.json --incremental
node scripts/run-oxlint.mjs --tsconfig test/tsconfig/tsconfig.core.test.commands-doctor.json src/commands/doctor-config-preflight.process.test-support.ts
node_modules/.bin/oxfmt --check src/commands/doctor-config-preflight.process.test-support.ts
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts
git diff --check

Copy standalone-runtime-profile.mjs into the shared isolated runtime fixture. The LLM validation import added in #182856 otherwise makes every interactive setup Gateway child exit with ERR_MODULE_NOT_FOUND. Existing authenticated Gateway handoff assertions remain unchanged.
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 24, 2026 22:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T22:53:33.654674Z ccf0918 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Copy the runtime-profile module into isolated test runtimes so setup Gateway children can start.

Example: The SQLite interactive onboard test starts its isolated Gateway child.

  • Before: The child cannot import runtime/standalone-runtime-profile.mjs and exits before authenticated readiness.
  • After: The fixture supplies the module, allowing the existing readiness and shutdown assertions to run.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal, source-verified fixture repair with reported CLI/Gateway regression coverage; PostgreSQL CI is still running.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored fixture repair is outside the contributor proof gate; the body reports isolated real CLI and Gateway subprocess runs, and source inspection confirms their unchanged authenticated-readiness and shutdown assertions.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Setup conformance tests lose Gateway readiness and ownership-handoff coverage because their isolated runtime is incomplete.
Reason: The repair restores existing coverage through its shared owner with no production behavior or product-direction change.

Merge readiness

✅ Ready for maintainer review

Keep this PR: it repairs a confirmed fixture omission still present on main, using the existing owner without weakening assertions or changing production behavior.

Priority: P2
Reviewed head: ccf09181ebc12184cd9dc319b68ab34055bd415e

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared runtime fixture assembles isolated package roots for CLI and Doctor process tests; setup integration tests consume those roots to launch and authenticate Gateway children.

flowchart LR
  A[Setup integration test] --> B[Shared runtime fixture]
  B --> C[Isolated package root]
  D[Runtime profile module] --> C
  C --> E[CLI and Gateway child]
  E --> F[Authenticated readiness and shutdown assertions]
Loading

Technical review

Best possible solution:

Retain the single file-list addition in the shared fixture and let the existing integration assertions verify Gateway handoff.

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

Yes: the preserved-symlink fixture omits a root module imported by linked validation code, and the body reports matching baseline failures; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete repair: supply the required asset through the existing fixture owner while preserving isolation, readiness detection, timeouts, and assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7b6303cdd2f4.

Provenance checked

  • Isolated runtime root assets keeps the original intent (3529142: The fixture deliberately copies required root assets while keeping package and UI ownership isolated; the earlier worker-heap repair uses the same mechanism.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Tests +1. Total +1 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 1 0 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 1 0 +1

Labels

Label changes:

  • add P2: A deterministic shared test-fixture failure blocks setup conformance coverage without affecting installed production runtimes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A deterministic shared test-fixture failure blocks setup conformance coverage without affecting installed production runtimes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 7:07 PM ET / 23:07 UTC.

@steipete
steipete merged commit 27e8701 into main Oct 24, 2026
205 checks passed
@steipete
steipete deleted the upd/upd-l1900 branch October 24, 2026 23:20
steipete added a commit that referenced this pull request Oct 25, 2026
## What Problem This Solves

The session-accessor conformance matrix executes five SQLite scenarios twice through identical functions and fixture scopes.

## User Impact

No production behavior changes. The suite executes 37 cases instead of 42 (-11.9%), preserving every assertion. Five registration lines change; no test declarations, source lines, production seams, SQL, schemas, or PostgreSQL conformance cases are deleted.

## Why This Change Was Made

The direct SQLite adapter inherits every method from the public adapter except entry listing and entry updating. Keep the CRUD scenario on both adapters because it exercises those two distinct entry points. Register the five scenarios that use only inherited methods once through the existing SQLite-only registrar, as the rest of the suite already does.

The bounded audit covered 24 complete test files and 201 expanded cases. It retained the other 196 cases, including worker settlement, cancellation, authority, cache invalidation and upgrade regressions. Five duplicate executions are below the requested batch target; there is no safe reason to delete distinct contracts to fill a quota.

| Duplicate scenario | Retained proof |
| --- | --- |
| Exact persisted-key lookup | Same callback once: canonical lookup, exact miss and exact hit |
| Lifecycle cleanup | Same callback once: age/segment filtering, retained history and archive content |
| Raw event append/read | Same callback once, including sync and async reads |
| Raw message rejection | Same callback once, retaining the message-write integrity boundary |
| Message append/idempotency/publication | Same callback once: durable message, idempotency conflict and emitted update |

## Evidence

Acceptance recorded before the first test or benchmark execution: run the complete conformance suite on baseline `349369c020470a2184304c35f99ab3fc45f13726` and candidate with the default pinned Bun runner and one worker. Primary result must be 42 passing baseline cases and 37 passing candidate cases; the five removed executions must retain their unchanged callbacks, and production must remain untouched. Require no new static findings.

Timing is secondary: acquire the campaign timing lock, require host load below 24, keep cold and warm cohorts separate, alternate baseline/candidate with at least five samples per arm, and report wall-clock median/p95/range. Any >20% adverse cell stops a performance claim. If no qualified window appears after 60 minutes, report counts and unqualified observed durations without a speedup claim. Correctness runs do not require the timing lock. No application SQL saving is claimed or SQL harness pair needed for this test-registration change.

Formatting, basic lint, type-aware core lint and diff whitespace checks pass. One isolated Codex preservation review found no accepted/actionable P0–P2 findings. The complete affected suite passed on both revisions: baseline 42/42 and candidate 37/37. Observed command durations were 310.026 s and 197.963 s, respectively. These are unqualified high-load observations: the baseline built worker bundles, and the candidate reused them; no wall-clock speedup, median/p95, or application SQL saving is claimed.

Exact-head CI [40140586585](https://github.com/openclaw/openclaw/actions/runs/40140586585) completed with 20 successful jobs, 30 skipped jobs, and two failures: [PostgreSQL shard 2](https://github.com/openclaw/openclaw/actions/runs/40140586585/job/121011570679) and its aggregate gate. The seven setup failures are the independently reproduced missing synthetic runtime profile, fixed on main by #182990 (`27e87016a5e4`). The equivalent repair in #182996 passed all eight PTY cases and all three PostgreSQL shards in CI 40140628966. This older-head, test-only patch does not touch that fixture; the scoped pre-existing-failure exception applies. Changed tests, selected types/lint, source contracts, architecture checks, baseline ratchets, and PostgreSQL shards 1 and 3 passed.

Canonical Knip baseline/candidate comparisons completed with identical findings in all three graphs: production 70/70, full tree 84/84, scripts 1,136/1,136; zero new or resolved entries, no resolution errors or timeouts. Madge passed. Local `check:changed` passed its non-type guards, including worker/T1, dialect, mock-export, timeout, formatting, boundary, and deprecation checks. Its graph/type subchecks refused the required external virtual-store layout; no guard was changed, and the exact-head CI type/lint checks passed. The aggregate command's redundant second candidate export scan was stopped after the completed comparison. An earlier extra unused-file scan exceeded its unchanged 600-second limit and is not counted as a pass.

The timing qualification window exceeded 60 minutes with no eligible samples (host load remained above 24). The counts-only fallback applies; the observed correctness-run durations above remain unqualified. No timeouts, resource budgets, snapshots, or expectations were relaxed.

Open-PR conflict check at 2026-10-25T00:31:34.745541+00:00: 2,680 other open PRs targeting main, zero overlap with the edited file, zero new merge conflicts. No production, SQL, schema, SDK, or PostgreSQL identity change.
steipete added a commit that referenced this pull request Oct 25, 2026
Reduce the durable submitted-input source lookup from five SQL statements to one snapshot-consistent autocommit SELECT on SQLite and PostgreSQL. Keep restart, expired-memory, and attachment duplicate-dispatch protection, with the original bounded recovery transaction unchanged.

The normal new-input path saves four statements without adding a worker request. The accepted rare recovery tradeoff is one additional statement for pending or committed input.

Verified with both-engine count regressions, 56 focused behavior/prompt-prefix tests, three synthetic Gateway baseline/candidate pairs, and PostgreSQL owner review. Exact-head CI passes all static gates; the inherited PostgreSQL shard 2 fixture failure was independently fixed in #182990.

Follow-up to #182334; single-statement precedent #182883.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…ve-setup source runtime (openclaw#182990)

openclaw#182856 made the launcher import standalone-runtime-profile.mjs, but the interactive-setup integration fixture's createSourceRuntime copy list omitted it, so the onboarding/setup/crestodian child exited with a missing module before reporting ready (PostgreSQL conformance shard 2 on unrelated PRs). Adds the file to the shared fixture's copy list; all three SQLite handoffs pass again.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
## What Problem This Solves

The session-accessor conformance matrix executes five SQLite scenarios twice through identical functions and fixture scopes.

## User Impact

No production behavior changes. The suite executes 37 cases instead of 42 (-11.9%), preserving every assertion. Five registration lines change; no test declarations, source lines, production seams, SQL, schemas, or PostgreSQL conformance cases are deleted.

## Why This Change Was Made

The direct SQLite adapter inherits every method from the public adapter except entry listing and entry updating. Keep the CRUD scenario on both adapters because it exercises those two distinct entry points. Register the five scenarios that use only inherited methods once through the existing SQLite-only registrar, as the rest of the suite already does.

The bounded audit covered 24 complete test files and 201 expanded cases. It retained the other 196 cases, including worker settlement, cancellation, authority, cache invalidation and upgrade regressions. Five duplicate executions are below the requested batch target; there is no safe reason to delete distinct contracts to fill a quota.

| Duplicate scenario | Retained proof |
| --- | --- |
| Exact persisted-key lookup | Same callback once: canonical lookup, exact miss and exact hit |
| Lifecycle cleanup | Same callback once: age/segment filtering, retained history and archive content |
| Raw event append/read | Same callback once, including sync and async reads |
| Raw message rejection | Same callback once, retaining the message-write integrity boundary |
| Message append/idempotency/publication | Same callback once: durable message, idempotency conflict and emitted update |

## Evidence

Acceptance recorded before the first test or benchmark execution: run the complete conformance suite on baseline `bf7154cc71ebd502913559ca791c49405e4a580e` and candidate with the default pinned Bun runner and one worker. Primary result must be 42 passing baseline cases and 37 passing candidate cases; the five removed executions must retain their unchanged callbacks, and production must remain untouched. Require no new static findings.

Timing is secondary: acquire the campaign timing lock, require host load below 24, keep cold and warm cohorts separate, alternate baseline/candidate with at least five samples per arm, and report wall-clock median/p95/range. Any >20% adverse cell stops a performance claim. If no qualified window appears after 60 minutes, report counts and unqualified observed durations without a speedup claim. Correctness runs do not require the timing lock. No application SQL saving is claimed or SQL harness pair needed for this test-registration change.

Formatting, basic lint, type-aware core lint and diff whitespace checks pass. One isolated Codex preservation review found no accepted/actionable P0–P2 findings. The complete affected suite passed on both revisions: baseline 42/42 and candidate 37/37. Observed command durations were 310.026 s and 197.963 s, respectively. These are unqualified high-load observations: the baseline built worker bundles, and the candidate reused them; no wall-clock speedup, median/p95, or application SQL saving is claimed.

Exact-head CI [40140586585](https://github.com/openclaw/openclaw/actions/runs/40140586585) completed with 20 successful jobs, 30 skipped jobs, and two failures: [PostgreSQL shard 2](https://github.com/openclaw/openclaw/actions/runs/40140586585/job/121011570679) and its aggregate gate. The seven setup failures are the independently reproduced missing synthetic runtime profile, fixed on main by openclaw#182990 (`36066dd233a4`). The equivalent repair in openclaw#182996 passed all eight PTY cases and all three PostgreSQL shards in CI 40140628966. This older-head, test-only patch does not touch that fixture; the scoped pre-existing-failure exception applies. Changed tests, selected types/lint, source contracts, architecture checks, baseline ratchets, and PostgreSQL shards 1 and 3 passed.

Canonical Knip baseline/candidate comparisons completed with identical findings in all three graphs: production 70/70, full tree 84/84, scripts 1,136/1,136; zero new or resolved entries, no resolution errors or timeouts. Madge passed. Local `check:changed` passed its non-type guards, including worker/T1, dialect, mock-export, timeout, formatting, boundary, and deprecation checks. Its graph/type subchecks refused the required external virtual-store layout; no guard was changed, and the exact-head CI type/lint checks passed. The aggregate command's redundant second candidate export scan was stopped after the completed comparison. An earlier extra unused-file scan exceeded its unchanged 600-second limit and is not counted as a pass.

The timing qualification window exceeded 60 minutes with no eligible samples (host load remained above 24). The counts-only fallback applies; the observed correctness-run durations above remain unqualified. No timeouts, resource budgets, snapshots, or expectations were relaxed.

Open-PR conflict check at 2026-10-25T00:31:34.745541+00:00: 2,680 other open PRs targeting main, zero overlap with the edited file, zero new merge conflicts. No production, SQL, schema, SDK, or PostgreSQL identity change.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…182971)

Reduce the durable submitted-input source lookup from five SQL statements to one snapshot-consistent autocommit SELECT on SQLite and PostgreSQL. Keep restart, expired-memory, and attachment duplicate-dispatch protection, with the original bounded recovery transaction unchanged.

The normal new-input path saves four statements without adding a worker request. The accepted rare recovery tradeoff is one additional statement for pending or committed input.

Verified with both-engine count regressions, 56 focused behavior/prompt-prefix tests, three synthetic Gateway baseline/candidate pairs, and PostgreSQL owner review. Exact-head CI passes all static gates; the inherited PostgreSQL shard 2 fixture failure was independently fixed in openclaw#182990.

Follow-up to openclaw#182334; single-statement precedent openclaw#182883.
LeoStehlik added a commit to LeoStehlik/openclaw that referenced this pull request Oct 25, 2026
Apply the exact fixture asset correction from upstream openclaw#182990 (27e8701).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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