Skip to content

refactor(workboard): use canonical queries for card-tree writes - #139106

Merged
steipete merged 1 commit into
mainfrom
codex/sqlite-goal-workboard-card-writers
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sqlite-goal-workboard-card-writers

Conversation

@steipete

@steipete steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workboard card saves maintained the same fields in handwritten SQL column lists, placeholders, conflict assignments, and separately ordered bindings. That duplication made changes across the parent and child records harder to keep consistent.

Why This Change Was Made

Construct the existing card-tree writes through the canonical Kysely compile/bind helper. Each field now sits beside its value; the parent still binds 33 values once and updates the same 32 non-key columns through excluded. Native SQLite still prepares and executes each statement, with payload getters and JSON serialization evaluated after preparation.

The existing transaction, child replacement/ordinal order, attachment identity, CAS/claim checks, decoder, and close owners remain unchanged. No schema, API, configuration, retention, or concurrency changes. Production delta: +245/-253 (net -8); no test-source changes.

User Impact

No user-visible behavior change. Existing Workboard CLI, Gateway, card, attachment, and worker-claim operations retain their persistence behavior.

Evidence

  • Node 24.20.0 / SQLite 3.53.4 / Kysely 0.29.5.
  • Twelve actual native-owner scenarios match the pre-change baseline exactly: complete persisted rows, child replacement, empty-child deletion, duplicate-child rollback, attachment entry.cardId, absent/stale/exact writes, all claim outcomes, prepare-before-getter/JSON behavior, native prepare denial, and reopen. The executed parent statement has 33 bindings and 32 excluded updates.
  • Existing focused Workboard/store/CLI/Gateway/CAS/attachment/compensation/lifecycle/disposal suites: 191 tests across eight files passed.
  • Complete classified check-changed gate passed, including production/test types, plugin boundaries, lint, doctor contracts, dead exports, storage guards, and import cycles.
  • Actual CLI create/move/show and authenticated native Gateway operations passed across three starts: cross-process write visibility, exact/stale update, comment, 72 KiB attachment, claim/heartbeat/release, wrong-token rejection, byte-identical restart readback, and deletion/restart with unrelated card/blob retained. Native quick_check passed; owned processes and proxy closed.

The live harness uses one completed build plus the official openclaw.mjs package entry and waits for /readyz. Two earlier harness attempts (development-wrapper rebuild race and TCP-before-sidecars readiness) are retained separately; neither required a production change. No external provider or worker was invoked.

Independent review found no P0–P2 findings.

@steipete steipete self-assigned this Sep 5, 2026
@clawsweeper

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

@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 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 10:37 AM ET / 14:37 UTC.

ClawSweeper review

What this changes

Workboard card saves replace handwritten SQL with the shared query builder while preserving existing SQLite persistence behavior.

Warning

SQLite table change

This PR modifies persisted SQLite tables in extensions/workboard/src/sqlite-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 - 3 items remain

Keep open: this remains useful, distinct work absent from current main, and the inspected patch has no actionable correctness findings.

Priority: P3
Reviewed head: 18cd1d2f5694c30900ae16b8e2c11808e04a1614

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused refactor with preserved mappings, relevant existing coverage, and no identified patch defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER author status exempts this behavior-neutral refactor from the external-contributor gate; the complete body additionally reports native card-store parity and packaged CLI/Gateway persistence across restarts, without attached execution traces.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER author status exempts this behavior-neutral refactor from the external-contributor gate; the complete body additionally reports native card-store parity and packaged CLI/Gateway persistence across restarts, without attached execution traces.
Evidence reviewed 10 items Introduced scope and merge identity: The verified merge-base-to-head patch changes only the card-tree writer. The test merge has the pinned base and exact PR head as its two parents; its comparison against that base also changes only sqlite-store.ts.
Preserved persistence boundary: The complete SQLite module was inspected. Parent values and excluded-column assignments match the original writer; child replacement order, attachment entry.cardId, JSON/null conversion, synchronous transactions, conditional writes, claim checks, decoding, and disposal remain unchanged.
Caller and sibling flow: CLI create/move and Gateway mutations reach WorkboardStore, whose conditional writes reach the changed writer. WorkboardStoreRuntime records successful mutations before notifying listeners. The existing proxy-capture store already uses the same compile/bind helper followed by native prepare/run.
Findings None None.
Security None None.

How this fits together

Workboard stores task cards and their associated records in a plugin-owned SQLite database. CLI, Gateway, and agent-tool mutations pass through its store, which checks revisions and claims before committing changes.

flowchart TD
  A[CLI and Gateway requests] --> B[Workboard store]
  B --> C[Revision and claim checks]
  C --> D[Card and child queries]
  D --> E[Native SQLite transaction]
  E --> F[Stored cards and associated records]
  E --> G[Mutation result and change notification]
Loading

Before merge

  • Resolve merge risk (P1) - The reviewer could not directly inspect pinned Kysely 0.29.5 source to independently verify marker preservation and insert/upsert compilation; this is an inspection limitation, not missing contributor proof.
  • Complete next step (P2) - Complete direct inspection of pinned Kysely 0.29.5 parameter preservation and insert/upsert compilation before landing.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -8. Total -8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 245 253 -8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 245 253 -8

Review metrics

Metric Value Why it matters
Production versus test delta Production net -8 lines; tests unchanged The refactor reduces production duplication without adding a parallel persistence path or test-only machinery.
Parent write contract 33 bound fields; 32 non-key conflict updates preserved The conversion retains the existing parent-row mapping without changing its storage contract.

Stored data model

Persistent data-model change detected: database schema: extensions/workboard/src/sqlite-store.ts, unknown-data-model-change: extensions/workboard/src/sqlite-store.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep card-tree persistence on the existing compile/bind helper and native transaction owner, preserving the current stored representation and preparation order.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep card-tree persistence on the existing compile/bind helper and native transaction owner, preserving the current stored representation and preparation order.

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

Not applicable: this PR removes duplicated query construction rather than reporting broken behavior; no introduced defect was established.

Is this the best way to solve the issue?

The owner boundary and shared-helper choice are appropriate; eager value construction would lose the preserved preparation order. A final best-solution judgment remains limited by unavailable upstream Kysely source.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is an internal maintenance refactor with no intended user-visible behavior 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: The supplied MEMBER author status exempts this behavior-neutral refactor from the external-contributor gate; the complete body additionally reports native card-store parity and packaged CLI/Gateway persistence across restarts, without attached execution traces.

Label justifications:

  • P3: This is an internal maintenance refactor with no intended user-visible behavior 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: The supplied MEMBER author status exempts this behavior-neutral refactor from the external-contributor gate; the complete body additionally reports native card-store parity and packaged CLI/Gateway persistence across restarts, without attached execution traces.

Evidence

What I checked:

  • Introduced scope and merge identity: The verified merge-base-to-head patch changes only the card-tree writer. The test merge has the pinned base and exact PR head as its two parents; its comparison against that base also changes only sqlite-store.ts. (extensions/workboard/src/sqlite-store.ts:889, 18cd1d2f5694)
  • Preserved persistence boundary: The complete SQLite module was inspected. Parent values and excluded-column assignments match the original writer; child replacement order, attachment entry.cardId, JSON/null conversion, synchronous transactions, conditional writes, claim checks, decoding, and disposal remain unchanged. (extensions/workboard/src/sqlite-store.ts:905, 18cd1d2f5694)
  • Caller and sibling flow: CLI create/move and Gateway mutations reach WorkboardStore, whose conditional writes reach the changed writer. WorkboardStoreRuntime records successful mutations before notifying listeners. The existing proxy-capture store already uses the same compile/bind helper followed by native prepare/run. (extensions/workboard/src/store-core.ts:875, 18cd1d2f5694)
  • Shared helper and affirmative dependency signal: compileSqliteQueryBindings imports Kysely, compiles marker expressions, and resolves readers in compiled-parameter order. The patch directly consumes this contract, making Kysely inspection relevant. The helper preserves caller ownership of preparation; no Codex harness or protocol dependency was established. (src/infra/kysely-sync.ts:297, 18cd1d2f5694)
  • Current-main necessity: The affected file on fetched main is identical to the PR merge-base version and still contains the handwritten card-tree statements. No replacement implementation was established; the attempted related-PR search could not connect to GitHub. (extensions/workboard/src/sqlite-store.ts:897, bcecb3d1d19a)
  • Existing behavioral coverage: Inspected native SQLite tests cover stale edits across connections, one claim per owner, persisted metadata and attachment blobs after reopening, and compensation. The shared-helper test exercises repeated parameters, literals, nulls, binary values, and SQL-looking strings. Tests were read, not executed in this read-only review. (extensions/workboard/src/store.test.ts:664, 18cd1d2f5694)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

I completed direct inspection of the installed Kysely 0.29.5 compiler, insert-values-parser, update-set-parser and on-conflict builder. Bound values retain their identity through SQL-order parameter collection; the SQLite compiler emits ? placeholders. Insert fields and values stay aligned, and doUpdateSet uses the supplied conflict assignments. The shared helper resolves its unique marker readers in compiler order, while native prepare still precedes payload getters and JSON serialization. The actual native comparison confirms 33 parent bindings and the same 32 non-key excluded updates.

The data-model warning is a classifier false positive: this PR changes query construction, not tables. I byte-compared the complete schema DDL, column ensure, schema migration and database open/close block against the merge base; it is unchanged (SHA-256 da78125331ec5f35f3cadacaabd0d21e437234411b3be94936f68a18a807b7b2). Schema version remains 3. Stored field mappings and all conflict columns also match. No migration is required. Twelve actual native baseline/candidate cases preserve complete rows, errors and traces, including reopen, rollback, attachment identity and CAS/claim outcomes; existing-database persistence was also exercised across three real Gateway starts with the same card and 72 KiB attachment bytes.

The 191 focused tests, full changed gate, official CLI/Gateway proof and sixteen independent clean review reports cover this unchanged head. These checks resolve the dependency-inspection and data-model notes; no schema approval or review-policy exception is needed.

@steipete
steipete merged commit 46b7ee7 into main Sep 5, 2026
99 checks passed
@steipete
steipete deleted the codex/sqlite-goal-workboard-card-writers branch September 5, 2026 17:26
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to aniruddhaadak80/openclaw that referenced this pull request Sep 5, 2026
* commit '3e4becea5e2ce38ede69e8ecf5302805ecbfc09c':
  refactor: simplify outbound message execution context (openclaw#139107)
  fix(models): keep ordinary chat selections session-scoped (openclaw#139232)
  docs: slim root agent instructions and clarify testing scope (openclaw#139236)
  test(agents): give the sibling-drain completion wait a tolerance on slow runners (openclaw#139176)
  refactor(workboard): use canonical queries for card-tree writes (openclaw#139106)
  fix(canvas): recognize versioned macOS nodes (openclaw#138958)
  fix: load GitHub connections without a default agent (openclaw#139222)
  fix(memory): explain unsafe legacy host-event path recovery (openclaw#139195)
  refactor(talk): centralize typed voice session queries (openclaw#139103)
  fix(cli): preserve command dispatch and structured errors (openclaw#139067)
  refactor(agents): consolidate reply failure summaries (openclaw#139175)
  fix(auth): keep an unset default model unchanged during login (openclaw#139218)
  perf(media): reuse validated attachment read handles (openclaw#139168)
  refactor(channels): simplify account configuration updates (openclaw#139096)
  refactor(android): remove unused updater export root (openclaw#139198)
  fix(gateway): stop admitting post-ready producers during close (openclaw#139092)
  fix(gateway): expose agent hook completion outcomes (openclaw#139155)
  fix(config): return the saved configuration after plugin install commits (openclaw#139203)
  fix(android): reduce repeated retries to unreachable gateways (openclaw#138732)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: workboard 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