Skip to content

refactor(test): adopt codex app-server test harness in worst-preamble suites - #120065

Merged
steipete merged 2 commits into
mainfrom
steipete/loc2-codex-harness-7e2a
Aug 6, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/loc2-codex-harness-7e2a

Conversation

@steipete

@steipete steipete commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The 126 Codex app-server test files contain 9,712 lines before their first suite declaration. The 12 measured target files alone contained 4,111 preamble lines, much of it repeated client-handler plumbing, standard thread/turn results, runtime identity methods, and thread/turn identifiers.

Why This Change Was Made

This adds one dependency-light test fixture for the repeated fake client, standard thread/turn builders, runtime identity methods, and current-turn identifiers. The existing run-attempt harness now delegates to that fixture, and the target suites reuse it without changing test titles or assertions.

The N-way comparison also showed that the remaining 1,038-line run-attempt preamble and 277-line thread-lifecycle binding preamble are already harness adopters and mostly contain suite-specific setup. Auth bridge is likewise auth-specific. Those paths were left local instead of moving one-off fixtures into a shared file.

User Impact

No runtime behavior changes. This is test-scaffolding-only cleanup. Across the branch, test code changes by +516/-1,163 lines for a net reduction of 647 lines; production runtime code changes by +0/-0.

The selected files' measured preambles fall from 4,111 to 3,606 lines. The reduction is smaller than the initial 2,500-4,000 estimate because the two largest files had already adopted the harness and their remaining setup was not repeated across three target suites.

Evidence

  • Focused Vitest: 13 files, 552 tests passed.
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.context-engine.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/auth-profile-runtime-contract.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt-thread-cleanup.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/side-question.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/native-subagent-monitor.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/bounded-turn.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/approval-bridge.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/elicitation-bridge.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/attempt-startup.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/thread-lifecycle.binding.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.usage-limits.test.ts
    • OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.hooks.test.ts
  • pnpm format <11 changed paths> passed.
  • node scripts/run-oxlint.mjs <11 changed paths> passed.
  • node scripts/check-changed.mjs could not provision the routed remote backend because Azure rejected its configured image selector with admin_required; Blacksmith and Daytona were unavailable first.
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --timed passed all extension production/test type checks, lint partitions, formatting, boundary checks, ratchets, dead-export scan, storage guards, and import-cycle checks locally.
  • git diff origin/main...HEAD --numstat: production runtime +0/-0; test scaffolding +516/-1,163 (net -647).

@steipete
steipete marked this pull request as ready for review August 6, 2026 23:29
@steipete

steipete commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Incident-mode landing note (operator-directed). GitHub's Actions incident left CI queued and blocked ClawSweeper; the operator directed landing. Gates satisfied: coordinator review (harness/fixture promotion only, zero production changes under extensions/codex/src; a mechanical check found zero describe/it title deltas across all touched files); structured Codex autoreview clean (0.99); 552 tests green across 13 files; format, lint, typechecks, guards, import cycles green. Test scaffolding −647 net. The original 2,500-4,000 estimate over-counted (several worst-preamble files already used the harness; bespoke auth/transport setups were correctly left local). Landed via operator-authorized admin merge at the verified head.

@steipete
steipete merged commit 7c9596b into main Aug 6, 2026
52 of 108 checks passed
@steipete
steipete deleted the steipete/loc2-codex-harness-7e2a branch August 6, 2026 23:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 7, 2026
… suites (openclaw#120065)

* refactor(test): share codex app-server client fixtures

* refactor(test): share codex turn identifiers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant