Skip to content

fix(chat): resync the task checklist after a native restart, let a person tick rows - #14912

Merged
chenmingwei23 merged 2 commits into
mainfrom
fix/todo-pill-reset-resync
Sep 30, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
fix/todo-pill-reset-resync

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The task checklist above the composer stays editable after the agent's native conversation restarts, and a person can tick a row directly.

Bug report: a session's checklist pill sat at "3 of 7" while the agent said "I can't tick those four items off in the dashboard checklist from this session, but the work behind all four is done." Asking it again did not help, and there was no control in the dashboard to tick the rows by hand.

Root cause, reproduced against kiro-cli 2.25.0: the pill mirrors the todo_list tool's state, and that state lives inside ONE native conversation. Kiro Crew replaces the native conversation on an agent switch, a failed session/load (four retries then a fresh session), a poisoned-conversation discard and /clear -- and keeps the slot's pill snapshot across all of them. The agent then holds an empty list under a pill that still shows the old one; its next complete fails with Task 1 not found: No such file or directory (os error 2), which the model reports as "I cannot update the checklist". Same-directory --resume keeps the list; a new conversation loses it.

Why it matters

Anyone whose long session was cold-started once (a model or agent switch is enough) loses the ability to track progress on the plan the agent made, and gets a confusing "I can't" from an agent that did the work. Neither the agent nor the person had any way back.

Not a goal

  • Persisting kiro-cli's own todo state across conversations (that is kiro-cli's store, not ours).
  • Un-completing a task inside kiro-cli's list: its todo_list tool has no such command, so an untick is held on the dashboard side and stated to the agent as an open row.
  • Letting an app agent or an MCP tool write the checklist; the route is for the person's click.
  • Adding, removing or reordering rows from the dashboard; only the completed flag is editable.

What changed (motivation -> approach -> change)

Symptom: pill frozen, agent says it cannot tick. Cause: pill snapshot outlives the native conversation that owns the list. Change, two parts:

  1. Resync on cold start. chat_runner._run_chat prepends a [Task checklist -- automatic recovery] block to the first prompt of a fresh native session -- same gate as the transcript replay (_context_is_new and not _provider_has_history), only when the slot still carries a non-empty list, never on a slash command. The block carries the description and every task with its [x]/[ ] state and tells the agent to recreate the list with one todo_list create and a complete per ticked row (_ChatSlot.todo_recovery_prompt). It is prepended after the egress scrub (see 3), and the tool result that follows repaints the pill through the normal todo_update path.

  2. A person can tick a row. PATCH /api/chat/slots/{slot}/todo with {id, text, completed} (dashboard/chat_todo.py) flips one task on the slot (_ChatSlot.set_todo_task_completed), broadcasts the same todo_update delta the tool result does, and answers the refreshed payload. It applies the unattributable-caller and member fences the other slot writes use, refuses app callers with a 404 byte-identical to the missing-slot 404, re-checks state._slots.get(name) is slot after the body read so a same-name replacement cannot take the write, and refuses with 409 todo_task_stale when the id's stored text no longer matches the text the click carried (ids are positional; the agent can replace the list under a click). The click's text is compared to the stored text RAW (line-folded only): the person clicked the text they saw, and the marker neutralizers are lossy, so a canonical comparison could let a replacement task that differs only inside a marker span take the click. The remote-bound refusal is checked AFTER the app fence, so an app caller sees the same 404 on a remote-bound slot as on any other. In TaskProgressBar.tsx each row of a LOCAL session is a role="checkbox" button drawn as a real checkbox (a remote-bound session only relays the peer's list, so its rows are read-only and the route answers remote_bound_refusal), with a one-line hint at rest that states the consequence and its reversibility ("Click a row to mark it done or not done. Nothing changes for the agent until its next turn, and you can click again to undo until then. Done rows the agent will not redo; not-done rows it treats as still open. Rows you set show a person mark until the agent confirms them.") and the same consequence in each row's tooltip and aria label; the write goes through useMutation; the row repaints only from the gateway's serialized todo_update echo (the PATCH response is deliberately not applied, so two quick clicks cannot land out of order and an older response cannot restore an obsolete list); clicks are queued and sent one at a time (a clicked row is held until its PATCH settles, other rows stay clickable, a failure clears the queue and the next click is sent, not greyed out under the old notice); a refused PATCH renders through a block ErrorNotice under the list (outside its scroll box, so it is readable at any scroll position) with a human lead that names the row and says why a retry is safe (""" did not update; the row keeps its old state. Clicking again is safe: a row only changes when the list shows it."), so a refusal after a landed tick cannot be read as the tick being lost and, below it, the refusal in plain words keyed on the gateway's code (caller_unattributable -> "The dashboard lost track of who is clicking. Reload the page and click again.", todo_task_stale -> "The list changed while you were clicking, so this row is a different task now...", todo_task_not_found / todo_absent, remote_action_unsupported); the server's own text stays on the tooltip, and an unmapped failure shows it directly. A held row keeps its glyph, dims in place and shows a small "Sending" at its right edge while its PATCH is queued or in flight (a spinner read as the agent working on the row). A row the person set carries a person glyph (UserCheck / UserX) and a tooltip lead ("You marked this done; the agent has not confirmed it yet.") until the agent's own list agrees, so a person's override cannot be mistaken for the agent's completion; the payload carries person: true on such rows and never on a cold-start pin; plus the ask-agent hand-off and a dismiss. The notice and the queue are per slot: a failure in one session neither shows in nor drains another session's clicks. Read-only rows (remote-bound session) use circle glyphs, not checkboxes, and the hint says whose checklist it is. Task ids in the warm-turn sync block ride inside the same fence as their text.

  3. The tick outranks the agent's stale copy and reaches a live agent. The agent re-sends its whole list on every todo_list call, so a plain write would be reverted by the next tool result. The slot keeps the person's edits as overrides (_todo_overrides): set_todo applies them over every incoming agent snapshot and retires each one the moment the agent's snapshot agrees (or the row is gone). An override is bound to its row's raw line-folded text. A cold-start recovery block hands the agent the CANONICAL text (markers neutralized), so the rebuilt row comes back in that form: from the block's delivery (provider's first event) until the agent's next snapshot the canonical forms are compared too, and that snapshot rebinds the override to the rebuilt text; outside that window a canonical match is refused, so two different marker-bearing texts cannot pass one override between them. The recovery block itself is a DEBT (todo_recovery_pending): armed when built, settled on the first model-output event of the turn that carried it (never by a terminal-only stream) (a slash command or warm turn that ran while it was owed does not settle it), dropped by /clear; so a turn that dies before delivery re-sends the block. A person's untick is never retired by an agreeing snapshot (kiro-cli cannot un-complete, so the only open echo is the rebuild's all-open create, which predates the untick); it holds until the row is gone or replaced. Task ids are capped (TODO_ID_MAX) like task text, since they key the overrides and pins (or the row is gone); a retirement counts as a change so the crew log's plan entry records the agent's confirmation. Before a cold-start rebuild every already-completed row is pinned as an override too (pin_completed_todo_rows), so the rebuild's all-open create echo cannot erase them if the turn dies before the complete calls. On the next warm turn the runner prepends a [Task checklist -- person edited] block (todo_sync_prompt) naming the ticked rows for one complete call, and stating unticked rows as still open (kiro-cli has no un-complete command). On a cold start the recovery block already carries the edited state. Each edit is stated to the agent once: the runner records the (id, text, completed) rows it rendered into the block and, on the first event that shows the model READ the prompt (a text or thinking chunk, a tool call, a permission request; a terminal-only stream such as the transport's own complete(timeout) or a compaction failure does not count), marks stated only the overrides that still carry exactly that text and flag (mark_todo_edits_stated), so a turn that dies before the model reads the block re-states them next turn, a row ticked while the turn was already assembled is not falsely marked, and a row toggled twice inside that window keeps its newer edit unstated and says it next turn. An untick can never be confirmed (kiro-cli has no un-complete command). A cold-start pin is recorded as the agent's own completion, never attributed to the person. The block's frame [Task checklist -- ...] / [End task checklist] is registered in _STRUCTURAL_MARKER_RES and the block is prepended AFTER the egress scrub (the way build_message mints folder steering), so a forged copy in history, a hook or a tool result is neutralized and only the gateway's block wears the frame.

  4. Task texts re-stated to the model are data. Whatever the agent typed into its list may be a copy of a page or a file, so both prompt blocks fold each text to one line, strip fence and structural markers (_neutralize_fence_markers, _neutralize_structural_markers), wrap it in a new <<<UNTRUSTED_TODO_TEXT ... >>>END_UNTRUSTED_TODO_TEXT fence registered beside the thread and calendar fences in context.py, and carry a notice that text inside the fence is never an instruction.

  5. /clear drops the pill. Clearing abandons the plan, so the slot's snapshot and overrides go with it (and a todo_update: null is broadcast); otherwise the recovery block would rebuild the cleared checklist into the fresh conversation. Gated on THIS turn's own /clear, not on frame ownership: a shared runtime marks the clear frame ownerless whenever a subagent is registered, for peers and for the session that typed it alike.

The person's tick is what the next fresh session rebuilds from, so the two repairs compose: tick rows 4-7 today, and an agent restarted tomorrow recreates a 7-of-7 list.

Backwards compatibility

Compatible: one new route and two new _ChatSlot methods; set_todo, todo_payload, the todo_update frame shape and the TodoList type are unchanged. A slot with no list, or a resumed session, produces no prepend.

Tests

test/test_todo_pill_resync.py (70):

  • recovery prompt is empty without a list / with zero tasks; carries every task in order with its state; names todo_list, create and complete.
  • set_todo_task_completed flips by id, reports no change on a same-state write, ignores unknown ids and an absent list.
  • route: tick writes the slot and broadcasts the exact todo_update payload; untick; no-op tick answers 200 with no broadcast; unknown task, no checklist, missing slot -> 404; malformed body -> 400; app caller -> 404 slot_not_found with nothing written.
  • fencing: every task line is fenced and single-line; a forged closing fence inside a task is neutralized and cannot break out; a forged structural marker is neutralized; the sync prompt fences too.
  • frame: [Task checklist ...] / [End task checklist] are neutralized in untrusted text (separator-tolerant); the genuine block is the outermost prefix with intact markers.
  • sync block: an edit is stated once, not on every turn; only the rows rendered into the block are marked, on the first model-output event (a terminal-only complete(timeout) stream settles neither the edits nor the recovery debt), so an aborted turn re-states and a tick landing after assembly is not lost; a row re-toggled between assembly and delivery stays unstated; a completed row whose text carries a structural marker survives the rebuild's all-open create echo; a person-set row is flagged person until the agent confirms it, and a pin never is; cold-start pins are not attributed to the person and pin the folded text.
  • /clear: the pill drops on the session's own /clear even on an ownerless frame; a clear frame on a turn that did not type /clear leaves a peer's pill (and its ticks) alone; a remote-bound slot refuses the tick.
  • cold start: pinned completed rows survive the all-open create echo, retire as the agent completes each one, and never override a person's untick; an override confirmation reports a change (crew log) while a plain re-echo does not; a click whose id now names a different task is refused 409 with nothing written.
  • overrides: a stale agent snapshot does not revert a tick; an override retires once the agent agrees; a vanished row drops its override; an untick holds against a snapshot saying done; clearing the list clears overrides.
  • todo_sync_prompt names ticked rows for complete and unticked rows as open; empty without pending edits.
  • route: an idempotent re-submit (no flag moved) still lands in the audit chain with changed=False; a multi-line task text is compared line-folded (no false 409); the remote-bound refusal is answered after the app fence; a slot replaced during the body read is refused 404 with nothing written; the missing-slot and app-refusal 404 bodies are byte-identical.
  • runner (real _run_chat, mocked provider): cold start with a pill prepends the recovery block (with the person's ticks folded in) and keeps the builder prompt as the tail; a warm turn with a pending tick prepends the sync block; resumed session, warm turn without edits and cold start without a pill get no block; /clear drops the pill and broadcasts todo_update: null.

website/src/test/TaskProgressBar.test.tsx (+15, 32 total): clicking a row PATCHes (slot, id, !completed); the hint and per-row tooltip name the consequence at rest; three quick clicks are sent one at a time in order with every clicked row held; the row does not repaint from the PATCH response, only from the todo_update delta; a rejected PATCH renders an ErrorNotice with the human lead and the server text and leaves the row unchanged; a click after a refusal is sent; a refusal in another slot neither shows nor drains this slot's queue; each mapped refusal code renders in plain words with the server text on the tooltip (4 cases); held rows show a visible Sending; a person-set row wears the person glyph and tooltip; a queued tick PATCHes the slot it was clicked in after a session switch; a remote-bound session renders rows read-only with no hint.

Existing test_todo_list_surface.py, test_context_marker_neutralization.py, test_error_code_contract.py, test_json_object_body_guard.py, test_chat_slot_pin_ownership.py, test_s32_dashboard_mutating_routes_owner_gate.py, test_check_feature_map.py pass (226 in the touched suites). node scripts/i18n-check.mjs and tsc --noEmit clean.

Manual verification

  • Reproduced the root cause with kiro-cli 2.25.0: create a list, --resume keeps it, a new conversation in the same directory answers Task 1 not found on complete and an empty list on list.
  • node scripts/capture-todo-pill-tick.mjs (added) drives the built SPA: 3 of 7 -> click row 4 -> the stubbed PATCH echoes todo_update -> 4 of 7, row 4 aria-checked=true, header advances to the next task; then the stub refuses the next PATCH and the failure notice renders with row 5 kept open; then the stub holds a PATCH open and the clicked row shows its pending state; then the session is remote-bound and the rows render read-only. Both themes.

Screenshots / video

Dark, expanded, before the click (the reported state):

3 of 7, rows 4-7 open

After clicking row 4 (the person glyph says this mark is the person's until the agent confirms it):

4 of 7, row 4 ticked

A refused tick (the gateway answered 403 caller_unattributable; the row keeps its state; the notice says a retry is safe and the reason in plain words, server text on hover):

tick refused

A tick in flight (the clicked row is dimmed and says Sending until its PATCH settles; other rows stay clickable):

tick pending

A remote-bound session (the peer owns the checklist: circle glyphs, no checkboxes, read-only hint):

remote read-only

A row the person UNTICKED (the undo half: the agent had it done, the person marked it not done; the person glyph and tooltip say so until the agent's list agrees):

person unticked

Light theme

light after tick

Related Issues

Reported in Slack by a user whose session returned "I can't tick those four items off in the dashboard checklist from this session". No issue filed.

Pattern harvest

Rule candidate: review-prompt
Pattern: a dashboard-side copy of provider-owned state has two writers (the person, the provider's full snapshot) and no reconciliation rule, so one writer silently reverts the other; the pill here, the same shape as the MCP report the runner already nulls on reset.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (feature map row added)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested a review from a team September 29, 2026 03:18
@chenmingwei23
chenmingwei23 requested a review from a team as a code owner September 29, 2026 03:18
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of da0a4949750b6b362484d45b60d31dbd4ad0cac2 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] da0a494

False positive or not applicable? A repository writer can comment:
/ai-review override gpt da0a4949750b6b362484d45b60d31dbd4ad0cac2: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of da0a4949750b6b362484d45b60d31dbd4ad0cac2 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A person's tick is told to a live agent only once, even though tick confirmation is observable — an ignored sync block diverges silently.

Watch

todo_sync_prompt filters not ov.get("stated") for ticks and unticks alike, and mark_todo_edits_stated marks on the model's first output event — not on the agent's complete. The docstring's say-once rationale ("an override the agent can never confirm (an untick…) is said once rather than on every turn") names only unticks; a tick can be confirmed, and the confirmation signal already exists (override retirement on snapshot agreement). If the model reads the block but never calls complete, "do not redo" is never repeated, so many warm turns (and a compaction) later the agent redoes work the person marked done — the exact confusion this PR exists to remove, now silent until the next cold start re-syncs.
Clears when: a ticked (confirmable) override is re-stated on later turns until the agent's snapshot retires it — unticks keeping say-once — or a maintainer records say-once-for-ticks as the intended trade against prompt noise.

[DESIGN-REVIEWED] da0a494

Description read

[DESCRIPTION-READ] beee4610eab6607910e7ef094a933361eb54b5e35059772bbd447687462c81d6

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of da0a4949750b6b362484d45b60d31dbd4ad0cac2 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The untick-held-forever machinery rests on an unverified provider claim — "kiro-cli's todo_list has no un-complete command" — that nothing checkable pins.

Not justified as shipped

  • Item 4 — inherited: the untick_survives_rebuild branch, the never-retire rule and the "stated once, never confirmed" path are all sized by the description's bare assertion "its todo_list tool has no such command"; the bug reproduction (2.25.0) covers the frozen pill, not this command-set claim.
    Subtraction: if kiro-cli does expose un-complete, delete untick_survives_rebuild and the never-confirmed stated special case in state.py in favor of one tool call in todo_sync_prompt.
    Clears when: the absence of an un-complete/uncheck command is confirmed against kiro-cli 2.25.0's todo_list command set.

What this change ships

Inventory (10 items) — 8 justified

Intent: FIX — the checklist pill stays live and hand-editable after the agent's native conversation restarts (reproduced defect, error text quoted, kiro-cli 2.25.0).

  1. A fresh native session gets a recovery block that rebuilds the agent's lost list — justified
  2. Each pill row is a checkbox a person can tick (PATCH .../todo) — justified
  3. A person's edit outranks the agent's stale full-list re-send and reaches a live agent next turn — justified
  4. An untick is held dashboard-side indefinitely, never agent-confirmed — inherited: rests on the unverified "no un-complete command" claim
  5. /clear now drops the pill too — justified
  6. Re-stated task texts/ids ride a new untrusted fence; forged checklist frames neutralized — justified
  7. Provider-authored task ids now redacted and capped (TODO_ID_MAX) — rides along: hardens the retention/prompt paths the fix itself adds
  8. Person-set rows wear a person glyph until the agent confirms — justified
  9. Remote-bound sessions keep read-only rows; the route refuses — justified
  10. Clicks queue one at a time with a visible Sending state and per-slot plain-word failure notices — justified

More than 10 differences ship; the remainder are mandated companions (i18n catalogs, feature-map and security.md rows updated same-commit) and a screenshot harness matching the 658 existing capture-*.mjs siblings.

[FIRST-PRINCIPLES-REVIEWED] da0a494

Description read

[DESCRIPTION-READ] 7f7ce20591c8afe52324069b857ea190ff1ba80fd2e116d5c1a8b2ef961804fd

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of da0a4949750b6b362484d45b60d31dbd4ad0cac2 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

The two person-mark glyphs read as one icon at 13px — the blind reader told done from not-done only by the text strikethrough.

Watch

  • Glyph pair UserCheck vs UserX (TaskProgressBar.tsx): reader — "the icons alone are too similar; only the strikethrough on the text tells them apart" and "hard to tell apart at this size." Every person-set row, every session, momentary misreading of whether you claimed done or not-done; smallest fix: give the not-done mark a visibly different treatment (hollow glyph or warning tone) instead of two same-silhouette persons.
  • click_to_toggle_hint's "person mark": reader — "the 'person mark' wording is confusing" — it names a glyph the user hasn't seen yet. Fix: "show a small person icon until the agent confirms them."

Suggestions

  • The 4-sentence hint restates the per-row tooltips (aria_mark_done already carries "The agent will not redo it. Click again to undo."); keep the hint's first two sentences visible and let the tooltips carry the consequences.

[UX-REVIEWED] da0a494

Description read

[DESCRIPTION-READ] 400be0751b12ec834cbbbd58297995cb11431181881e6a36726c285735e1fde5

That sha256 names everything this verdict read: the PR description, plus the 10 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed da0a4949750b6b362484d45b60d31dbd4ad0cac2 — this comment is updated in place on each push.

Review details

No findings. — one advisory item below.

FINDING — src/kiro_crew/dashboard/state.py:4181 — untick_survives_rebuild = ov.get("person") and not wanted also fires for a person who undoes their own tick (the UI advertises "Click again to undo"): the second click leaves {"completed": False, "person": True} against a row the agent already holds open, so the "snapshot agrees" retirement at 4186 can never be taken and the row is pinned open with a permanent person mark — the agent's later genuine complete is suppressed in the pill forever, todo_payload() undercounts, and each cold start re-states that row as [ ] so the agent redoes finished work → Fix: record the agent's own flag when the override is created (e.g. "agent": bool(task.get("completed")) in set_todo_task_completed, read before the flip) and gate the exemption on it — ov.get("person") and not wanted and ov.get("agent") — so an untick only outranks an agreeing snapshot when the agent's own copy actually said done.

[OPUS-REVIEWED] da0a494

Verdict parsed from the review's SHA-scoped output markers for commit da0a4949750b6b362484d45b60d31dbd4ad0cac2.

False positive or not applicable? A repository writer can comment:
/ai-review override fable da0a4949750b6b362484d45b60d31dbd4ad0cac2: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch 3 times, most recently from a09d234 to 6b97661 Compare September 29, 2026 06:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch 5 times, most recently from ebffe74 to bed2e6f Compare September 29, 2026 08:26
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from bed2e6f to 9a799af Compare September 29, 2026 11:54
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch 2 times, most recently from f2af836 to 7fce8c0 Compare September 29, 2026 22:33
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 29, 2026
…rson tick rows

The checklist pill mirrors kiro-cli's todo_list state, which lives inside one
native conversation. Kiro Crew replaces that conversation on an agent switch,
a failed session/load, a poisoned-conversation discard and /clear, and keeps
the pill's snapshot across all of them. The agent then holds an EMPTY list
under a pill that still shows the old one; its next `complete` fails with
"Task N not found" (kiro-cli 2.25.0), which it reports as "I cannot update
the checklist". Nobody could tick the remaining rows.

Two repairs:

* On a cold start the provider did not resume itself, and only when the
  slot still carries a non-empty list, the runner prepends a
  `[Task checklist -- automatic recovery]` block: the description and every
  task with its [x]/[ ] state, telling the agent to recreate the list with
  one todo_list `create` and a `complete` per ticked row. Same gate as the
  transcript replay, pure prepend, so the trusted-tail scrub covers it.

* `PATCH /api/chat/slots/{slot}/todo` {id, completed} lets the person tick
  or untick one row from the pill. It writes the slot's copy, broadcasts the
  same `todo_update` delta the tool result does, and is refused for app
  callers with the indistinguishable 404 the other slot writes use. Each pill
  row is now a role=checkbox button; the store repaints from the echo, so a
  failed PATCH needs no rollback.
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from 7fce8c0 to 44f8b02 Compare September 29, 2026 22:39
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 29, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from 44f8b02 to dd0d628 Compare September 29, 2026 23:07
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from dd0d628 to 2146505 Compare September 29, 2026 23:41
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 30, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from 2146505 to 7a053ed Compare September 30, 2026 00:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 30, 2026
…reaches a live agent

Review follow-up on the checklist pill.

* The agent re-sends its WHOLE todo list on every todo_list call, so a
  person's tick written straight onto the slot was reverted by the next tool
  result. The slot now keeps the person's edits as overrides: set_todo applies
  them over every incoming agent snapshot and retires each one as soon as the
  agent's snapshot agrees or the row is gone. A warm turn prepends a
  "[Task checklist -- person edited]" block naming the ticked rows for one
  `complete` call (unticked rows are stated as still open; kiro-cli has no
  un-complete command). The cold-start recovery block already carries the
  edited state.
* Task texts re-stated to the model are DATA: each one is folded to a single
  line, stripped of fence and structural markers, and wrapped in the new
  <<<UNTRUSTED_TODO_TEXT fence (registered with the other untrusted fences in
  context.py), with a notice telling the agent never to follow instructions
  found inside it.
* /clear drops the pill and its overrides (todo_update: null), so the cleared
  plan is not rebuilt into the fresh conversation.
* Route: the missing-slot 404 carries the same body as the app refusal (no
  existence oracle); the slot is re-checked after the body read so a
  same-name replacement cannot take the write; every error response carries
  a code; the read_bounded_json cap decision is registered.
* Pill: rows are drawn as real checkboxes with a one-line hint at rest and the
  outcome as a tooltip; the write goes through useMutation; the row repaints
  only from the gateway's serialized todo_update echo; a refused PATCH renders
  through ErrorNotice.
* Catalogs: two new keys in every catalog; api key order snapshot updated.

Review fixes (GPT 5.6 + UX + Opus):

* Tick-window override integrity: _todo_sync_rendered carries (id, completed,
  text) snapshots and mark_todo_edits_stated only marks an override delivered
  when it still matches, so a row re-toggled between prompt assembly and the
  provider's first event is not falsely marked stated and dropped.
* Canonical pin/override text: pins and person overrides store, and set_todo
  compares, the same _todo_canonical_text the recovery prompt emits, so a
  marker-bearing completed row survives the neutralized rebuild echo.
* Raw click identity: the PATCH refuses a stale click by comparing the RAW
  (fold-only) row text, not the lossy canonical form, so a marker-collision
  replacement under the same id cannot absorb a click meant for the original.
* Per-slot tick-failure retention: the failure notice is kept per slot, not
  read off the shared react-query mutation error, so a queued tick for another
  slot cannot erase this slot's refusal notice.
* Cold-start untick: a person's untick is never retired by the rebuild's
  all-open `create` echo agreeing it is open (kiro-cli has no un-complete
  command, so that agreement is the rebuild default, not confirmation); the
  untick holds until the row is gone or its text is replaced.
* Recovery emits an empty description unchanged, not the literal "(none)"
  placeholder that the agent would echo back and set_todo would store.
* UX: the tick refusal codes caller_unattributable / todo_task_stale are
  mapped to plain-language detail in the notice (raw server wording read as
  gibberish to a first-time reader), a spinner shows while a row's PATCH is in
  flight, and read_only_hint is reworded. New i18n keys across every catalog;
  en-XA regenerated.

Regression tests added and mutation-verified for each fix.
@chenmingwei23
chenmingwei23 force-pushed the fix/todo-pill-reset-resync branch from 7a053ed to da0a494 Compare September 30, 2026 01:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 30, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I checked this at head da0a494.

The new PATCH /api/chat/slots/{slot}/todo route is registered beside /pin and /folder (routes/sessions.py:96). It therefore gets the same dashboard token auth, and has no exemption.

The handler in dashboard/chat_todo.py checks, in order:

  1. refuse_unattributable_caller
  2. member_slot_write_refused
  3. an app fence that refuses every app caller with an indistinguishable 404 and logs it to SEL
  4. remote_bound_refusal
  5. body type validation
  6. state._slots.get(name) is not slot, re-checked after the body await, so a slot recreated in that window is refused instead of taking the write

Disabling the app fence fails test_app_caller_is_refused_with_the_indistinguishable_404, test_an_app_caller_cannot_tell_a_remote_bound_slot_from_a_missing_one and test_missing_slot_and_app_refusal_are_byte_identical.

Task text and ids sent to the model are fenced and canonicalized, and the new fence and TASK CHECKLIST markers are added to _UNTRUSTED_FENCE_RES / _STRUCTURAL_MARKER_RES. The sync and recovery blocks are marked delivered only when a read-proving event arrives.

Tests: 152 pass across test_todo_pill_resync.py, test_todo_list_surface.py and test_json_object_body_guard.py.

On the lane CONCERNS: the design point that a tick is stated to the agent only once is accurate. It trades that against prompt noise, and a cold start re-syncs the list. The first-principles and UX points are about sizing and cosmetics. None of the three blocks.

Non-blocking follow-up, reproduced with a probe on _ChatSlot:

  • What happens: a person ticks and then unticks a row the agent still holds open, which leaves {completed: False, person: True}. untick_survives_rebuild (state.py:4181) then stops the "snapshot agrees" retirement.
  • Effect: when the agent really completes the row, the pill still shows it open with a person mark. A re-tick recovers it.
  • Suggested fix: record the agent's own flag when the override is created, and let an untick outrank an agreeing snapshot only while that flag is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants