Skip to content

fix(test): await approval readiness and request cleanup - #155111

Merged
vincentkoc merged 3 commits into
mainfrom
fix/approval-fixture-request-lifetimes-20260922
Sep 21, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/approval-fixture-request-lifetimes-20260922

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes approval test failures when asynchronous SQLite registration outlives a readiness poll, and keeps the outer request owned when an assertion or test cancellation starts teardown.

User Impact

No runtime behavior changes. Gateway approval tests await their real readiness boundary and finish request cleanup before closing their database.

Why This Change Was Made

The shared fixture now owns the complete test body and tracked requests, drains the manager, joins their continuations, and then closes its database. RPC tests capture the actual first accepted response; node policy tests await the actual approval publication. The same flow covers all 19 node-helper calls, the approval RPC fixtures, and both signed-runtime suites while preserving policy, grant, reviewer, and expiry assertions.

This retains the prepared-worker/publication consolidation in dbb4025 and Peter Steinberger's request-lifetime contribution in #154977. That uneditable PR overlaps the newer mainline helper, so it cannot be landed unchanged without replacing the consolidation. This follow-up carries its remaining lifetime guarantee into the current helper and affected callers.

Product runtime delta: 0. Test/support delta: +764 net lines across 13 files, plus one test-infrastructure inventory entry, including six new cases covering held registration, both publication transports, accepted responses, injected registration failure, early completion, and delayed outer-handler cleanup. Existing test order and security assertions remain intact. Three contiguous delivery cases register from a sibling support module at their original position; the RPC helpers also move to a sibling module to meet the line-cap policy.

Evidence

  • Captured failure: Gateway CI job reported three readiness assertion failures and two unhandled approval-observer closures. The precise worker delay was not measured.
  • Complete affected-source and dependency review passed. The full-range review of the final staged candidate found no P0–P2 findings; independent review verified the final eligible-client setup, routing, and mechanical extraction. Earlier review retained one valid old-index typed-mock finding, resolved in 490c2bc58e45ae9fbcd23250a39b16c7c78de9d3; that historical report remains exit 1. Targeted formatting and git diff --check passed.
  • The six new cases use real SQLite and controlled registration/cleanup boundaries; the injected failure is not claimed as an actual storage failure or a baseline-red reproduction.
  • At 490c2bc58e45ae9fbcd23250a39b16c7c78de9d3, all 11 targeted files passed typed lint, but the new regression ran in the thread project and four of six cases failed because shared SQLite requires the host broker. The remaining seven files did not run. Hosted CI also caught an incomplete typed context and growth in two over-cap files. The replacement enrolls the regression in the canonical forked database-worker project, constructs a complete context with an eligible client, and extracts support modules while preserving case order.
  • Final exact-head proof for 02ccd2033ddea903c72458136b3403895965c500 passed on the managed Testbox run: the previously failed core test-types stripe, typed lint for all 13 changed source/support files and the inventory file, canonical project ownership (154/154), and all eight standalone files below (352/352, no skips). All commands exited 0; 37 source/command/dependency hashes matched before and after proof. The one-shot box was disposed successfully.
  • The three originally failing approval cases pass in their complete files with the original case order. The six new boundary cases and both signed-runtime suites also pass. The teardown checks verify request joins before database closure; they do not establish the precise cause of the original worker delay.
  • Current hosted CI tests merge 3034b3427a1dcf8b121b0bd8137e40f5cd102237, whose second parent is this exact head. All normal CI jobs completed: 82 succeeded and 18 were intentionally skipped; the required Actions gate passed. The separate combined CI/security publisher also recorded success at 20:02:10 UTC via run 35648426994. Final landing guards recheck the live head and required gates. The current-head ClawSweeper review found no code or security findings; its sole proof-publication move is satisfied by these results. Native landing gates remain pending. No product build is required for this test/test-infrastructure change.

Each row is a separate pnpm test <file> --maxWorkers=1 command on the same freshly installed remote workspace. Monotonic wall time wraps the complete command, including startup, worker generation and teardown, and excludes lease allocation and installation. Later files may reuse caches; these are observed costs, not a comparative benchmark. Printed case sums exclude startup/teardown and are not file or command wall times.

