Skip to content

[Bug]: Markdown checkbox stays checked on a different entry after a checked item is removed #27338

Closed

Description

@deltafactory

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a Markdown checklist in the right-hand Files panel, in rendered Markdown view.
  2. Check an entry, then let the agent update the file and remove that completed entry while the rendered view remains open.
  3. Observe the unchecked entry that takes its place.

Minimal content before removal:

- [x] Completed item
- [ ] Pending item

After an external/agent edit:

- [ ] Pending item

Expected behavior

Pending item remains visually unchecked, matching the Markdown source.

Actual behavior

The checkmark appears on Pending item even though its source marker is still [ ]. Switching to text view and back to rendered Markdown clears the incorrect checkmark.

The user observed this in a real agent-maintained checklist. The minimal transition above was independently reproduced with React DOM in jsdom using the same relevant Markdown pipeline and input-prop behavior; it was not independently replayed through the packaged app UI.

Impact

Minor bug or occasional failure

A checklist can falsely show an unfinished entry as completed after the agent removes completed entries.

Version or commit

Installed Windows desktop app: 0.1.4-nightly.20261028.3824, commit eb751fa0730d (read from the installed app's package.json).

Environment

Windows, T3 Code Nightly desktop app. The installed compiled ChatMarkdown asset was inspected and contains the same affected input renderer as the source linked below.

Isolated reproduction: Node 22.19.0, React/React DOM 19.3.1, react-markdown 10.1.0, remark-gfm 4.0.1, rehype-raw 7.0.0, rehype-sanitize 6.0.0, jsdom 29.1.1. These are the reproduction's installed dependencies, not a claim that every version matches the packaged application's lockfile.

Diagnosis and supporting reproduction

ChatMarkdown.tsx at the installed commit, lines 1008–1036 passes checked={checked} directly to the input. The shared Markdown pipeline includes rehype-raw and rehype-sanitize.

In the isolated reproduction, the checked item reaches the input renderer as checked: true; the unchecked item reaches it as checked: undefined. Removing the checked row reuses its input for the remaining row. Passing undefined changes the input from controlled to uncontrolled and leaves its DOM checked state true.

Save the following as repro.mjs after installing the dependencies listed above, then run node repro.mjs:

import React from "react";
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
import Markdown from "react-markdown";
import gfm from "remark-gfm";
import raw from "rehype-raw";
import sanitize from "rehype-sanitize";
import { JSDOM } from "jsdom";

const dom = new JSDOM('<div id="root"></div>');
globalThis.window = dom.window;
globalThis.document = dom.window.document;
const root = createRoot(document.getElementById("root"));
const components = {
  input: ({ node, checked, ...props }) =>
    React.createElement("input", {
      ...props,
      checked,
      onChange: () => {},
    }),
};
function render(text) {
  flushSync(() => root.render(React.createElement(Markdown, {
    remarkPlugins: [gfm],
    rehypePlugins: [raw, sanitize],
    components,
  }, text)));
}
render("- [x] Completed item\n- [ ] Pending item");
render("- [ ] Pending item");
console.log(document.querySelector("input").checked); // true: incorrect

Logs or stack traces

The isolated reproduction emits:

A component is changing a controlled input to be uncontrolled.

Candidate fix and verification limits

Normalizing the input prop to checked={Boolean(checked)} makes the remaining item unchecked in the isolated reproduction. Both branches of the renderer should be considered.

No application patch was installed, repository test suite run, or packaged-app UI fix verified. The isolated reproduction demonstrates the specific state-retention mechanism; a repository regression test should cover a checked item being removed ahead of an unchecked item.

Related but different: #15739 and #6524 concern stale file contents. Here the displayed item text updates while the checkbox state remains wrong.

Workaround

Switch from rendered Markdown to text view and back.

Investigated and prepared with GPT-6.1 Sol through the Codex harness in T3 Code.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions