Skip to content

fix(tasks): serialize structured task values for sqlite - #71885

Closed
likewen-tech wants to merge 1 commit into
openclaw:mainfrom
likewen-tech:fix/task-sqlite-structured-task-serialization-2026-04-26
Closed

likewen-tech wants to merge 1 commit into
openclaw:mainfrom
likewen-tech:fix/task-sqlite-structured-task-serialization-2026-04-26

Conversation

@likewen-tech

Copy link
Copy Markdown
Contributor

Summary

  • serialize structured TaskRecord.task values before binding them into sqlite
  • preserve existing string task values unchanged
  • add regression coverage that object task payloads are stored as JSON strings instead of throwing during sqlite binding

Root cause

The sqlite task registry store binds record.task directly into the task_runs.task column. Most task values are strings, but structured task payloads can appear from agent/runtime paths. Passing a non-string object directly to sqlite binding can throw or persist incorrectly. The store should normalize the value before binding.

Verification

  • pnpm exec oxfmt --write --threads=1 src/tasks/task-registry.store.sqlite.ts src/tasks/task-registry.store.test.ts
  • git diff --check
  • node scripts/test-projects.mjs src/tasks/task-registry.store.test.ts
    • src/tasks/task-registry.store.test.ts: 11 passed
  • pnpm tsgo
  • pnpm lint
    • 0 warnings / 0 errors

@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a serializeTaskValue helper to task-registry.store.sqlite.ts that coerces non-string task values to JSON strings before binding them to SQLite, fixing a runtime throw when structured objects bypass the task: string type. A regression test verifies the round-trip storage for object payloads. The fix is minimal and correct; the deserialization path (rowToTaskRecord) already returns task as a raw string matching the declared type.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped, has a direct regression test, and does not alter the read path.

No P0 or P1 issues found. The serialization logic is correct for all runtime-reachable values, the string fast-path is preserved, and the test validates the stored byte representation end-to-end.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(tasks): serialize structured task va..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep this PR open, but it is not merge-ready: the submitted fix protects only the SQLite bind step while current main keeps TaskRecord.task string-only and several live consumers still call string methods on that value.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

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

No high-confidence real OpenClaw reproduction is available. Source inspection plus an in-memory node:sqlite check show object binding can throw, but current public task APIs and types keep task text string-only.

Is this the best way to solve the issue?

No. SQLite-only serialization is too late in the lifecycle unless maintainers intentionally widen the task-value contract across live state and all consumers.

Security review:

Security review cleared: The diff is limited to task SQLite serialization and a regression test, with no dependency, CI, secret, permission, package, download, or release-path change.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-26T01:50:00Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • vincentkoc: Recent GitHub history shows multiple commits on src/tasks/task-registry.store.sqlite.ts and src/tasks/task-registry.ts, including SQLite helper refactors around the touched persistence path. (role: recent task persistence contributor; confidence: high; commits: 0529281430db, 45c4f1edd485, 47e86bc1ac79; files: src/tasks/task-registry.store.sqlite.ts, src/tasks/task-registry.ts)
  • steipete: Recent commits moved task state onto shared SQLite and updated task requester attribution/schema surfaces that own this durable task row contract. (role: recent persisted runtime-state contributor; confidence: high; commits: d115fb4cf9f9, 1fef20c96bdc, cca24cc78b63; files: src/tasks/task-registry.store.sqlite.ts, src/state/openclaw-state-schema.sql, src/tasks/task-registry.ts)
  • Feelw00: Recent merged task persistence hardening is adjacent to the live-vs-durable consistency concern raised by this PR. (role: adjacent task persistence contributor; confidence: medium; commits: 01193dea2637; files: src/tasks/task-flow-registry.ts, src/tasks/task-registry.store.test.ts)
  • mbelinky: Merged ClawFlow and task-flow substrate work owns a sibling consumer that would be affected by widening the task-value contract. (role: task-flow feature-history contributor; confidence: medium; files: src/tasks/task-flow-registry.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 20, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed stale Marked as stale due to inactivity labels Jun 24, 2026
@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant