Skip to content

refactor(board): remove duplicate in-memory store - #117353

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-board-sqlite-owner-0801-2d45
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-board-sqlite-owner-0801-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The board test suite maintained a second, in-memory implementation of the board storage contract even though the Gateway only ships the SQLite-backed store. That duplicate path had accumulated its own cloning, grant, document, and generated-identity logic, letting tests exercise storage behavior that production never uses.

Why This Change Was Made

Remove the internal InMemoryBoardStore and its private helpers, then run every affected board, Gateway, HTTP, session-deletion, and canvas test against SqliteBoardStore. A test-only fixture seeds real session ownership rows and canonicalizes shorthand session keys the same way the tested Gateway path expects.

No public package/plugin-SDK export, database schema/version, configuration, or runtime behavior changes. Production code is +1/-256 (net -255); the complete patch is +116/-368 (net -252).

User Impact

No intentional user-visible behavior change. Board tests now cover the actual durable runtime owner, including session-key canonicalization, persistence, restart behavior, concurrent generated-name collisions, and deletion. This removes a parallel implementation that could drift from shipped behavior.

Evidence

Real Gateway restart transcript

Run on exact head ba8e29439207 in isolated Blacksmith Testbox tbx_01kyyhqzmhw9cqn9vzh280f3k3. The harness built the package, launched the real foreground Gateway with an ephemeral state directory/token, created a real session through sessions.create, wrote through board.widget.put, read through board.get, stopped and restarted the Gateway process against the same state directory, read again, and independently queried the SQLite row. The temporary harness and state directory were deleted after the run.

$ OPENCLAW_STATE_DIR=<tmp>/state pnpm openclaw gateway run --allow-unconfigured --auth token --token <ephemeral-token> --bind loopback --port 19873
$ pnpm openclaw gateway call sessions.create --url ws://127.0.0.1:19873 --token <ephemeral-token> --params '{"agentId":"main","key":"agent:main:sqlite-proof"}' --json
$ pnpm openclaw gateway call board.widget.put --url ws://127.0.0.1:19873 --token <ephemeral-token> --params '{"sessionKey":"agent:main:sqlite-proof","name":"durable","title":"Durable proof","content":{"kind":"html","html":"<p>survives restart</p>"}}' --json
$ pnpm openclaw gateway call board.get --url ws://127.0.0.1:19873 --token <ephemeral-token> --params '{"sessionKey":"agent:main:sqlite-proof"}' --json
{"phase":"session-created","key":"agent:main:sqlite-proof","sessionIdPresent":true}
{"phase":"widget-written","sessionKey":"agent:main:sqlite-proof","revision":1,"resolvedWidgetName":"durable","widgetCount":1}
{"phase":"before-restart","sessionKey":"agent:main:sqlite-proof","revision":1,"widgets":[{"name":"durable","revision":1,"contentKind":"html"}]}
$ kill <gateway-pid>; OPENCLAW_STATE_DIR=<same-tmp>/state pnpm openclaw gateway run --allow-unconfigured --auth token --token <ephemeral-token> --bind loopback --port 19873
$ pnpm openclaw gateway call board.get --url ws://127.0.0.1:19873 --token <ephemeral-token> --params '{"sessionKey":"agent:main:sqlite-proof"}' --json
{"phase":"after-restart","sessionKey":"agent:main:sqlite-proof","revision":1,"widgets":[{"name":"durable","revision":1,"contentKind":"html"}]}
$ node --input-type=module -e '<read-only node:sqlite SELECT from board_widgets>' <tmp>/state/agents/main/agent/openclaw-agent.sqlite
{"phase":"sqlite-row","session_key":"agent:main:sqlite-proof","name":"durable","content_kind":"html","revision":1,"html_bytes":13026}
{"phase":"proof-result","restartStable":true,"duplicateWidgets":0}

AI-assisted; I reviewed the implementation and validation evidence.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 10:32
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 4:52 AM ET / 08:52 UTC.

ClawSweeper review

What this changes

This PR deletes the test-only in-memory board store and updates board, Gateway, HTTP, and canvas tests to use the SQLite-backed board store used by the production Gateway.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this actively assigned, maintainer-labeled PR open for normal landing review. Its central cleanup is not on current main, and the proposed direction removes a test-only storage implementation so board tests exercise the Gateway’s actual SQLite owner; no discrete patch defect was found in the reviewed diff.

Priority: P3
Reviewed head: ba8e29439207bf95c1e6aa160f07cd9fa7042fb9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch cleanly aligns tests with the production storage owner and includes strong real behavior proof; only a routine current-main merge refresh remains before landing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes an after-fix isolated Gateway transcript showing session creation, board write/read, process restart, post-restart read, and direct SQLite-row observation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes an after-fix isolated Gateway transcript showing session creation, board write/read, process restart, post-restart read, and direct SQLite-row observation.
Evidence reviewed 6 items Production storage owner: Current Gateway runtime constructs a SqliteBoardStore, canonicalizes the incoming session key, resolves the agent database path, and returns that resolved identity to the store.
SQLite contract requires existing sessions: The production store resolves the session, requires a corresponding agent-session row before writes, and returns canonical empty snapshots for absent boards; the PR fixture seeds the required row rather than bypassing this boundary.
Fixture follows the durable owner: The new test helper creates a temporary state directory when needed, canonicalizes shorthand session keys, seeds a SQLite session entry, and returns a SqliteBoardStore.
Findings None None.
Security None None.

How this fits together

Gateway board and canvas requests resolve a session key, then persist or retrieve widgets through the board store in an agent-scoped SQLite database. The new test fixture seeds canonical session ownership so tests traverse that durable storage boundary before handlers return board data or HTTP documents.

flowchart LR
  A[Gateway and canvas requests] --> B[Session key resolution]
  B --> C[Board storage contract]
  C --> D[SQLite board store]
  D --> E[Agent SQLite database]
  D --> F[Board snapshots and HTTP documents]
  G[Board test fixture] --> C
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as mergeable but behind its base; before landing, refresh the exact current-main merge result and rerun the focused board/Gateway proof against that tree.
  • Complete next step (P2) - This assigned, maintainer-labeled PR needs ordinary landing-owner review and an exact current-main validation refresh; no bounded automated repair is indicated.
Agent review details

Security

None.

PR surface

Source -207, Tests -45. Total -252 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 51 258 -207
Tests 6 65 110 -45
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 116 368 -252

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single SQLite-backed test path, validate the exact current-main merge result, and land once the focused board, Gateway, HTTP, and canvas suites confirm the shared fixture remains safe on the refreshed base.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single SQLite-backed test path, validate the exact current-main merge result, and land once the focused board, Gateway, HTTP, and canvas suites confirm the shared fixture remains safe on the refreshed base.

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

Not applicable: this PR is internal test-owner cleanup rather than a report of broken user behavior. The supplied real Gateway restart transcript nevertheless demonstrates the durable board path after the change.

Is this the best way to solve the issue?

Yes. Removing the unused in-memory implementation makes tests exercise the same SQLite owner and session prerequisite that production Gateway code uses, avoiding parity drift between parallel stores.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a focused internal test-owner refactor with no intended public API, configuration, schema, or runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes an after-fix isolated Gateway transcript showing session creation, board write/read, process restart, post-restart read, and direct SQLite-row observation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix isolated Gateway transcript showing session creation, board write/read, process restart, post-restart read, and direct SQLite-row observation.

Evidence

What I checked:

  • Production storage owner: Current Gateway runtime constructs a SqliteBoardStore, canonicalizes the incoming session key, resolves the agent database path, and returns that resolved identity to the store. (src/gateway/board-store.ts:7, fcaa9d48421e)
  • SQLite contract requires existing sessions: The production store resolves the session, requires a corresponding agent-session row before writes, and returns canonical empty snapshots for absent boards; the PR fixture seeds the required row rather than bypassing this boundary. (src/boards/sqlite-board-store.ts:364, fcaa9d48421e)
  • Fixture follows the durable owner: The new test helper creates a temporary state directory when needed, canonicalizes shorthand session keys, seeds a SQLite session entry, and returns a SqliteBoardStore. (src/boards/board-store.test-support.ts:14, ba8e29439207)
  • Central cleanup remains necessary: Current main still contains InMemoryBoardStore and board/Gateway/canvas tests that instantiate it, so current main has not already incorporated the PR’s central deletion. (src/boards/board-store.ts:436, fcaa9d48421e)
  • Current runtime provenance: Git blame attributes the current Gateway SqliteBoardStore wiring to commit bacc507, providing a recent current-main owner trail for the production boundary this PR aligns tests with. (src/gateway/board-store.ts:7, bacc5071dba4)
  • PR provenance and proof: The branch is a single refactor commit over aa743c9, and its body supplies an after-fix real Gateway restart transcript that writes a board widget, restarts the process, reads it again, and observes the SQLite row. (src/boards/board-store.ts:1, ba8e29439207)

Likely related people:

  • Jiatai Wang: Current Gateway board-store wiring is blamed to this author’s current-main commit, which establishes the SQLite store and session-resolution boundary that this PR’s tests now target. (role: recent runtime contributor; confidence: high; commits: bacc5071dba4; files: src/gateway/board-store.ts, src/boards/sqlite-board-store.ts)
  • steipete: Authored the single proposed refactor commit and is the current assignee shown in the PR timeline. (role: assigned refactor author; confidence: high; commits: ba8e29439207; files: src/boards/board-store.ts, src/boards/board-store.test-support.ts)

Rank-up moves

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

  • Refresh the exact current-main merge result and rerun focused board, Gateway, HTTP, and canvas proof on that merged tree.

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 (6 earlier review cycles)
  • reviewed 2026-08-01T11:07:50.603Z sha ba8e294 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T11:49:00.686Z sha ba8e294 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T15:07:05.472Z sha ba8e294 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T18:59:46.560Z sha ba8e294 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T19:15:43.505Z sha ba8e294 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T01:25:16.360Z sha ba8e294 :: needs maintainer review 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 1, 2026
@steipete steipete self-assigned this Aug 2, 2026
@steipete
steipete merged commit d5f265f into main Aug 2, 2026
354 of 375 checks passed
@steipete
steipete deleted the codex/goal100k-board-sqlite-owner-0801-2d45 branch August 2, 2026 09:02
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

abdulrahman305 pushed a commit to qenex-ai/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix: stop lost cancellations, false success, and stuck Codex compaction (openclaw#117902)
  fix(cli): reject incomplete hosted video downloads (openclaw#117893)
  refactor(board): remove duplicate in-memory store (openclaw#117353)
  refactor: consolidate Teams and error helpers (openclaw#117907)
  fix(msteams): cancel unread Graph error response bodies (openclaw#117664)
  fix(imessage): rewind the recovery cursor when chat.db is replaced at the same path (openclaw#117788)
  feat(browser): relay CDP compat for Puppeteer clients (chrome-devtools-mcp) (openclaw#117915)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  fix: stop lost cancellations, false success, and stuck Codex compaction (openclaw#117902)
  fix(cli): reject incomplete hosted video downloads (openclaw#117893)
  refactor(board): remove duplicate in-memory store (openclaw#117353)
  refactor: consolidate Teams and error helpers (openclaw#117907)
  fix(msteams): cancel unread Graph error response bodies (openclaw#117664)
  fix(imessage): rewind the recovery cursor when chat.db is replaced at the same path (openclaw#117788)
  feat(browser): relay CDP compat for Puppeteer clients (chrome-devtools-mcp) (openclaw#117915)
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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