Skip to content

test: finish Gateway cleanup and repair CI fixtures - #156136

Merged
steipete merged 5 commits into
mainfrom
codex/agent-write-drain-join
Sep 23, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/agent-write-drain-join

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Completes the write-queue cleanup work landed in #156172. The composite session-store test helper still rejected accepted SQLite followers, and the resume fixture could retire storage before the shared drain completed. It also repairs fixture failures exposed by the complete CI run.

User Impact

Test cleanup lets accepted SQLite writes finish before retiring storage, using the canonical agent-write drain and Gateway fixture retirement owner. No production API, configuration, schema, or timeout changes are introduced.

Why This Change Was Made

The composite cleanup joins accepted agent writes instead of cancelling queued followers. The resume fixture keeps its store selected until producers and writers settle. The original participant-root detachment and queue implementation landed independently on main and are reused here.

Three timing-sensitive fixtures now synchronize with their actual owners: abort authorization joins event publication and a same-WebSocket response barrier; the late-abort test joins session admission and a history response before asserting its established error; the synthetic Telegram Gateway receives a continuously reserved listener through IPC.

The latest integration run also exposed deterministic fixture omissions after main's build-warning changes. Copied lint and changelog fixtures now include their required imports, and the install-smoke test verifies the validated reusable-workflow identity consumed by its directly pinned relay checkout. The two CI/developer executable roots remain visible to Knip without being classified as shipped production entrypoints. Artifact-only transport and trusted-SHA assertions remain intact.

Evidence

  • The composite cleanup regression fails on the original helper because an accepted follower never runs; the correction verifies both delayed cleanup and the persisted result. The initial follow-up passed 70 tests across five focused files in 73.01s wall with one worker, plus formatting and typed lint.
  • The original requested Gateway proof passed on 95484db11c31: all three reported files together (105 tests, 84.80s wall), the runtime group (19 files / 157 tests), and two quiet full agent/chat shard runs, each 81 files / 1,165 tests (595.46s and 616.93s wall). Both used the exact groups payload with default three forks, file parallelism, and isolate:false: run A, run B. The final follow-up reuses main's equivalent canonical queue owner and has fresh focused and GitHub proof.
  • The full requested OPENCLAW_TESTBOX=1 pnpm check:changed passed during the original implementation, including all typechecks, 25 core-test shards, 28 lint shards, three export scans, and structural guards: check run. Later fixture corrections have separately scoped checks and review.
  • A competing bind reproduces the old Telegram port race and is refused after the listener handoff; its Node suite passed 143 tests.
  • The historical late-abort timeout did not recur in a quiet cohort replay. Controlled failure-receipt gating demonstrates the vulnerability: the old two-second waiter expires while required persistence remains held; the corrected test joins persistence and observes exactly one error before late abort/replay. Its six cases passed in 26.48s single-worker wall, 21 siblings passed, and the original 22-file cohort passed all 253 tests in 234.60s wall. Its canonical changed check and isolated P2 review passed.
  • The three build-warning fixture files passed 58 tests in 61.67s wall, with one worker. File times: dist ownership 50.49s, install smoke 4.13s, OCM adapter 2.57s. The existing dist suite exercises real process and artifact lifetimes. No test was added to mirror the dependency lists. The exact failed CI source matches the repaired baseline; all existing behavior assertions remain.
  • Independent reviews found no unresolved actionable findings. The final four-file changed gate passed formatting, root-test typechecking, typed lint, three export scans, and structural guards. Final-head CI passed with 184 successful checks and no pending or failing checks: CI run.

Earlier CI also encountered main's UI type error, corrected in 813a10e7deb, and the build-warning omissions described above. One initial focused attempt ran zero tests because concurrent SDK declaration generation changed compiler inputs; generation was joined before successful proof. A supplemental changed check stopped on formatting; the files were formatted before the final check. The final-head results and remaining evidence gaps are recorded below.

A final macOS/Node 26 diagnostic found that the synthetic control command was written and the recorder exited within 700 ms, but its directory watcher never delivered the notification; a separate write/chmod probe also delivered no event within five seconds. The fixture now signals after the real write to the exact command path succeeds and restores the original writer during cleanup. Both 1.5-second assertions remain unchanged, and isolated P2 review is clean. A subsequent loaded-Mac replay (load 45) passed four of seven cases and also hit provider-startup and separate restart-watcher failures; these remaining local failures are not claimed fixed. The final isolated Linux run passed all 141 tests across the 13 Node test files, including all seven composition cases, in 10.03s test time on the unchanged deadlines: proof run. Its source capsule matches the committed observer SHA-256 b5eaab547cbbf332d3c34925ed7b2195e41b03b724ee9758b082dd9a6eed91f1; the one-shot Testbox stopped after success. This proves the Linux fixture boundary and does not erase the loaded-Mac observations.

CI on 910ad27 used main 058e664f5cb, before two owning fixes landed. The branch now includes main's 9bb3ccca699 revert of the projection-settlement regression and 91ee6aa3de1 correction of the UI footer fixture's missing pane-ID callback. All five PR commits remain patch-identical across this rebase. The revert preserves the canonical scoped write drains; the PR does not modify any reverted file. The five affected Gateway fixture files passed together on final 7ae1a27: 195 tests, 285.08s Vitest / 287.94s wrapper wall with one worker, including resume, RPC fixture, create, permission-root, and permissions-hooks. The canonical wrapper verified the exact source/tree, and the Testbox stopped after success: post-revert proof.

The final native merge check found an overlapping main change in the abort-authorization test. Inspection confirmed its complete file blob is byte-identical to this PR (6f9d26b11aba844f7cfc0b8287cfe067ffbe66bb), so main has independently adopted the same event join. The remaining delta and proof are unchanged.

Merged as ceb109668b4396181205e330a2b466c132fede89 after final-head CI and a clean ClawSweeper review. Final mixed tooling-shard walls were 423s (small-42), 548s (small-41), and 901s (small-38); these are whole-shard costs, not individual fixture times. Native source/receipt verification and branch/worktree closeout completed.

@clawsweeper

clawsweeper Bot commented Sep 23, 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 marked this pull request as ready for review September 23, 2026 03:21
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 23, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 23, 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 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 7:17 AM ET / 11:17 UTC (Revision 14).

ClawSweeper review

What this changes

The PR makes test cleanup await accepted writes, synchronizes Gateway and Telegram test fixtures, supplies missing fixture dependencies, and classifies two developer scripts correctly for dependency checks.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main still cancels accepted SQLite followers in composite test cleanup. The fixture repairs preserve meaningful assertions, and this review found no blocking correctness or security defect.

Priority: P2
Reviewed head: 7ae1a27b5e06e8a01b3611491c28b45a3335228d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable fixture repair with preserved assertions, substantial recorded validation, and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored PR changes test fixtures and developer audit configuration, with no material authority change or stored-data contract change. Recorded Gateway and Linux composition runs support the fixture repairs; they are not live Telegram product proof, and the disclosed loaded-Mac failures remain separate observations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR changes test fixtures and developer audit configuration, with no material authority change or stored-data contract change. Recorded Gateway and Linux composition runs support the fixture repairs; they are not live Telegram product proof, and the disclosed loaded-Mac failures remain separate observations.
Evidence reviewed 10 items Pinned patch and merge ownership: Reviewed the merge-base-to-head introduced diff. Raw test-merge parent records match the pinned base followed by the exact PR head. The merge result retains base-branch release-validation work; the abort-authorization adjustment is already shared with the base.
Useful cleanup repair remains absent from main: Fetched main still passes SQLite queues to the generic helper that rejects pending followers. The branch instead uses the existing non-cancelling agent-write drain. The updated regression holds the first writer, queues a follower, and checks that cleanup waits and the follower completes.
Existing retirement owner reused: The resume fixture now calls the existing retirement helper, which joins request roots, session admissions, and scoped writes before clearing store selectors and closing databases. The unrelated-controller, revoked-parent, cancelled-successor, and successful-resume assertions remain intact.
Findings None None.
Security None None.

How this fits together

These test helpers exercise OpenClaw’s Gateway requests, session storage, and developer tooling. They coordinate asynchronous work and resource cleanup so tests observe completed behavior before retiring their fixtures.

flowchart TD
  A[Test requests and queued writes] --> B[Gateway and session fixtures]
  B --> C[Await owned work and publication]
  C --> D[Assert responses and persisted results]
  D --> E[Retire fixture storage]
  F[Copied developer tooling] --> G[Complete dependencies and trusted workflow identity]
  G --> D
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +62, Other 0. Total +62 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 9 129 67 +62
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 10 131 69 +62

Review metrics

None.

Technical review

Best possible solution:

Keep fixture synchronization with the existing lifecycle owners while preserving the behavioral assertions and production contracts.

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

Yes, source provides a clear reproduction path: hold a SQLite writer, queue a follower, then invoke main’s composite cleanup, which rejects pending followers. This review did not execute tests.

Is this the best way to solve the issue?

Yes, reusing the canonical drain and retirement helpers repairs fixture ownership without introducing competing cleanup logic or weakening the tested outcomes.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: These bounded fixture repairs improve test reliability without changing shipped product behavior.
  • 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: The member-authored PR changes test fixtures and developer audit configuration, with no material authority change or stored-data contract change. Recorded Gateway and Linux composition runs support the fixture repairs; they are not live Telegram product proof, and the disclosed loaded-Mac failures remain separate observations.

Evidence

What I checked:

  • Pinned patch and merge ownership: Reviewed the merge-base-to-head introduced diff. Raw test-merge parent records match the pinned base followed by the exact PR head. The merge result retains base-branch release-validation work; the abort-authorization adjustment is already shared with the base. (7ae1a27b5e06)
  • Useful cleanup repair remains absent from main: Fetched main still passes SQLite queues to the generic helper that rejects pending followers. The branch instead uses the existing non-cancelling agent-write drain. The updated regression holds the first writer, queues a follower, and checks that cleanup waits and the follower completes. (src/config/sessions/store-writer-state.test-support.ts:5, bffdc770bf7a)
  • Existing retirement owner reused: The resume fixture now calls the existing retirement helper, which joins request roots, session admissions, and scoped writes before clearing store selectors and closing databases. The unrelated-controller, revoked-parent, cancelled-successor, and successful-resume assertions remain intact. (src/gateway/server.sessions-send-resume.test.ts:42, 7ae1a27b5e06)
  • Terminal-event synchronization preserves the contract: The late-abort case joins session admission and a same-WebSocket history response before requiring exactly one error event. It still verifies that late abort does nothing and replay returns the established error. The production error finalizer publishes before releasing admitted work. (src/gateway/server.chat-abort-dispatch-rejection.test.ts:380, 7ae1a27b5e06)
  • Telegram fixture retains cancellation assertions: The synthetic Gateway receives an already-bound listener through IPC. The control observer signals only after the real command-file write succeeds and restores the original writer during cleanup. Recorder termination and both existing cancellation deadlines remain asserted; Telegram product behavior is unchanged. (.agents/skills/telegram-e2e-userbot/scripts/telegram-run-composition.test.mjs:147, 7ae1a27b5e06)
  • Fixture dependencies and workflow trust remain bounded: The lint fixtures supply json5 required by the real lint launcher, and the changelog fixture copies its existing check-limits import. Install-smoke assertions now verify the existing validated workflow identity and directly pinned relay checkout while retaining repository/SHA rejection and artifact-only transport checks. No workflow, dependency manifest, lockfile, permission, or production authorization changes are introduced. (test/scripts/install-smoke-no-push-workflow.test.ts:165, 7ae1a27b5e06)

Likely related people:

  • Peter Steinberger: Raw commit aabfaf9 adds src/config/sessions/store-writer-state.test-support.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: aabfaf98b24a; files: src/config/sessions/store-writer-state.test-support.ts)
  • RoboClaw: Raw commit f63d91e adds src/state/openclaw-agent-write-admission.test-support.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: f63d91e13cda; files: src/state/openclaw-agent-write-admission.test-support.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.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-23T06:12:08.040Z sha 8d8941b28f9a799e0ae0faa355526bce4614e9ee :: needs changes before merge. :: none
  • reviewed 2026-09-23T06:23:49.050Z sha 95484db11c318b28cb2f8430f480bd42287a4d96 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T07:03:45.021Z sha 5d40c50 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T07:10:02.780Z sha 5d40c50 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T07:24:04.241Z sha 83c2ef4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T10:13:31.134Z sha b4e7779 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T10:48:01.624Z sha 910ad27fe9a8b073bdb716f8ccf499c10c20b028 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T11:07:21.040Z sha 7ae1a27 :: needs maintainer review before merge. :: none

@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 23, 2026
@steipete
steipete force-pushed the codex/agent-write-drain-join branch from 87ba045 to cfc4b11 Compare September 23, 2026 04:16
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 23, 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:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current head also joins the terminal owner-clear notification in the lifecycle-persistence test. The PR body records both green packed agent/chat runs and the focused proof for this separate CI fixture repair.

@clawsweeper

clawsweeper Bot commented Sep 23, 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.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete force-pushed the codex/agent-write-drain-join branch from 8d8941b to 95484db Compare September 23, 2026 06:15
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The merge conflict is resolved on the current rebased head. All six retained commits are patch-identical; the duplicate lifecycle-test correction was dropped because #156014 now joins the same full persistence promise on main. The base retains that repair and its active-owner assertions. Gateway integration proof is being renewed for the base's SQLite worker-close changes.

@clawsweeper

clawsweeper Bot commented Sep 23, 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:

@steipete
steipete force-pushed the codex/agent-write-drain-join branch from 95484db to 5d40c50 Compare September 23, 2026 06:55
@steipete steipete changed the title fix(gateway): join participant writes before retiring test stores test(gateway): finish queued-write cleanup and fixture joins Sep 23, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current five-file follow-up reuses the canonical queue drain already landed in #156172. It finishes the non-destructive composite cleanup and resume-store retirement paths, and retains the proven abort-event and Telegram-port fixture fixes. The PR body records the narrowed scope, the failing-before/passing-after cleanup regression, and 70 passing focused tests. The duplicate queue implementation and overlapping weak queue test were removed.

@clawsweeper

clawsweeper Bot commented Sep 23, 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:

@steipete
steipete enabled auto-merge (squash) September 23, 2026 11:12
@steipete
steipete merged commit ceb1096 into main Sep 23, 2026
232 checks passed
@steipete
steipete deleted the codex/agent-write-drain-join branch September 23, 2026 11:19
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

roboclaw-bot added a commit that referenced this pull request Sep 23, 2026
Incorporate the upstream Gateway test correction from #156136 and #156460 instead of duplicating it. The original five-file icon-control patch remains patch-equivalent (68ff51f01760ab97321206d323990196ec0fe23b), with no package.json or AGENTS.md delta against the refreshed base.

Co-authored-by: hxy91819 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
* test(gateway): finish queued-write cleanup and fixture joins

* test(gateway): join dispatch error before late abort

* test(ci): complete fixtures for build warning helpers

Keep isolated lint and changelog fixtures complete after build-warning helper imports were added. Verify the reusable workflow identity exported to its trusted relay checkout while preserving artifact-only transport guards.

* fix(ci): classify workflow script roots as development tooling

Keep the warning relay and Swiftlint wrapper visible to full-tree audits without treating developer executables as shipped production entrypoints.

* test(telegram): observe completed control writes directly

Join the exact command artifact write in the synthetic run fixture instead of relying on directory notifications. Preserve the recorder-exit precondition and both cancellation deadlines.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
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: M 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