Repository navigation
Conversation
bot_schedules built each row as one line of text and inserted the task's title verbatim, so a title carrying a line break painted a second row that read exactly like a real one; a model can produce that by accident in a schedule-create call (ThinkFlowLab#3197). The title is folded with the single-line rule the rest of the host keeps, before it reaches the row. The stored record is unchanged, and the 120-character bound now counts the folded text a reader sees.
|
@Birfy review request for a T2 verdict at tip What this slice changes: At this tip: 14 success + 2 skipped + 1 failure — the failure is Red first on base One honest note on UI surface: none — this is host answer text, no client change (owner rule wants that stated in the verdict). Boundaries: no change to what |
|
Independent reproduction (advisory, no request attached). A second engineer re-ran the defect on base One task, two rows, and the forged row starts with One nuance worth recording for the verdict: a bare The two bases agree on the file: |
Fixes #3197
Written-by: Dev-1
Owner: Dev-1
Reviewer: Reviewer
Tier: T2
Claim-Id: b0d679d36579489b83dd42ecdd25dd61
Base: 0f7e821
What
bot_schedulesbuilds each row as one line of text and inserted the task's title verbatim, while the only thing that ever touched it wascontentOf'strim(). A title carrying a line break therefore painted a second row, and the forged line read exactly like a real one — a model can produce that by accident in aschedule-createcall.The name is now folded to one line before it reaches the row, with the same rule the rest of the host keeps (
tasks.js'soneLine): control characters become a space, runs of whitespace collapse, the ends are trimmed. A clean title's row is byte-identical to before. The stored record keeps whatschedule-createwas given —bot_schedulesis the one place that folds before printing, so no stored row is rewritten. The 120-code-point bound now counts the folded text a reader sees: a name of line breaks cannot be refused for characters the answer folds away, and folding still cannot let a longer name through.Red first (base 0f7e821, only the new assertions, source untouched)
$ cd core && TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/schedules.test.jsThe first two fail on
rows.length 2 !== 1; the third on the folded 111-character name being refused as over 120 because the bound counted the raw title.Ran
# tests 47 / # pass 47 / # fail 0TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/schedules.test.js test/quiet-hours.test.js→ 56/56TMPDIR=/tmp node scripts/ds-bot-patches.mjs generate→ rewrotepatches/ds-bot/0001-core-fixes.patchTMPDIR=/tmp node scripts/ds-bot-patches.mjs check→ 3 lines okTMPDIR=/tmp node scripts/ds-bot-patches.mjs canonical→ok patches/ds-bot/ is what generate writes (generate is a no-op)ARCH_DOCS_BASE=0f7e82121832d4cea8e26f1e9681355100432df7 node core/scripts/check-arch-docs.mjs→arch-docs: OK (5 changed file(s))Verify
TZ=UTC TMPDIR=/tmp npm run verifyends red with exactly two failures, both incore/test/bench-preflight.test.js:bench.sh refuses before writing the profile when pnpm is missingandbench.sh shows a failed pnpm install and leaves no half-built profile. The samefile fails the same two on a clean, unmodified
0f7e8212tree 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/pnpmand/bin -> /usr/binPATH reason, so this changedoes not move it. Everything else in verify is green (3344 pass).
Not run
Files
core/src/host/schedules.js,core/test/schedules.test.js,docs/subsystems/core-host.md,changelog.d/3197.fixed.md,patches/ds-bot/0001-core-fixes.patchCheckpoint
{ "pr": 3200, "claim": "Dev-1", "issue": 3197, "summary": "bot_schedules built each row as one line and inserted the task's title verbatim, so a title carrying a line break painted a second row that read like a real one. The name is now folded to one line before it reaches the row, with the rule the rest of the host keeps; a clean title's row is byte-identical. The stored record keeps what schedule-create was given, and the 120-code-point bound counts the folded text instead of the raw title.", "files": [ "core/src/host/schedules.js", "core/test/schedules.test.js", "docs/subsystems/core-host.md", "changelog.d/3197.fixed.md", "patches/ds-bot/0001-core-fixes.patch" ], "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 (5 pass / 2 fail) in a clean 0f7e8212 tree here", "at": "18ff9f8989eb28c2e085bf1d08fdb70b0357f1db" }, "next": "none — ready for review" }Counting and what the fold drops (README for the verdict)
MAX_TITLEis still120; nothing was raised to make a case pass. What changed is what the bound counts: the folded text the row prints, not the raw stored string.codePoints(fold(title)) > MAX_TITLE— so a title carrying 50 line breaks is no longer refused for 50 characters that the row never shows, and a 160-character name whose folded form is 111 is accepted because 111 is what a reader sees. A name whose folded form is over 120 is still refused, as before.schedule-createstores exactly what it was given; the fold happens only inbot_scheduleswhile drawing the row, so the settings page and every other reader still see the original name. No stored row is rewritten, and no character is deleted from the answer's source — control characters are substituted with a space and runs of whitespace collapse, which istasks.js'soneLinerule that the rest of the host already uses.\nor\r, and the test asserts the answer's row count stays 1 for both a newline and a bare CR title, not merely that the title contains a break.