Skip to content

An anchor printed before a part split later resolves to another part and reports exact #2710

Closed

Description

@Birfy

Written-by: Chief

core/src/host/chat-index.js:225 (anchorOf) prints an anchor as #<seq> while the chat has one part and as part N #<seq> only afterwards; :305 (aroundOwnChat) resolves a bare #<seq> to parts[parts.length - 1] — the part that is current now, not the part the anchor was printed from. Once parts.js:973 ends a segment and a fresh part becomes current, every bare anchor a Bot saved and quoted back resolves into the wrong part, and the lookup reports success.

Reproduction (main f36a3e024024541bc141ad27a8ebcfe6e37b6e80)

/data/dsh/bot/workspace/audit47/repro/chat-index-truth.test.mjs, test divergence: an anchor printed without a part number resolves to another part (real chat-index.js, temp home, real chat-index.sqlite, fake Session log):

  • part 1 holds seq 2 = "the url is https://example.test/xyz keep it"; the anchor printed at that moment is #2;
  • a segment ends and part 2 becomes current;
  • read_own_chat around "#2" returns part 2's seq 2 and says exact: true.

Control in the same file: the same lookup written as "part 1 #2" reaches the real source. That is also the one-line fix — always print the part number.

Why it matters

The anchor is the tool's own citation: a Bot quotes [#2 · 10-08 14:22] in its answer and later looks it up to check what it said. With the bare form it silently gets a different message from a different part and cannot tell — exact: true is the worst possible answer here. A conversation that grew past its first part is the normal case, not an edge.

Expected

anchorOf always prints part N #<seq> (the form aroundOwnChat already resolves exactly), so an anchor names the part it came from from the first message onward. A bare #<seq> in an older anchor keeps resolving as it does today for compatibility, and the reader says so when it had to guess rather than claiming exact.

Change scope

core/src/host/chat-index.js (anchorOf, and aroundOwnChat's fallback so a guessed part is not reported as exact), the tests in core/test/ that assert the current anchor text, and any doc line that shows the anchor format.

Activity

  1. added
    bugSomething isn't working
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:automationScheduled tasks and automation
    on Nov 8, 2026
  2. self-assigned this
    on Nov 8, 2026
  3. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    and removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Nov 8, 2026
  4. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Nov 8, 2026
  5. added 2 commits that reference this issue on Nov 9, 2026
    f5d2e76
    4c8ec30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationScheduled tasks and automationbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions