Skip to content

fix(gateway): queue board and progress-card writes - #148948

Merged
fuller-stack-dev merged 3 commits into
mainfrom
codex/swarm-board-progress-admission-20260915
Sep 19, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
codex/swarm-board-progress-admission-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #130741

What Problem This Solves

Board and progress-card RPCs can block the gateway event loop for the SQLite busy timeout while a background native operation owns the agent writer. Their async APIs still opened the database and initialized first-use tables synchronously before entering the existing writer queue.

User Impact

Board and progress updates now wait asynchronously for that writer, so the gateway can continue handling other requests. MCP pins whose source permission is revoked while waiting remain read-only.

Why This Change Was Made

Queue writes at their storage owners, capture the original physical target and state environment, and recheck request/session authority before schema work, mutation and publication.

MCP App pins also need current source permission after the wait. A reproduced ordering removed the granted source before the queued destination pin, yet the destination retained interactive tools and successfully called one. Refreshing source interaction policy under writer admission preserves the read-only behavior for revoked sources. Cancellation or database retirement during preparation refuses the write.

The SQLite schema, stored formats, revision/grant rules and reset lifetimes are unchanged. This is a scheduling and authority-preservation change, with no DDL or migration changes.

Evidence

The same synthetic real-SQLite contention fixture was run on canonical base 10b13070c4afb9f4c5ecefab01212ef5511246d3 and exact PR head bfeb7e16b3128acc4799ab284493e3ade6bd35dc. A 75 ms host timer took 5,372.94 ms on the base; the write failed with database is locked and persisted nothing. On this head the timer took 74.58 ms and the widget persisted once.

  • Raw base recording and raw head recording. These record actual fixture output, using disposable state.
  • Proof manifest and artifact manifest with checksums. Published files were verified with GET and SHA-256 comparison.
  • Independent source-blind results: six board/progress probes pass on the exact head, including varied lock duration and revoked authority. Revoked writes persist nothing.
  • Native scripts/pr review-tests passed all 57 tests across board-progress.write-admission.test.ts, board.mcp-admission.test.ts and session-accessor.sqlite-reclamation.test.ts. Coverage includes registered RPC admission, allowed/revoked MCP tool calls, cancellation, database retirement, native authorization and durable revision readback.
  • Full build and core type checking passed on a current-main recovery integration whose nine PR files are byte-identical to this head. Exact-head hosted CI remains the landing gate.

Fresh independent P0-P2 review of that integration reported one hypothetical indefinitely stalled permission resolver. The current production callback graph does not support that premise: the sole callback awaits an immediate SQLite read, with no external asynchronous provider. The finding was rejected after tracing all production assignments and forwarding paths. No accepted actionable findings remain.

The storage compatibility evidence is the unchanged schema/format owners plus existing-row, native reclamation and persisted-revision tests. This synthetic proof does not establish a universal 500 ms live Gateway latency target.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 09:08
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 19, 2026, 6:00 AM ET / 10:00 UTC (Revision 4).

ClawSweeper review

What this changes

Queues board and progress-card writes behind existing database writers and rechecks request and MCP source permissions before saving.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/boards/sqlite-board-store.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 2 items remain

No actionable patch findings remain. The previous migration blocker is unsupported: schemas, serialization, and storage kernels are unchanged, and the earlier MCP admission finding is addressed. Current main still needs this repair.

Priority: P2
Reviewed head: bfeb7e16b3128acc4799ab284493e3ade6bd35dc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful contention and authority evidence and no remaining actionable findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Supplied exact-head real-SQLite contention results exercise the changed storage owners and show prompt timer release, successful persistence, and rejection of revoked writes. Registered-handler tests supplement this with MCP final-dispatch, cancellation, and retirement coverage; artifact playback could not be independently checked on this host.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Supplied exact-head real-SQLite contention results exercise the changed storage owners and show prompt timer release, successful persistence, and rejection of revoked writes. Registered-handler tests supplement this with MCP final-dispatch, cancellation, and retirement coverage; artifact playback could not be independently checked on this host.
Evidence reviewed 10 items Pinned ownership and current state: Host introduction evidence identifies ffcb91a..bfeb7e1 as the introduced delta. A live GitHub read confirms the same open, unmerged head and fuller-stack-dev as assignee. The maintainer label independently protects this PR from cleanup closure.
Admission preserves synchronous mutation authority: The board owner captures its database target, joins the existing writer queue, uses asynchronous database admission, and checks current authority before schema setup and inside the synchronous transaction. After MCP preparation it also rejects a retired database handle. Progress-card storage follows the same admission pattern.
No introduced stored-data-model change: The comparison is empty for both schema owners, the board codec and mutation kernel, and the progress-card persistence kernel. The changed BoardStore option is an internal admission callback; no public plugin SDK export was found. Existing revision, grant, and serialized-row contracts remain intact.
Findings None None.
Security None None.

How this fits together

Gateway requests save conversation boards and progress cards in per-agent SQLite databases. Writer admission coordinates these updates with background database work before handlers publish results.

flowchart TD
  A[Board or progress request] --> B[Capture target and authority]
  B --> C[Agent database writer queue]
  D[Background database writer] --> C
  C --> E[Recheck request and source permissions]
  E --> F[Synchronous SQLite mutation]
  F --> G[Authorized response and notification]
Loading

Before merge

  • Resolve merge risk (P1) - Independent verification of the linked recordings and JSON artifacts was limited by missing ffprobe and the artifact-host network restriction.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +93, Tests +574, Docs +9. Total +676 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 178 85 +93
Tests 3 579 5 +574
Docs 1 11 2 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 768 92 +676

Review metrics

Metric Value Why it matters
Storage compatibility 0 schema, migration, or serialization changes The previous data-model blocker does not match the introduced patch.
Production versus regression coverage Production net +93 lines; tests net +574 lines Production growth implements queued admission and authority preservation, with most growth devoted to contention and revocation coverage.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/boards/sqlite-board-store.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain one canonical writer queue, synchronous storage kernels, and final authority checks without introducing a migration or parallel persistence path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain one canonical writer queue, synchronous storage kernels, and final authority checks without introducing a migration or parallel persistence path.

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

Yes: current-main storage calls synchronously enter SQLite while a background writer can hold the database; supplied paired contention results demonstrate the failure. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes: the patch uses the existing admission owner and preserves storage contracts while refreshing authority after waiting; a migration or new policy option would add unnecessary scope.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Supplied exact-head real-SQLite contention results exercise the changed storage owners and show prompt timer release, successful persistence, and rejection of revoked writes. Registered-handler tests supplement this with MCP final-dispatch, cancellation, and retirement coverage; artifact playback could not be independently checked on this host.

Label justifications:

  • P2: This bounded reliability repair prevents board and progress writes from stalling the Gateway under SQLite writer contention.
  • 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. Sufficient (linked_artifact): Supplied exact-head real-SQLite contention results exercise the changed storage owners and show prompt timer release, successful persistence, and rejection of revoked writes. Registered-handler tests supplement this with MCP final-dispatch, cancellation, and retirement coverage; artifact playback could not be independently checked on this host.
  • proof: sufficient: Contributor real behavior proof is sufficient. Supplied exact-head real-SQLite contention results exercise the changed storage owners and show prompt timer release, successful persistence, and rejection of revoked writes. Registered-handler tests supplement this with MCP final-dispatch, cancellation, and retirement coverage; artifact playback could not be independently checked on this host.

Evidence

What I checked:

  • Pinned ownership and current state: Host introduction evidence identifies ffcb91a..bfeb7e1 as the introduced delta. A live GitHub read confirms the same open, unmerged head and fuller-stack-dev as assignee. The maintainer label independently protects this PR from cleanup closure. (bfeb7e16b312)
  • Admission preserves synchronous mutation authority: The board owner captures its database target, joins the existing writer queue, uses asynchronous database admission, and checks current authority before schema setup and inside the synchronous transaction. After MCP preparation it also rejects a retired database handle. Progress-card storage follows the same admission pattern. (src/boards/sqlite-board-store.ts:119, bfeb7e16b312)
  • No introduced stored-data-model change: The comparison is empty for both schema owners, the board codec and mutation kernel, and the progress-card persistence kernel. The changed BoardStore option is an internal admission callback; no public plugin SDK export was found. Existing revision, grant, and serialized-row contracts remain intact. (src/boards/sqlite-board-store.kernel.ts:72, bfeb7e16b312)
  • Applicable storage policy: The storage review checkpoint distinguishes internal writer admission and lifecycle mechanics from changes to schemas, durability, retention, permissions, or persistent interpretation. This diff preserves those storage contracts; a separate migration acceptance request is unwarranted. Public docs: docs/reference/database-schemas/storage-changes.md. (docs/reference/database-schemas/storage-changes.md:1019, bfeb7e16b312)
  • Previous MCP finding addressed: The handler forwards source-interaction revalidation to the storage owner. Revocation while queued produces a read-only destination without declared tools. Tests exercise the registered request path and final tool-dispatch boundary, checking allowed calls, rejected revoked calls, cancellation, and database retirement. The sole production source-policy callback reads the current board document; the alleged indefinitely stalled external resolver is not present in that callback graph. (src/gateway/server-methods/board.mcp-admission.test.ts:295, bfeb7e16b312)
  • Runtime and compatibility evidence: The captured PR body reports the same real-SQLite contention fixture on base 10b1307 and the pinned head: a 75 ms timer took 5,372.94 ms with a locked-database failure before the fix, versus 74.58 ms with one persisted widget afterward. It also reports six independent board/progress probes, revoked writes persisting nothing, and 57 focused tests including existing rows, native reclamation, and durable revision readback. These are supplied results, not tests executed by this reviewer. (bfeb7e16b312)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (3 earlier review cycles)
  • reviewed 2026-09-15T09:15:34.083Z sha 094a102 :: needs real behavior proof before merge. :: [P1] Revalidate MCP source authority after queued admission
  • reviewed 2026-09-15T11:37:52.260Z sha 48e70d3 :: blocked before merge. :: none
  • reviewed 2026-09-19T09:53:57.403Z sha bfeb7e1 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 15, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 18, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

@clawsweeper re-review

The branch now includes main without rewriting contributor history. Exact head bfeb7e16b3128acc4799ab284493e3ade6bd35dc passes 57 focused tests and six independent source-blind board/progress probes. The Evidence section now links the raw red/green recordings and verified artifact manifests.

For the previous unknown-data-model-change compatibility flag: this PR changes scheduling and authority checks, with no schema, DDL, migrations, stored formats or grant/revision kernel changes. Existing-row, native reclamation and durable revision readback tests pass. Please evaluate that concrete compatibility evidence against the current head.

@clawsweeper

clawsweeper Bot commented Sep 19, 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 proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Sep 19, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

Follow-up on the current review's two remaining checklist notes:

  • Artifact verification is complete outside the review worker's restricted environment. All 13 published files were downloaded with GET and compared byte-for-byte and by SHA-256 with the inspected originals. Both MP4 recordings pass ffprobe and complete ffmpeg decode; the terminal output and exact source SHAs were visually inspected. The independent validator also ran six opaque board/progress probes on this exact head, including authority revocation, without reading the implementation. A missing ffprobe binary or blocked artifact host in the review worker is an environment limit, not a patch failure.
  • The review itself confirms that the migration blocker is unsupported. This delta changes no schema, migration, serialization or storage kernel. Existing-row, native reclamation and durable revision readback tests pass. No migration is required for an unchanged stored format.

No product change is needed for either note. The remaining landing requirement is hosted CI; the isolated Windows skills-watcher timeout is being investigated without changing this PR's scope.

@fuller-stack-dev
fuller-stack-dev merged commit 02d37b5 into main Sep 19, 2026
375 of 379 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the codex/swarm-board-progress-admission-20260915 branch September 19, 2026 10:44
@fuller-stack-dev

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
* fix(gateway): queue board and progress-card writes

* fix(gateway): revalidate MCP pin authority after admission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

2 participants