Test file Passed Full command wall (s) Summed printed case times (s)
src/gateway/approval-fixture.test.ts 6/6 25.751 2.150
src/gateway/node-invoke-plugin-policy.private-transport.test.ts 15/15 16.337 0.625
src/gateway/server-methods/server-methods.test.ts 210/210 44.824 26.442
src/gateway/node-invoke-plugin-policy.test.ts 34/34 21.819 7.046
src/gateway/operator-approval-placement-grants.test.ts 10/10 20.508 6.193
src/gateway/worker-environments/computer-transport.test.ts 67/67 17.235 0.828
src/gateway/server-methods/exec-approval.agent-runtime.test.ts 5/5 29.392 2.450
src/gateway/server-methods/plugin-approval.agent-runtime.test.ts 5/5 18.949 1.613

Codex contract reviewed at 414782450952a196bbb64b1605a458c2531c47b6: codex-rs/core/src/mcp_tool_call.rs:1204 (awaited approval decision) and :1914 (decision normalization). No Codex or approval-policy implementation changes.

Preserve the prepared-worker and publication flow while owning request continuations through fixture teardown.

Co-authored-by: Peter Steinberger <[email protected]>
@vincentkoc vincentkoc self-assigned this Sep 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 21, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 21, 2026 19:15
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Current head: 490c2bc58e45ae9fbcd23250a39b16c7c78de9d3. The two callback typed-lint diagnostics are corrected; exact-head focused proof and CI are running.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

The current head is 02ccd20. The final review covers canonical database-worker routing, a complete eligible-client context, and case-order-preserving test support extraction. Exact-head focused proof and normal CI are pending; the PR body records the prior failed surfaces.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 21, 2026, 3:46 PM ET / 19:46 UTC.

ClawSweeper review

What this changes

Updates Gateway approval tests to await publication or acceptance and finish request cleanup before closing their SQLite fixtures.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this remains a useful fixture-lifetime repair beyond current main. No blocking patch defect was found; the maintainer-authored work remains protected from cleanup.

Priority: P2
Reviewed head: 02ccd2033ddea903c72458136b3403895965c500

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent fixture repair with meaningful lifecycle coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored test-only repair is exempt from external-contributor runtime proof; its changed owner is the approval test fixture, and focused execution results remain separate validation evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored test-only repair is exempt from external-contributor runtime proof; its changed owner is the approval test fixture, and focused execution results remain separate validation evidence.
Evidence reviewed 9 items Pinned introduction and scope: Reviewed the introduced delta from ac0a534 to 02ccd20. Changes are tests, test support, and the test-project inventory; unrelated endpoint drift was excluded.
Request lifetime ownership: The shared fixture drains the manager, joins tracked request continuations and the fixture body, then closes the database. The new regression holds an outer continuation and asserts that SQLite remains open until it finishes.
Readiness boundaries and preserved coverage: Publication observation is installed before starting each request and restored afterward; acceptance checks the first response tuple. The extracted delivery cases retain reviewer-visibility, originating-route, and current-owner cleanup assertions in their original registration position.
Findings None None.
Security None None.

How this fits together

Gateway approval tests exercise request registration, reviewer delivery, and approval decisions against temporary SQLite state. Their shared fixture controls when requests finish and when that state can safely close.

flowchart TD
  A[Test request] --> B[SQLite approval registration]
  B --> C[Publication or acceptance]
  C --> D[Approval assertions and decision]
  D --> E[Drain manager and join requests]
  E --> F[Close database and remove fixture]
Loading

Before merge

  • Complete next step (P2) - Add the promised focused validation results and standalone per-file wall times for head 02ccd20 to the PR body.
Agent review details

Security

None.

PR surface

Tests +765. Total +765 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 14 2816 2051 +765
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 2816 2051 +765

Review metrics

Metric Value Why it matters
Production versus test growth Production +0; tests/support +764 net; test inventory +1 Growth stays outside product runtime and supports deterministic readiness, lifetime regression coverage, and the caller migration.

Technical review

Best possible solution:

Keep approval readiness and teardown in the shared fixture owner while preserving the existing policy, identity, and delivery assertions.

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

Yes, at source level: main can close the fixture after manager drain while an outer request continuation remains active. The added held-continuation case targets that ordering; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Extending the existing fixture and awaiting actual publication or acceptance addresses the owner boundary without lengthening polling deadlines or changing approval policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Repairs approval-test synchronization and resource cleanup with no product runtime 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 MEMBER-authored test-only repair is exempt from external-contributor runtime proof; its changed owner is the approval test fixture, and focused execution results remain separate validation evidence.

Label justifications:

  • P2: Repairs approval-test synchronization and resource cleanup with no product runtime 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 MEMBER-authored test-only repair is exempt from external-contributor runtime proof; its changed owner is the approval test fixture, and focused execution results remain separate validation evidence.

Evidence

