Skip to content

perf(test): complete managed handoff explicitly - #125129

Merged
steipete merged 1 commit into
mainfrom
perf/managed-handoff-test-completion
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/managed-handoff-test-completion

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The managed-service handoff lifecycle test used a fake parent that exited naturally after 750 ms. That incidental timer dominated the case and made completion timing depend on process lifetime rather than the handoff state transition under test.

Why This Change Was Made

The helper already emits OPENCLAW_UPDATE_HANDOFF_READY before it starts polling the parent. The test now observes that READY signal, proves the parent is still alive, closes the parent stdin explicitly, and then awaits helper completion. This preserves the state-machine coverage while making parent completion deliberate instead of timer-driven.

User Impact

No production behavior changes. This is test-only (+48/-14), reduces managed-handoff suite latency, and makes the indefinite-parent-exit case deterministic. No changelog entry is needed.

Evidence

  • Benchmark wall average: 8.10 s -> 7.375 s (-0.725 s, -9%).
  • Target case average: 818 ms -> 315.5 ms (-61.4%).
  • Fault injection covered delayed READY timeout and forced completion failure.
  • Exact Testbox tbx_01m076q9jhr2jg8k23y72fea01: https://github.com/openclaw/openclaw/actions/runs/32002065866
    • Full file x3: 60 passed, 3 Windows skips.
    • Mapped tests: 391 passed, 2 skips.
    • Changed gate: green.
  • Fresh post-rebase autoreview: clean at 0.99 confidence. Deslop made no changes.
  • Approved base: ac5c8be00196bad2fca0f87b756c859efa8aae89.
  • Approved head: aaee6b59e21aedb84de55606eb3aecd262135aaf.

@clawsweeper

clawsweeper Bot commented Aug 17, 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 August 17, 2026 06:47
@steipete steipete self-assigned this Aug 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 17, 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 Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 2:53 AM ET / 06:53 UTC.

ClawSweeper review

What this changes

The PR makes the managed-service handoff lifecycle test wait for the helper’s readiness output, then explicitly end the simulated parent process instead of waiting for a 750 ms timer.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: this is a coherent, current test-only improvement with no blocking correctness or security finding. The maintainer label also excludes it from automated cleanup closure.

Priority: P3
Reviewed head: aaee6b59e21aedb84de55606eb3aecd262135aaf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused test change matches the production handoff ordering and retains its terminal-result coverage without a blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless records targeted Testbox validation.
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, test-only PR is outside the external-contributor proof gate; its body nevertheless records targeted Testbox validation.
Evidence reviewed 5 items Production readiness ordering: The helper writes its readiness marker before polling the parent PID, so observing that marker proves the handoff helper reached the intended waiting state before the test releases its parent.
Current-main behavior: Current main still uses the timer-driven parent in this test; the PR therefore remains useful rather than being superseded by main.
Changed test path: The branch records the completion promise separately, waits for readiness, asserts the parent remains alive, ends stdin, and awaits successful helper completion.
Findings None None.
Security None None.

How this fits together

Managed-service updates launch a detached helper that waits for the existing Gateway process to exit before running the updater. This test simulates that handoff boundary and verifies the helper completes after an indefinite parent wait is deliberately released.

flowchart LR
  A[Existing Gateway process] --> B[Detached handoff helper]
  B --> C[Ready signal]
  C --> D[Test ends parent input]
  D --> E[Helper runs update]
  E --> F[Terminal handoff result]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: the PR is a focused, valid test improvement awaiting ordinary maintainer merge handling.
Agent review details

Security

None.

PR surface

Tests +34. Total +34 across 1 file.

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

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +48/-14 All changes stay in one lifecycle test file, so the added coordination only affects test determinism and runtime.

Technical review

Best possible solution:

Land the explicit readiness-to-parent-completion test sequence once the exact-head required checks are green; it removes timer-dependent test latency without changing production behavior.

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

Yes, source-reproducible: current main waits for a fixed 750 ms simulated-parent lifetime, while the focused test can measure the resulting timer-bound completion path. The review was read-only and did not run the test.

Is this the best way to solve the issue?

Yes. The production helper emits readiness before it polls the parent, so using that existing transition to gate explicit parent completion tests the intended lifecycle boundary rather than a timer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 83d279a4c18a.

Labels

Label changes:

  • add P3: This is a focused internal test determinism and performance improvement with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless records targeted Testbox validation.

Label justifications:

  • P3: This is a focused internal test determinism and performance improvement with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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, test-only PR is outside the external-contributor proof gate; its body nevertheless records targeted Testbox validation.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current lifecycle fixture and the managed-update handoff history, including the PR under review. (role: recent area contributor; confidence: high; commits: 1606969dcafa, e3de98a451b4, aaee6b59e21a; files: src/infra/update-managed-service-handoff.ts, src/infra/update-managed-service-handoff-lifecycle.test.ts)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for source aaee6b59e21aedb84de55606eb3aecd262135aaf:

  • Native review artifacts validate as READY FOR /prepare-pr with zero findings.
  • Exact-head hosted CI run 32003078766 is green.
  • Exact Testbox tbx_01m076q9jhr2jg8k23y72fea01 / run 32002065866: full file x3 passed 60 tests with 3 Windows skips; mapped tests passed 391 with 2 skips; changed gate green.
  • Fault injection covered delayed READY timeout and forced completion failure.
  • Benchmark wall average improved from 8.10 s to 7.375 s (-0.725 s, -9%); target case average improved from 818 ms to 315.5 ms (-61.4%).
  • Fresh post-rebase autoreview was clean at 0.99 confidence; deslop made no changes.
  • Test-only: production LOC +0/-0; tests +48/-14. No changelog required. No proof gaps.

@steipete
steipete merged commit 53cede4 into main Aug 17, 2026
176 checks passed
@steipete
steipete deleted the perf/managed-handoff-test-completion branch August 17, 2026 06:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: perf(test): complete managed handoff explicitly This is item 2/3 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

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: S 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