Skip to content

refactor(test): type the respawn exit mock directly - #137258

Merged
steipete merged 1 commit into
mainfrom
codex/test-entry-respawn-exit-mock
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-entry-respawn-exit-mock

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The CLI respawn test double-asserted an untyped exit mock to its runtime contract, even though Vitest can declare that type directly.

Why This Change Was Made

Declare the existing (code?: number) => never signature in vi.fn and pass the mock directly. The mock implementation, PID-less child, spawn adapter, and all lifecycle assertions remain unchanged.

User Impact

No user-visible change. Production +0/−0; tests +2/−2. Existing Windows, CA, Gmail, terminal, signal, and child-cleanup coverage is preserved.

Evidence

  • Before and after: the same 44 cases passed across entry.respawn, respawn-child-runner, child-process-bridge, and the canonical expect helper suites.
  • The complete one-path check-changed gate passed all 20 stages, including core-test typecheck, typed lint, and dead-export scans.
  • Managed Codex P2 review: no actionable findings. Installed Vitest 4.1.11 types and implementation confirm identical mock behavior.

Declare the existing exit signature in vi.fn instead of double-asserting
it at runtime injection. Keep the PID-less child, spawn adapter, and
all existing lifecycle assertions.

Validation: same 44 owner/sibling cases before and after; full changed
gate and managed Codex P2 review passed. Production unchanged.
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review September 3, 2026 11:04
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 7:20 AM ET / 11:20 UTC.

ClawSweeper review

What this changes

The PR gives the CLI respawn test’s mocked non-returning exit callback its declared Vitest type directly and removes the redundant injection cast.

Merge readiness

✅ Ready for maintainer review

The patch is a correct, behavior-neutral test cleanup; current main still contains the redundant cast, and this maintainer-owned PR should remain open for normal handling. Likely related people: steipete (recent respawn-area contributor) and Vincent Koc (shared respawn-runner contributor).

Priority: P3
Reviewed head: d72935ba91495fa63c81c7bc9fe764588b09c442

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent test-only refactor with a clear contract match and no actionable correctness concern.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only refactor leaves the production respawn path unchanged; exact-head CI includes successful test-type and changed-path checks.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-only refactor leaves the production respawn path unchanged; exact-head CI includes successful test-type and changed-path checks.
Evidence reviewed 6 items Introduced test-only change: The verified PR-introduced hunk changes only the test mock declaration and its injection; assertions and production code are unchanged.
Runtime contract: The shared respawn runner requires an exit callback typed as (code?: number) => never and invokes it after child exit, matching the direct test mock type.
Caller and owner boundary: The CLI entrypoint calls runCliRespawnPlan only after building a plan and preparing its diagnostic writer; the PR does not alter that production call path.
Findings None None.
Security None None.

How this fits together

The CLI entrypoint builds a respawn plan and delegates process startup and terminal exit handling to the shared respawn-child runner. This test checks that injected child-process runtime seam without changing CLI production behavior.

flowchart LR
  A[CLI entrypoint] --> B[Respawn plan]
  B --> C[Shared child runner]
  C --> D[Injected exit callback]
  E[Respawn lifecycle test] --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests 0. Total 0 across 1 file.

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

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests +1/-1 The sole replacement improves the test mock’s static type without altering runtime code or test behavior.

Technical review

Best possible solution:

Merge the direct mock typing cleanup while retaining the existing respawn lifecycle assertions and shared runner contract.

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

Not applicable: the PR refactors a test mock’s static declaration rather than addressing a runtime defect.

Is this the best way to solve the issue?

Yes: declaring the existing non-returning callback type at mock creation removes an unnecessary double assertion and matches the shared runner’s explicit contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8a718610bd26.

Labels

Label justifications:

  • P3: This is a contained test-only typing cleanup with no user-visible or production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only refactor leaves the production respawn path unchanged; exact-head CI includes successful test-type and changed-path checks.

Evidence

What I checked:

  • Introduced test-only change: The verified PR-introduced hunk changes only the test mock declaration and its injection; assertions and production code are unchanged. (src/entry.respawn.test.ts:388, d72935ba9149)
  • Runtime contract: The shared respawn runner requires an exit callback typed as (code?: number) => never and invokes it after child exit, matching the direct test mock type. (src/process/respawn-child-runner.ts:13, d72935ba9149)
  • Caller and owner boundary: The CLI entrypoint calls runCliRespawnPlan only after building a plan and preparing its diagnostic writer; the PR does not alter that production call path. (src/entry.ts:177, d72935ba9149)
  • Current-main necessity check: Fetched current main still declares the mock untyped and casts it at runtime injection, so the requested cleanup is not already implemented there. (src/entry.respawn.test.ts:388, 8a718610bd26)
  • Exact-head validation: The supplied pull-request check context reports successful exact-head test-type, lint, source-contract, dependency, and CI-gate checks. (d72935ba9149)
  • Area history: Recent history includes a prior respawn-test cleanup by steipete and shared process-runner work by Vincent Koc, supporting them as routing candidates rather than assigning fault. (src/entry.respawn.test.ts:415, 995d6a082cff)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-03T11:11:28.829Z sha d72935b :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Sep 3, 2026
@steipete
steipete merged commit e0dad1f into main Sep 3, 2026
166 of 175 checks passed
@steipete
steipete deleted the codex/test-entry-respawn-exit-mock branch September 3, 2026 12:10
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 3, 2026
…36761-session-mode-local-20260903

* commit '58187248c8cafd7b8cfbba3de8d001762fb08b48':
  improve(testing): add watchOS Gateway upgrade survivor (#137203)
  improve(ui): structure Devices rows with an actions menu and a facts panel (#137084)
  test(cli): reuse canonical pairing call guard (#137210)
  fix(sessions): prevent gateway stalls during large session cleanup (#126035)
  fix(qa): resolve Slack runtime dependency (#137283)
  fix: fence Session Observer catalog requests (#137243)
  fix(memory): make watcher pressure guidance actionable (#137181)
  test(entry): type the respawn exit mock directly (#137258)
  fix(release): install first-hop fixtures through the candidate registry (#137286)

# Conflicts:
#	scripts/e2e/lib/upgrade-survivor/assertions.mjs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Declare the existing exit signature in vi.fn instead of double-asserting
it at runtime injection. Keep the PID-less child, spawn adapter, and
all existing lifecycle assertions.

Validation: same 44 owner/sibling cases before and after; full changed
gate and managed Codex P2 review passed. Production unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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