What I checked:

  • Pinned introduction and scope: Reviewed the introduced delta from ac0a534 to 02ccd20. Changes are tests, test support, and the test-project inventory; unrelated endpoint drift was excluded. (02ccd2033dde)
  • Request lifetime ownership: The shared fixture drains the manager, joins tracked request continuations and the fixture body, then closes the database. The new regression holds an outer continuation and asserts that SQLite remains open until it finishes. (src/gateway/exec-approval-manager.test-support.ts:61, 02ccd2033dde)
  • Readiness boundaries and preserved coverage: Publication observation is installed before starting each request and restored afterward; acceptance checks the first response tuple. The extracted delivery cases retain reviewer-visibility, originating-route, and current-owner cleanup assertions in their original registration position. (src/gateway/server-methods/approval-request.test-support.ts:6, 02ccd2033dde)
  • Requested routing and context corrections: The new regression is included in gatewayDatabaseWorkerTestFiles, whose canonical project uses forks; gateway-core excludes that inventory. Its accepted-response case builds the complete request context with a non-shared-auth Control UI client carrying operator.approvals scope. (src/gateway/approval-fixture.test.ts:105, 02ccd2033dde)
  • Still necessary on current main: Fetched main retains worker preparation and publication observation, but its fixture closes SQLite after manager.drain without joining the outer request or test body. The central lifetime repair is therefore still absent. (src/gateway/exec-approval-manager.test-support.ts:59, 8c56f7239e98)
  • Release comparison: The supplied latest release, v2026.9.5, also has the older manager-only cleanup helper and does not contain this request-joining implementation. (src/gateway/exec-approval-manager.test-support.ts:21, ec9c1a13db89)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the promised focused results and per-file wall times for the pinned replacement head in the PR body.

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.

@vincentkoc
vincentkoc merged commit ff26aae into main Sep 21, 2026
184 of 185 checks passed
@vincentkoc
vincentkoc deleted the fix/approval-fixture-request-lifetimes-20260922 branch September 21, 2026 20:05
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 21, 2026
* commit '3d4033fbe0aca10c9eec45a7c088540607181d79': (42 commits)
  fix(windows): prevent update readiness failures on fractional timeouts (#155051)
  fix(test): await approval readiness and request cleanup (#155111)
  test(update): preserve published plugin archives in survivor fixtures (#155093)
  fix(ci): recover security review from inconsistent file lists (#155129)
  fix(crabbox): skip unused startup and preserve provisioning waits (#154321)
  fix(qa-lab): refresh Control UI links on URL updates (#152397)
  fix(maintainer): recover locally refused auto-merge requests (#154988)
  test(ui): advance debug tray polling with the browser clock (#155091)
  fix(snapshot): preserve concurrently recovered backups (#155075)
  fix(anthropic): preserve context-window-limited responses (#155029)
  fix(ui): stop redundant actions crowding mobile session titles (#154493)
  test(gateway): compare large buffers with native assertions (#154351)
  chore(ci): resync pull request head after the Actions incident
  fix: join local provider child cleanup before releasing ownership
  fix(test): isolate MXC host environment fixtures
  fix(test): prevent Windows worker pipe inheritance
  test(update): use supported reasoning in live survivor probe (#155085)
  fix(firecrawl): omit impossible publication dates from search results (#155032)
  fix(sessions): order WAL recovery and join probe release
  fix(logs): retain severity and subsystem from JSON console records (#153890)
  ...
roboclaw-bot added a commit to VACInc/openclaw that referenced this pull request Sep 21, 2026
Use the newly landed request-tracking and publication fixtures from openclaw#155111 without parallel local helpers. Preserve the independently verified two-line identity deadline preparation fix and all runtime history semantics, authorization assertions, and deadlines.

Co-authored-by: VACInc <[email protected]>
roboclaw-bot added a commit to stevekinney/openclaw that referenced this pull request Sep 21, 2026
Bring in main through 267bb9d, including ff26aae (openclaw#155111), which replaces early approval fixture observations with the actual readiness and cleanup boundaries implicated in the failed CI shard.

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
roboclaw-bot added a commit that referenced this pull request Sep 21, 2026
Merge main at 5390275 to include ff26aae (#155111). The Cmd+K delta is patch-identical; 396 focused UI and approval tests pass on the integrated tree. No duplicate approval-test repair is added to this PR.

Co-authored-by: vyctorbrzezowski <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
)

* fix(test): await approval readiness and request cleanup

Preserve the prepared-worker and publication flow while owning request continuations through fixture teardown.

Co-authored-by: Peter Steinberger <[email protected]>

* fix(test): preserve async delivery mock types

* fix(test): route approval fixtures through database workers

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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