Skip to content

refactor(test): share core process-result fixtures - #174149

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/test-audit-process-results-20261016
Nov 27, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/test-audit-process-results-20261016

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Current branch qualification

The branch now includes 4e766e6e61baaf7c2dc309ee943e7f9baa7aa557. Since the original qualification, main consolidated the provider's duplicate fixture constructor. Its current preflight test is preserved byte-for-byte. The bootstrap and workspace-sync fixtures now load the shared SpawnResult helper directly, and the npm installer helper keeps its existing export. Seven combinations of defaults and overrides matched both previous constructors, including signal termination, command timeout and truncated output. Each call returned a fresh object. Production files are unchanged. The historical E2E findings below concern the older head.

On this head, CI and Darwin tooling passed. The current local test-line check passed with 13 fewer counted lines.

Prior qualification

What Problem This Solves

Four core test helpers independently construct the same process-result fixture.

User Impact

No user-visible change. Existing test cases, assertions, subprocess behavior, and production code are unchanged.

Why This Change Was Made

Move the existing fixture builder into a pure test utility and reuse it from worker bootstrap, Crabbox preflight, workspace synchronization, and npm install/update helpers. Preserve defaults, override precedence, and existing helper exports. Plugin-owned fixtures remain within their package boundary.

Evidence

  • AST comparison confirms identical parameters, return types, and bodies for all four factories; all 26 other top-level non-import statements are unchanged.
  • Targeted formatting, type-aware lint, and git diff --check pass.
  • Independent review completed with no actionable findings.
  • Native focused tests passed on 57cfd91bd894008e35fd5e0b9af0ab5551105774: 119 tests across six files (82 Gateway, six update-command, 31 plugin-install). This includes real bootstrap/archive and workspace subprocess tests, provider cleanup/restart cases, and worker claim-admission ownership checks.
  • CI run 38893429511, attempt 1, on this exact head has two reported failures: checks-node-changed-17 fails required-native-same-session.e2e.test.ts during remote skill discovery with TypeError: Cannot read properties of undefined (reading 'readWorkspaceSkillsRequest'); checks-node-changed-18 fails skill-library-worker-wire.e2e.test.ts because agent.wait for skill-library-local-first returns an error instead of settling successfully.
  • Both failures remain unknown in the completed native classification. The failed jobs in scheduled-main run 38887900861 exercise different cases and do not establish inheritance. The newer scheduled-main run 38894297213 also has no matching Node-test failure annotation.
  • The tested merge 1bd999ae494dd1cf872b31781ad503da137ec6c0 has main parent 11bbb8291b929db893cef5fdf91e9bb6fb9d6813 and this exact PR head. Its delta from that parent is only the five intended test/support files. The failing E2E tests, runtime owners, dependency inputs, scripts, and E2E configuration are byte-identical to that parent. The native import graph finds 62 transitive test/support consumers, no production consumers, and no path to either failed E2E.
  • Follow-up independent review found no patch defect, but did not accept inherited-only attribution without comparable baseline execution. A local reproduction was refused before build/test by the managed-Gateway separation guard. The first Testbox allocation was stopped during startup and its cleanup settled; it produced no test result.
  • The exact main parent passed both cases in Testbox run 38896723315, with Node 24.19.0 on Linux x64: required-native 53.3 seconds, skill-library 35.8 seconds. This used normal E2E preparation and one shared Vitest process, whereas the failed CI used the private qaRuntime build and separate per-file processes. It does not establish inherited-only attribution. Test execution passed; the wrapper initially failed during cleanup settlement, which was subsequently reconciled through the native stop route.
  • Testbox run 38898168331 completed the original private qaRuntime build and native per-file shard runner on the exact main parent. The required-native case reproduced the same readWorkspaceSkillsRequest failure before settlement; it is inherited. The skill-library case passed in 35.1 seconds, so its inheritance remains unproven. Both files ran in separate processes, serially; the runner had 4 CPUs and 16 GB RAM versus CI's observed 2 CPUs and 8 GB. The command exited 1 with both plans completed and native lease cleanup settled.
  • The earlier skill-library failure in job 116732266824 has the same error and identical test/provider/fixture/config files, but other runtime and dependency inputs differ. It is supporting evidence, not a transferred approval or complete baseline match.
  • Independent review accepted a bounded one-case diagnostic, not a CI waiver. Testbox run 38899224236 verified the exact main-parent source, Node 24.19.0, existing taskset, private qaRuntime build, and two-CPU affinity for only the test runner and descendants. The single skill-library case passed in 43.1 seconds. The runner retained 16 GB RAM rather than CI's 8 GB; this is not a claim of identical hardware or a fix. Its initial cleanup-settlement error was reconciled through the native stop route.
  • Testbox run 38901313973 tested the original CI merge plus an independently reviewed, eight-line failure-only diagnostic hook in an isolated checkout. Production bytes, assertions, deadlines, and fixture lifecycle were unchanged. The private qaRuntime build passed; the single native shard passed in 38.2 seconds with Node 24.19.0 and two-CPU affinity. RAM remained 16 GB. No failure occurred, so the hook produced no underlying-error evidence. Payload exit was 0; the wrapper's cleanup-settlement failure was subsequently reconciled through the same native stop route. The diagnostic edit was not published to this PR, whose head remains unchanged.
  • The remaining blocker is the original skill-library agent.wait local-first error. The available CI log contains only generic request-too-long text, which can also represent provider stream failures; it does not establish an elapsed timeout. The run has no available Gateway diagnostic artifact. Its underlying cause and inherited-only attribution remain unresolved. No merge or CI exception has been submitted, and neither original failure is marked fixed or waived.
  • No production changes or test cases removed; test/support code decreases by 29 lines.

