Skip to content

read_own_chat in a read-only window says where its index stops - #3195

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/1-readonly-index-stop
Nov 20, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/1-readonly-index-stop

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3194

Written-by: Dev-1
Owner: Dev-1
Reviewer: Reviewer
Tier: T2
Claim-Id: f03c18d9cfb94c20b18270535e7bad41
Base: 0f7e821

What

A second dsh window on one team folder is read-only: chat-index.js catchUp returns at once when the index is not writable, so read_own_chat answers with the rows the writer window indexed. When that writer has not caught up with a part's log — the user is still talking, or it stopped before indexing its last messages — the newest lines are missing, and more: 0 made the read look like the whole chat ("Nothing in your own chat mentions …", "Your own chat is empty.").

The read now checks freshness: indexStop() compares each part's marks.through with the log's own last seq (agent.session.seq - 1) in a non-writable index and returns { at }, built from the newest indexed row time (newestTime over the read's sessions). searchOwnChat, latestOwnChat and aroundOwnChat carry it beside their lines as stop, and read_own_chat appends one sentence to every answer — the bare read, the search (including Nothing in your own chat mentions …), the anchor read and Your own chat is empty. — naming the time the index stops at and saying a message after it is not in this answer. A caught-up window answers byte for byte as before (stop is absent), and the check costs one resolveAgent per part, no log page.

The read-only window does not read the log tail to fill the gap: the index belongs to the writer, and a second read path is out of scope. The write path (catchUp, the mark) is untouched.

Red first (base 0f7e821, only the new assertions, source untouched)

$ cd core && TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/chat-index-writers.test.js

not ok 3 - a read-only window reads the index and leaves it alone (#2711)
not ok 4 - a read-only window reads the index while the writer still holds the home (#2711)
  expected: 'string'
  actual: 'undefined'      (read.stop?.at, test/chat-index-writers.test.js:276 and :302)
# tests 11
# pass 9
# fail 2

Ran (at 9cf96cb, tree e95d983c5b)

The push path rebuilt this head from the local verified commit 1d6f2a3751264e94b94183a5a9a31664945cc506
(the same tree, e95d983c5b); the commands below ran on that tree, and CI runs them again on this head.

  • the same command after the fix → # tests 11 / # pass 11 / # fail 0
  • TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/chat-index-writers.test.js test/own-chat-read-window.test.js test/own-chat-parts-index.test.js test/own-chat-read-parts.test.js test/chat-anchors.test.js test/group-work.test.js → 48/48
  • TMPDIR=/tmp node scripts/ds-bot-patches.mjs generate → rewrote 0001/0012 and the test mirror
  • TMPDIR=/tmp node scripts/ds-bot-patches.mjs check → 3 lines ok
  • TMPDIR=/tmp node scripts/ds-bot-patches.mjs canonical → ok patches/ds-bot/ is what generate writes (generate is a no-op)
  • ARCH_DOCS_BASE=0f7e8212 node scripts/check-arch-docs.mjs → OK (8 changed file(s))

Verify

TZ=UTC TMPDIR=/tmp npm run verify ends red on this box with exactly two failures, both in
core/test/bench-preflight.test.js: bench.sh refuses before writing the profile when pnpm is missing and bench.sh shows a failed pnpm install and leaves no half-built profile. The same file
fails the same two tests on a clean, unmodified 0f7e8212 tree here — cd core && TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/bench-preflight.test.js → # tests 7 / # pass 5 / # fail 2 — for the documented /usr/bin/pnpm and /bin -> /usr/bin PATH reason, so this change
does not move it. Everything else in verify is green (3341 pass).

Not run

  • the smoke bench: this changes a read answer's sentence and adds a read-side check; no tool registration, channel endpoint, client or write path changed.

Files

core/src/host/chat-index.js, core/src/host/groups.js, core/test/chat-index-writers.test.js, docs/subsystems/core-host.md, changelog.d/3194.fixed.md, patches/ds-bot/0001-core-fixes.patch, patches/ds-bot/0012-room-membership.patch, patches/ds-bot/files/test/chat-index-writers.test.js

Checkpoint

{
  "pr": 3195, "claim": "Dev-1", "issue": 3194,
  "summary": "A read-only window's read_own_chat answered with the rows the writer had indexed, and when the writer lagged the newest messages were missing while more: 0 read as the whole chat. indexStop() now compares each part's mark with the log's last seq, the three reads carry stop: { at }, and read_own_chat appends one sentence naming where the index stops to every answer. A caught-up window answers byte for byte as before, and the write path and the index file are untouched.",
  "files": ["core/src/host/chat-index.js", "core/src/host/groups.js", "core/test/chat-index-writers.test.js", "docs/subsystems/core-host.md", "changelog.d/3194.fixed.md"],
  "checks": { "ran": "TZ=UTC TMPDIR=/tmp npm run verify", "result": "red", "why": "the only two failures are bench-preflight's pnpm/PATH tests, which fail the same way on a clean 0f7e8212 tree here (5 pass / 2 fail)", "at": "9cf96cb202be822ec04ebccb3529d69f3d1f7e09" },
  "next": "none — ready for review"
}

A window another host keeps read-only adds nothing to the chat index, so it answers
with the rows that host indexed. When the writer has not caught up with a part's log —
the user is still talking, or it stopped before indexing its last messages — the newest
lines are missing, and `more: 0` made the read look like the whole chat. The three reads
now carry `stop: { at }` and `read_own_chat` says where the index stops, so a missing
message reads as newer than the cut instead of never said (ThinkFlowLab#3194).

Fixes ThinkFlowLab#3194
@HugoXK
HugoXK marked this pull request as ready for review November 19, 2026 01:04
@HugoXK

HugoXK commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request for a T2 verdict at tip 9cf96cb202be822ec04ebccb3529d69f3d1f7e09 (tree e95d983c5b).

What this slice changes: in a window whose chat index is readable but not writable, chat-index.js catchUp returns at once, so read_own_chat answered with whatever the writer window had indexed. A message already in the log but past that mark simply disappeared from the answer, and more: 0 still made the read look complete (live main: the 4th line was in the log, the mark stopped at seq 2). The read side now compares each part's marks.through with the log's own last seq in a non-writable index and returns a stop point; read_own_chat appends one sentence naming the time and saying a message after it is not in this answer — on the bare read, the search (including the "Nothing in your own chat mentions …" answer), the anchor read and the empty chat. A caught-up window answers byte for byte as before.

At this tip: 15 success + 2 skipped + 1 failure — the failure is enqueue-guard saying no Verdict names this tip yet, which is the T2 gate itself. tests-ok, judge, merge-gate, policy-sign are success.

Red first on base 0f7e8212 (the branch was rebased onto it after #3191 touched the same test file and patches/ds-bot/0001; the earlier 9dc8e9fc reading was discarded):
not ok 3 - a read-only window reads the index and leaves it alone (#2711) and not ok 4 - a read-only window reads the index while the writer still holds the home (#2711), both expected: 'string', actual: 'undefined' (read.stop?.at), # tests 11 / # pass 9 / # fail 2.

Green at this tip: that file 11/11; chat-index-writers + own-chat-read-window + own-chat-parts-index + own-chat-read-parts + chat-anchors + group-work 48/48; ds-bot-patches generate re-run, check three lines ok, canonical no-op.

One honest note on TZ=UTC npm run verify: it exits red, and the two failing cases are bench-preflight's pnpm/PATH environment pair — they fail the same way (5 pass / 2 fail) in a clean 0f7e8212 worktree, so they are unrelated to this change; the other 3341 tests pass.

UI surface: none — this is host answer text, no client change (owner rule wants that stated in the verdict).

Boundaries: the write path is untouched (no index write, catchUp behaviour and the mark unchanged); the read-only window does not read the log tail to fill the gap (that would be a second read path and a separate decision); the searchHomeChat panel's own read is untouched. No gate files, core/client.js or patches/ds-bot/0008 in the diff.

@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Nov 19, 2026
@Birfy

Birfy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 9cf96cb
Written-by: Reviewer
Attestation: 9cf96cb role=Reviewer

Ran at this tip:

$ node dl.mjs 9cf96cb202be822ec04ebccb3529d69f3d1f7e09 tip.tar.gz
$ node dl.mjs 540a307a7a1f44cb570b408850166fc548a61691 main.tar.gz
$ node dl.mjs 0f7e82121832d4cea8e26f1e9681355100432df7 base.tar.gz
$ git init mg && git commit base && git commit main && git commit tip && git merge tip-into-main
$ cd core && npm ci --include=dev
$ node core/scripts/build-client.mjs --check
$ node scripts/ds-bot-patches.mjs check
$ node scripts/ds-bot-patches.mjs canonical
$ git show main^1:core/src/host/chat-index.js > core/src/host/chat-index.js
$ git show main^1:core/src/host/groups.js > core/src/host/groups.js
$ TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test test/chat-index-writers.test.js
$ TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test test/chat-index-writers.test.js test/own-chat-read-window.test.js test/own-chat-parts-index.test.js test/own-chat-read-parts.test.js test/chat-anchors.test.js test/group-work.test.js
$ TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test --test-concurrency=4 --test-timeout=120000 "test/*.test.js"
$ node .github/scripts/changelog.mjs check && node .github/scripts/check-mojibake.mjs --check
# tests 3345  # pass 3336  # fail 7

Red first, run on the merge result with only core/src/host/chat-index.js and core/src/host/groups.js put back to main's blobs and the new tests kept: # tests 11 / # pass 9 / # fail 2 — not ok 3 and not ok 4, expected: 'string', actual: 'undefined' at typeof read.stop?.at (the two read-only-window cases). Source restored, same file 11/11, and the six affected files 48/48. The new assertions are red without the implementation and green with it.

Full core suite on the merge result: 3345 tests / 3336 pass / 7 fail; all 7 reproduce identically on a clean 540a307a tree without this PR — the six client-bundle files (activity-row-host, client-cut-sites, composer-label, header-effects, read-page, thinking-row) and check-arch-docs's "empty diff passes" — environment (no built client bundle, no base ref in a tarball tree), not this diff.

Route: ready — the tip merges cleanly into main 540a307a7a1f44cb570b408850166fc548a61691 (git 3-way merge, no conflicts, same 8 files +225/−60), so no replay PR is needed.

Generated artifacts, on the merge result: build-client.mjs --check rc 0; ds-bot-patches.mjs check → pin ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5), 10 patches apply cleanly in order, core/ equals ds-bot/ + patches/ds-bot/; canonical → ok patches/ds-bot/ is what generate writes (generate is a no-op); git status --porcelain empty. Both rewritten patch files (0001, 0012) carry the generated form, not a hand copy.

Scope: 8 files, changelog.d/3194.fixed.md present and changelog.mjs check ok (6 fragments well formed), check-mojibake --check ok. No core/client.js, no patches/ds-bot/0008, no #3112 file, no gate file. Semantics stay the author's: indexStop() only reads (marks.through against agent.session.seq - 1, the newest indexed row time), the write path and the mark are untouched, and the assertions got stricter rather than looser (typeof read.stop?.at === 'string', plus a new caught-up case asserting stop === undefined and pages() === 0).

Tip check-runs (9cf96cb): 21 runs, 18 success + 2 skipped (window check, live · real model) + 1 failure, enqueue-guard (no Verifier report names the tip …), which is this gate. tests-ok, merge-gate, policy-sign, judge, package and the four plugins jobs are success.

UI surface: none — host answer text only, no client change.

@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 20, 2026
@github-actions github-actions Bot added the pass label Nov 20, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 20, 2026
Merged via the queue into ThinkFlowLab:main with commit 8f56c74 Nov 20, 2026
22 checks passed
@Birfy
Birfy deleted the dev/1-readonly-index-stop branch November 20, 2026 03:36
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_own_chat in a read-only window answers more: 0 while its chat index stops at an older point — nothing says the answer stops there

2 participants