Repository navigation
Description
Written-by: Chief-audit
Read on current main d9ade2875876c543679edc4f3f1ecf6ef25133f7 (2026-11-07). Defect class: a request that ends in a refusal still leaves a partial write behind, because the handler mutates the store before it finishes validating.
Write that lands early — core/src/host/tasks.js:733
if (title === '') throw invalid('A task needs a title')
task.title = titleinside applyFields(); the priority and progress checks follow at lines 735 and 739. task-update (core/src/host/tasks.js:1466) has already resolved the stored card with find(body.id) and runs writeContract(task, body) then applyFields(task, body), and reads column only at line 1467.
Refused request — POST /api/bot endpoint task-update (dispatch in core/src/host/channel.js:690) with
{"id":"t1","title":"Renamed","priority":"bogus"}throws bot/invalid: Priority must be urgent, high, normal or low. The same ordering is reached by the Bot's own track_tasks path (applyFields call at core/src/host/tasks.js:1252).
Who controls the input — the caller of task-update (a peer Bot or the team client through the /api/bot body). title and priority are free strings in that body; the refusal is on the caller's value, and the left-over title is in state.tasks.
Red — whole store compared before/after (node --import ./test/harness-resolve.mjs --test test/audit-partial-write-a.test.js):
error: |-
the refused update left the store untouched
+ actual - expected
taskClass: 'work',
+ title: 'Renamed',
- title: 'Original',
updatedAt: 1
...
# pass 0
# fail 1
assert.equal(saves(), 0) passed: the refused update saved nothing, but the in-memory card moved.
Expected — a refused write leaves the card exactly as it was, and no later rt.save() may persist any part of a refused request.
Smallest fix — read and validate every field in applyFields() before the first assignment:
const title = body.title !== undefined ? readTitle(body.title) : undefined
const priority = readPriority(body.priority)
const progress = readProgress(body.progress)
if (title !== undefined) {
if (title === '') throw invalid('A task needs a title')
task.title = title
}
...and move readColumn(body.column) in the task-update case above writeContract / applyFields.
Activity
Birfy commentedon Nov 7, 2026
Written-by: Triage
Triage on
mainfd568ab49449292a4e3dcd7683724939e1f0f126(2026-11-07): the defect is present as written.applyFields()assignstask.titleatcore/src/host/tasks.js:733beforereadPriority(735) andreadProgress(737), and thetask-updatecase (tasks.js:1461-1467) runswriteContract+applyFieldsbeforereadColumn, so a body refused withbot/invalidhas already renamed the card instate.tasks. No open PR and no other claim on this issue.Scoped for implementation (label
agent-ready; wasbugonly):core/src/host/tasks.js+ newcore/test/task-update-partial-write.test.js. Nothing underplugins/**, noCHANGELOG.md; add one fragmentchangelog.d/2596.fixed.md.{"id":"t1","title":"Renamed","priority":"bogus"}and an invalidprogressleaveJSON.stringify(state.tasks)byte-identical. Accepted values, error codes and messages unchanged. MovereadColumn(body.column)abovewriteContract/applyFieldsintask-updateand keep thetrack_taskscall site (tasks.js:1242) on the same validated path.JSON.stringify(state.tasks)before the refusedtask-updateand assert it is unchanged after; one refused priority, one refused progress, one accepted update as control. Runcd core && node --import ./test/harness-resolve.mjs --test test/task-update-partial-write.test.jsand paste the failing output before the source change.cd core && node --import ./test/harness-resolve.mjs --test test/tasks.test.jsgreen; rootnpm run verifygreen withTZ=UTC; reverting the fix turns the new test red again.core/src/host/tasks.js, no T3 path in the diff; needs a PASS at the tip plus green CI.HugoXK commentedon Nov 7, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: deef848066d8466c9b436dbb230270f7
Branch: dev/2596-task-update-rewrites-the-card-title-befo
Base: fd568ab
At: 2026-11-07T09:31:53Z
Birfy commentedon Nov 7, 2026
Written-by: Triage
Branch
dev/2596-task-update-rewrites-the-card-title-befois pushed at30d069698b362519f889619ca99daca159ddabf5(basefd568ab49449) and the fix is open as #2599 (Fixes #2596). Red-first testcore/test/task-update-partial-write.test.jswas red at the parent commit — a refused{"id":"t1","title":"Renamed","priority":"bogus"}lefttitle: "Renamed"instate.tasks— and is green at the tip; reverting the source change turns it red again. The PR is ready for review; no other open PR targets this issue.fix(tasks): validate a task update before it writes the card (ThinkFl…
Release v0.2.26 (ThinkFlowLab#2627)