@vincentkoc vincentkoc self-assigned this Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 16, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 16, 2026 11:23
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces four identical process-result fixture builders with one shared test utility while preserving existing exports.

Example: A test requests a failed command result with code 2 and stderr "config preflight failure".

  • Before: Each local builder supplies the same remaining process-result defaults.
  • After: The shared builder supplies those identical defaults and preserves both overrides.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is small and source-equivalent with reported focused harness coverage; detailed execution logs were unavailable to this review, and required CI remains unresolved.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only refactor changes no shipped behavior; the body records focused execution of the affected fixture consumers, including subprocess scenarios.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction removes repeated fixture construction without adding configuration, production machinery, or new tests.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR makes a useful, behavior-preserving fixture consolidation with no actionable code findings; required CI remains unresolved.

Priority: P3
Reviewed head: 57cfd91bd894008e35fd5e0b9af0ab5551105774

Before merge

  • Complete next step - Investigate the original skill-library agent.wait failure in the failed CI job and establish whether it requires a repair or qualifies as inherited before landing.

Findings

None.

Agent review details

How this fits together

Gateway worker and npm installer tests feed command-result overrides into a test-only builder that returns SpawnResult fixtures for their existing runners and assertions.

flowchart TD
  A[Worker bootstrap tests] --> E[Shared process result fixture]
  B[Crabbox preflight tests] --> E
  C[Workspace synchronization tests] --> E
  D[Npm install and update tests] --> E
  E --> F[SpawnResult fixtures]
  F --> G[Existing runners and assertions]
Loading

Technical review

Best possible solution:

Land the shared fixture consolidation after the remaining failed CI gate is resolved through the repository’s supported landing policy.

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

There is no reported product defect to reproduce; source inspection confirms four identical fixture builders and unchanged caller behavior.

Is this the best way to solve the issue?

A pure shared builder is appropriately scoped, preserves existing imports and override precedence, and avoids pulling npm-specific test dependencies into Gateway fixtures.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Bootstrap result fixture keeps the original intent (5c894c7: The prior extraction moved existing helpers into test support to satisfy lint limits while preserving behavior.)
  • Crabbox preflight fixtures keeps the original intent (81a74b2: The fixtures support cleanup and restart contracts following failed worker provisioning.)
  • Accepted workspace fixtures keeps the original intent (8fbb729: The fixtures support accepted-workspace settlement and recovery after SSH loss.)
  • Npm command-result fixtures keeps the original intent (12635de: Shared installer test helpers provide process-shaped command doubles; later edits retained the same result contract.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned patch preserves fixture semantics: All four removed builders have the same parameter, return shape, defaults, and final override spread as the new utility; existing helper exports remain available. (src/test-utils/process-result.ts:4, 57cfd91bd894)
  • Current main still has the separate builders: The five touched paths have no changes between the merge base and fetched main, so main has not incorporated this consolidation. (src/test-utils/npm-spec-install-test-helpers.ts:94, fa191c5ce97f)
  • One process-result type owner: Both the previous core imports and the plugin SDK process-runtime import resolve SpawnResult to src/process/exec-result.ts; the new import is type-only and adds no runtime dependency. (src/process/exec.ts:24, 57cfd91bd894)
  • Focused validation and unresolved CI: The PR records 119 focused passing tests on the reviewed head. CI run https://github.com/openclaw/openclaw/actions/runs/38893429511 has failed changed-test jobs and a failed aggregate gate. The body records an exact-parent reproduction of the required-native failure, but explicitly leaves the skill-library agent.wait failure unattributed. (57cfd91bd894)
  • Applicable repository policy: Read root and Gateway AGENTS.md and applied the shared-fixture, preserved-contract, proportional-proof, and CI-attribution requirements; no maintainer-notes directory exists in this checkout. (src/gateway/AGENTS.md, 57cfd91bd894)
  • Inspection limits and clean checkout: GitHub job-log retrieval redirected to a blocked Azure storage host, so detailed execution claims remain attributed to the PR body. Some historical content inspection emitted a lazy-fetch warning; available path history and current-main blame established routing without unsupported introduction claims. Final git status remained clean. (57cfd91bd894)

PR surface

Tests -29. Total -29 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 20 49 -29
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 20 49 -29

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is test infrastructure cleanup with unchanged production behavior and test assertions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 16, 2026, 8:37 AM ET / 12:37 UTC.

@vincentkoc
vincentkoc merged commit dcd5214 into main Nov 27, 2026
147 checks passed
@vincentkoc
vincentkoc deleted the refactor/test-audit-process-results-20261016 branch November 27, 2026 07:58
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
…restoration-ci-189390-20261127

* commit '6feeb50a3f14fbf0aa5167d342f186dc4d67fc18': (9846 commits)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  fix(agents): skip the bootstrap ritual in one-shot runs (#206477)
  fix(test): preserve stack coordinates in redacted failure reports (#152384)
  fix(gateway): return consistent unavailable response guidance (#191933)
  fix: preserve emphasis in Markdown table row labels (#205349)
  fix(nextcloud-talk): keep webhook spool helpers private (#206470)
  perf(plugins): overlay native receipts once per visible root (#206464)
  fix: keep GitHub comment approvals alive and skip repeat approval on the session PR (#206129)
  perf(config): retain one snapshot for unchanged validation results (#206465)
  refactor(test): reuse canonical secret fixture cleanup (#189492)
  refactor(subagents): own descendant Stop cancellation (#206444)
  refactor(subagents): keep announce cleanup action type private (#206407)
  ...
vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (2115 commits)
  fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485)
  fix(ci): update iOS screenshot reducer gate (#206497)
  fix: keep chat photo previews sharp within their byte limits (#206461)
  fix: let agents use short Workboard card IDs
  fix(tui): run provider sign-in in the local TUI (#200605)
  improve(config): reduce repeated directory checks for larger agent rosters (#206494)
  perf(test): reuse the Periphery producer workflow snapshot (#189681)
  fix(ci): keep locale assets within the installed package budget (#206492)
  fix: preserve failed Apple chat messages across partial history pages (#205404)
  improve: avoid merging unrelated settings for agent directory lookups (#206489)
  fix: show typing while a queued follow-up turn runs (#201920)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  ...
vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (923 commits)
  fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485)
  fix(ci): update iOS screenshot reducer gate (#206497)
  fix: keep chat photo previews sharp within their byte limits (#206461)
  fix: let agents use short Workboard card IDs
  fix(tui): run provider sign-in in the local TUI (#200605)
  improve(config): reduce repeated directory checks for larger agent rosters (#206494)
  perf(test): reuse the Periphery producer workflow snapshot (#189681)
  fix(ci): keep locale assets within the installed package budget (#206492)
  fix: preserve failed Apple chat messages across partial history pages (#205404)
  improve: avoid merging unrelated settings for agent directory lookups (#206489)
  fix: show typing while a queued follow-up turn runs (#201920)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant