Skip to content

fix: stabilize macOS approval expiry and rejection tests - #136522

Merged
steipete merged 1 commit into
mainfrom
codex/test-macos-approval-expiry-response
Sep 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-macos-approval-expiry-response

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where the macOS approval queue tests could fail during slow connection setup, or appear to validate a rejected approval only after a request timed out. These failures obscured whether approval expiry and competing-client recovery actually worked.

Why This Change Was Made

Create time-sensitive fixtures when the mocked Gateway prepares its response, not before the connection starts. Encode rejection responses with the shared protocol types and require the expected Gateway error before checking that the store re-fetches the authoritative queue. The original 500 ms expiry and queue assertions remain intact; no production behavior or timeout changes.

User Impact

No end-user behavior changes. Maintainers get reliable expiry coverage and a test that distinguishes a real approval rejection from timeout recovery. Scope: one test file, +53/-26 lines; production delta: zero. Related: #135808.

Evidence

  • Reproduced the expiry failure with a 600 ms response-preparation delay against the original 500 ms fixture lifetime. The repaired existing test covers both 0 and 600 ms delays without increasing the lifetime.
  • A freshly built native RED run failed with NSError (Gateway request timeout) where the regression assertion required GatewayResponseError. The corrected response includes the canonical INVALID_REQUEST code and APPROVAL_ALREADY_RESOLVED reason.
  • The freshly built native GREEN suite passed all six methods/seven case executions, zero issues, in 1.673 seconds. The rejection case completed in 0.004 seconds and still verified authoritative queue re-listing. This exercised the production native Gateway client with a mock WebSocket, not a live Gateway or rendered UI.
  • Native RED/GREEN used base 0ebdbe6155adc2413896989f61ca6fadc5fb4b12. The sole subsequent source change was the formatter moving try outward over the same JSON encoding expression; the native results are not presented as an exact formatted-head run.
  • Independent managed Codex review of the final formatted diff and owner/caller/protocol evidence: no actionable P0–P2 findings. All 12 changed-file checks passed, including strict Swift lint and the native schema guard. Complete submitted-head CI passed: eight selected jobs succeeded and 25 were correctly skipped, including successful native test and release jobs. The required aggregate gate passed; no checks were waived.

Review follow-up

The requested expiry and structured-rejection trace is included below from the full native CI run. It covers the changed test fixture using the production native Gateway client; replacing the fixture with a live Gateway would not exercise the code changed by this PR. This is native fixture behavior proof, not a live Gateway or rendered-UI claim. A separate focused rerun was not performed.

Exact-head native CI evidence

The macos-swift (tests) job 100380864505 completed successfully for PR head ef7966b5808755991b1087cb82bca2e02c8e48ff. GitHub checked out merge commit f182d901a149c08fbd7e2c1b0c5ea87f572b0ed2, merging that head into f92a12c5813fb880ed6a05c4a728fd5f4ccc5473. The fixture and unchanged production owner in the merge were independently read back and are byte-identical to the PR head (fixture SHA-256 3a6807e62ba4cd7d017f94c01e73c26f1f99ebc851a1a77ca24be3848929be0a).

This is an excerpt from the full CI suite, not a separate focused rerun. ExecApprovalQueueStoreTests passed all six methods/seven cases, including the original 500 ms expiry scenario with both 0 and 600 ms response-preparation delays. The structured-rejection method passed in 9.304 seconds. Its source requires GatewayResponseError, INVALID_REQUEST, and APPROVAL_ALREADY_RESOLVED; successful assertion values are not individually printed in the log, so this is a source-bound method pass rather than a separate wire trace.

Fixture method CI result and reported elapsed time
refresh seeds direct gateway list and excludes expired approvals Passed, 3.237 s
losing a resolution race re-syncs from the authoritative queue Passed, 9.304 s
requested and resolved events update the shared queue Passed, 1.755 s
expired requests disappear without a gateway resolution event Passed, 8.071 s (both 0/600 ms cases)
explicit decision policy excludes allow always and blocks unavailable decisions Passed, 3.339 s
system agent approvals resolve through the unified kind-aware gateway method Passed, 5.334 s

The complete Mac Swift Testing run reported 1,926 tests in 200 suites passed; XCTest reported 4 tests, 0 failures. The separate named-profile AppStateIsolationTests invocation passed 2 tests in 1 suite. The same job's preceding shared OpenClawKit step passed 1,577 tests in 121 suites. Its later isolated render step passed 1 test in 1 suite. These are separate runner-reported totals, not one inflated combined count.

2026-09-02T18:54:01.1109600Z HEAD is now at f182d901 Merge ef7966b5808755991b1087cb82bca2e02c8e48ff into f92a12c5813fb880ed6a05c4a728fd5f4ccc5473
2026-09-02T19:12:09.1483380Z ◇ Suite ExecApprovalQueueStoreTests started.
2026-09-02T19:12:09.1752110Z ◇ Test "refresh seeds direct gateway list and excludes expired approvals" started.
2026-09-02T19:12:13.6103550Z ✔ Test "refresh seeds direct gateway list and excludes expired approvals" passed after 3.237 seconds.
2026-09-02T19:12:13.6104290Z ◇ Test "losing a resolution race re-syncs from the authoritative queue" started.
2026-09-02T19:12:28.8784060Z ✔ Test "losing a resolution race re-syncs from the authoritative queue" passed after 9.304 seconds.
2026-09-02T19:12:28.8784650Z ◇ Test "requested and resolved events update the shared queue" started.
2026-09-02T19:12:28.8921050Z ✔ Test "requested and resolved events update the shared queue" passed after 1.755 seconds.
2026-09-02T19:12:28.8922030Z ◇ Test "expired requests disappear without a gateway resolution event" started.
2026-09-02T19:12:28.8990960Z ◇ Test case passing 1 argument listResponseDelayMs → 0 to "expired requests disappear without a gateway resolution event" started.
2026-09-02T19:12:52.3474240Z ◇ Test case passing 1 argument listResponseDelayMs → 600 to "expired requests disappear without a gateway resolution event" started.
2026-09-02T19:12:52.6937320Z ✔ Test "expired requests disappear without a gateway resolution event" with 2 test cases passed after 8.071 seconds.
2026-09-02T19:12:52.7043310Z ◇ Test "explicit decision policy excludes allow always and blocks unavailable decisions" started.
2026-09-02T19:12:53.2644860Z ✔ Test "explicit decision policy excludes allow always and blocks unavailable decisions" passed after 3.339 seconds.
2026-09-02T19:12:53.2653170Z ◇ Test "system agent approvals resolve through the unified kind-aware gateway method" started.
2026-09-02T19:12:53.3585960Z ✔ Test "system agent approvals resolve through the unified kind-aware gateway method" passed after 5.334 seconds.
2026-09-02T19:12:53.3586630Z ✔ Suite ExecApprovalQueueStoreTests passed after 31.070 seconds.
2026-09-02T19:13:21.8534300Z ✔ Test run with 1926 tests in 200 suites passed after 68.863 seconds.

The full-suite fixture elapsed time is not compared with the isolated local run as a performance claim. Separately, the complete submitted-head CI run finished successfully at 19:41:08 UTC: eight selected jobs passed and 25 were correctly skipped. The required aggregate gate passed. The latest 19:34 UTC ClawSweeper review has no blocking findings or remaining before-merge items.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 3:34 PM ET / 19:34 UTC.

ClawSweeper review

What this changes

The PR makes macOS approval-queue tests create expiring fixtures at mocked Gateway response time and verifies a structured rejection before queue re-sync.

Merge readiness

✅ Ready for maintainer review

No blocking findings: this is a focused, test-only repair whose timing and structured-error assertions match the existing macOS approval-queue owner. It remains open because it is maintainer-labeled and authored by a repository member, which requires explicit maintainer handling rather than automated closure.

Priority: P3
Reviewed head: ef7966b5808755991b1087cb82bca2e02c8e48ff

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-boundary repair with exact-head native CI evidence and no supported correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored, test-only PR changes a mock Gateway fixture rather than user-visible production behavior. Supplied exact-head native CI evidence directly exercises the production Gateway client against that fixture and reports the delayed expiry and structured-rejection cases passing.
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 changes a mock Gateway fixture rather than user-visible production behavior. Supplied exact-head native CI evidence directly exercises the production Gateway client against that fixture and reports the delayed expiry and structured-rejection cases passing.
Evidence reviewed 6 items Introduced fixture behavior: The introduced hunk defers construction of approval fixtures until the list response and adds 0 ms/600 ms response-delay cases while retaining the 500 ms approval lifetime.
Current owner behavior: The queue filters expired approvals at list receipt, schedules expiry from the remaining lifetime, and re-lists after a resolution failure. The production owner is unchanged between current main and this PR head.
Structured rejection contract: The native protocol response carries an error code, message, and details; the client converts an ok:false frame into GatewayResponseError, whose detailsReason reads details.reason.
Findings None None.
Security None None.

How this fits together

The macOS status menu displays pending execution approvals fetched from the Gateway. The approval queue filters expired requests and re-lists the authoritative queue when another client wins a resolution race.

flowchart LR
A[Status menu] --> B[Approval queue]
B --> C[Gateway client]
C --> D[Mock Gateway fixture]
D --> E[Expiry and rejection response]
E --> B
B --> F[Queue assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other +27. Total +27 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 53 26 +27
Total 1 53 26 +27

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +53/-26 All introduced code is confined to the native test fixture; no runtime, protocol, or user-setting surface changes.

Technical review

Best possible solution:

Keep the production approval-queue owner unchanged and land this focused fixture repair through the normal maintainer PR flow.

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

Yes, source establishes the prior timing failure: the fixture timestamp was created before connection and response work, so a 600 ms delay could consume its 500 ms lifetime before receipt. This read-only review did not execute a local reproduction.

Is this the best way to solve the issue?

Yes. Deferring fixture construction to the mocked Gateway’s list response fixes the timing at its producer, while the typed response assertion verifies the same structured-rejection contract used by the native client and Gateway.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0df437f0071c.

Labels

Label changes:

  • add P3: The PR improves deterministic macOS test coverage without changing shipped user behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 changes a mock Gateway fixture rather than user-visible production behavior. Supplied exact-head native CI evidence directly exercises the production Gateway client against that fixture and reports the delayed expiry and structured-rejection cases passing.

Label justifications:

  • P3: The PR improves deterministic macOS test coverage without changing shipped user behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 changes a mock Gateway fixture rather than user-visible production behavior. Supplied exact-head native CI evidence directly exercises the production Gateway client against that fixture and reports the delayed expiry and structured-rejection cases passing.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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-02T18:48:51.595Z sha ef7966b :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: S maintainer Maintainer-authored PR labels Sep 2, 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 2, 2026
@steipete
steipete merged commit 47def12 into main Sep 2, 2026
77 checks passed
@steipete
steipete deleted the codex/test-macos-approval-expiry-response branch September 2, 2026 19:47
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos 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