Skip to content

test: stabilize flaky fixtures (batch f021) - #167301

Merged
steipete merged 1 commit into
mainfrom
tcr/land-f021-1791471962
Oct 8, 2026
Merged

steipete merged 1 commit into
mainfrom
tcr/land-f021-1791471962

Conversation

@steipete

@steipete steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway shutdown fixtures can spend their RPC budget loading the lazy session handler, or exhaust the graceful-drain budget while the test runner is busy.

User Impact

No user-visible behavior changes. This stabilizes the existing stop, restart, and graceful-shutdown lifecycle proof while retaining its cleanup, cancellation, finalizer ordering, and owner-release assertions.

Why This Change Was Made

Prepare the lazy sessions.create handler during suite setup. During the graceful row, freeze only Date, preserving real polling and cleanup, and bind pending fixture waits to the test cancellation signal. The existing time budgets and production code remain unchanged.

Batch f021 was replayed onto ea7cc1066568fbbeece9151c497ecab15923bd2a. Applied 333e99139f14a142abc517418ce6bbf00ad29cf4 without conflicts. The other seven commits were skipped after checking current source and git log -S because their fixes are already on main:

Campaign commit Canonical main fix Reason skipped
85d20724130f c6168a9597e8 (#166060), refined by 623d8e02a5d8 (#166236) Async template registry and per-checkout/template custody fixtures already migrated; retain newer heartbeat-based revocation.
44f8af9c51e6 c6168a9597e8 (#166060) ReFS and sparse-isolation fixtures already await async registry reads and database cleanup.
7cae9efe5179 eea001248e7f (#166199) Auth-source mock already provides the synchronous source check.
96432ad8710b a2e44be9f830 (#166317) Worker settlement already waits through the reported-progress quiet-period probe.
6c1fc4ff609c 3a085ea5dee4 (#165837) Media migration cancellation already asserts the interruption rejection and restores its spy.
0befc52261e9 699a3c58bf28 (#166259) Allocation readiness already uses explicit gates before and after elapsed-time advancement.
791fae409b44 623d8e02a5d8 (#166236) Agent worktree fixture already imports the registry test-support owner.

No conflict-resolution hunks were dropped or rewritten. Diff: production +0/-0, tests +25/-13 in one file. No changed path matches the current CODEOWNERS rules.

Evidence

  • Frozen dependency installation passed on the confirmed base.
  • node_modules/.bin/oxfmt --write src/gateway/server.agent-execution-shutdown.test.ts passed without changing the replayed diff.
  • node_modules/.bin/oxlint -c .oxlintrc.json src/gateway/server.agent-execution-shutdown.test.ts exited 0.
  • git diff --check origin/main passed; changed-check dry-run selected the core-test lane.
  • Blacksmith Testbox focused proof: CI=1 pnpm install --frozen-lockfile --prefer-offline >/dev/null && CI=1 pnpm test src/gateway/server.agent-execution-shutdown.test.ts passed 3/3 tests (one file; 88.09s test-command wall time, 85.53s Vitest duration) on Linux/Node 24.19.0. The wrapper verified source 3b011a80263419c1a2622ff36737a24f6da7e74f and tree eb866e0566f9c63e6dac1721321938b3b231ad47. Lease tbx_01m4e1009e46nvyggh5qhc89kz, allocation run.
  • OPENCLAW_TESTBOX=1 node scripts/check-changed.mjs -- src/gateway/server.agent-execution-shutdown.test.ts passed on Blacksmith Testbox, including Gateway-server types, all three dead-export scans, policy ratchets, formatting, and targeted lint (0 warnings/errors). Lease tbx_01m4e1drennbmg2dwh6gm3g8jq, allocation run. Both leases are stopped; allocation-run cancellation during lease cleanup is not a test failure.
  • Independent autoreview runs alongside hosted CI. Auto-merge is pinned to the tested PR head; openclaw/ci-gate remains the merge gate.

@clawsweeper

clawsweeper Bot commented Oct 8, 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 enabled auto-merge (squash) October 8, 2026 15:35
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 8, 2026
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 8, 2026, 11:38 AM ET / 15:38 UTC.

ClawSweeper review

What this changes

This PR preloads the session-creation handler and isolates graceful-shutdown fixture waits from runner timing and test cancellation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, apparently correct fixture repair with useful harness coverage, but limited evidence that the flake is durably resolved.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-authored test-only change is outside the contributor runtime-proof gate. Its reported Gateway harness run exercises controlled agent execution and real cleanup, but is not a shipped CLI or live-provider demonstration; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes
Reason: Stabilizing meaningful shutdown-order coverage is worth the small fixture change; production behavior and assertions are preserved.

Merge readiness

⛔ Needs changes before merge - 1 item remains

No actionable patch defect found. This useful fixture repair remains distinct from current main, but the reported single passing run does not meet the repository’s stabilization-validation guidance.

Priority: P3
Reviewed head: 3b011a80263419c1a2622ff36737a24f6da7e74f

Before merge

  • Complete next step (P2) - Add the fixture-stabilization validation record to the PR body, covering the Gateway before/after benchmark and the repository’s flake-triage replay requirements.

Findings

None.

Tests

  • Missing end-to-end proof: No additional shipped-flow demonstration is needed for this test-only maintainer change. Missing stabilization qualification is the before/after benchmark and the documented standalone, original-shard, and sibling replay evidence; no base failure was demonstrated in the supplied record.
Agent review details

How this fits together

The Gateway receives agent requests and retains execution ownership until commands and cleanup finish. These fixtures check that stopping or restarting the Gateway releases its dependencies only after that work settles.

flowchart TD
  A[Shutdown fixture setup] --> B[Prepare session handler]
  B --> C[Create child session through Gateway]
  C --> D[Admit controlled agent work]
  D --> E{Shutdown mode}
  E --> F[Stop or restart cancellation]
  E --> G[Graceful completion with controlled clock]
  F --> H[Verify cleanup and dependency release order]
  G --> H
Loading

Technical review

Best possible solution:

Keep the existing lifecycle fixture and production owners, using scoped clock control and cancellation-aware waits to remove fixture timing noise.

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

No high-confidence failing run was established in this read-only review. Source supports the timing mechanism, while the supplied evidence shows only an after-change passing run.

Is this the best way to solve the issue?

Yes, the fixture-level approach is appropriately narrow: it preserves real cleanup and polling while moving lazy preparation outside the RPC budget.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness. Added test files: 1.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0d830e9 adds src/gateway/server.agent-execution-shutdown.test.ts:228 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0d830e9e7448; files: src/gateway/server.agent-execution-shutdown.test.ts)

PR surface

Tests +12. Total +12 across 1 file.

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

Labels

Label changes:

  • add P3: This improves test-fixture reliability without changing shipped Gateway behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This improves test-fixture reliability without changing shipped Gateway behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

@steipete
steipete merged commit 3d943a7 into main Oct 8, 2026
105 checks passed
@steipete
steipete deleted the tcr/land-f021-1791471962 branch October 8, 2026 15:53
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 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: 👀 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