grep/read: line preview starts at column 0, hiding the match it just reported #4982
Replies: 3 comments 1 reply
会话 / 历史(「grep/read: line preview starts at column 0, hiding the match it just reported」)会话数据一般在用户目录下的 dsh 数据路径(随版本可能是
不要只拷单个 |
|
Confirmed on master (c291e79). Both tools still cut the preview from column 0, so a match past the window is
Your incident (17-step false theory from Workarounds for the model today: for single-line/minified files, have the agent extract the region with the shell |
|
Thanks! To be precise, reporting issues isn't forbidden — it's explicitly So please keep reporting. The small doc win I suggested above (tool |
Uh oh!
There was an error while loading. Please reload this page.
Labels:
bugtoolsagent-reliabilitySummary
grepreportsFound N matchand then renders at mostGREP_MAX_LINE_BYTES = 2000(
packages/fs/tool-fs-search/src/grep.ts:36) of the matched line, starting from thebeginning of the line (
previewLine,search-core.ts:318-324), ending with(line truncated). For a minified JSON file — which is one line — the match can bepast the window, so the tool simultaneously asserts the text exists and shows none of it.
readhas the same shape:READ_MAX_LINE_LENGTH = 2000(
packages/fs/tool-fs/src/read-render.ts:11), marker... (line truncated to 2000 chars).read'soffset/limitcount lines, so paging cannot reach the match either: for aone-line file, any
offsetyields the same truncated first line.Consequence observed in production
In a recorded runaway session the agent ran
grep '"glm-5'against an 8208-byte single-lineprovider catalog whose first match sat at offset 2393 — 393 bytes past the window. The
tool said
Found 1 match; the agent wrote "确认 catalog 里根本没有 glm-5.x", then built anelaborate (false) theory that the settings validator never runs, and told the user their
working configuration "可能根本没真正工作过". The correct fix was already in its hands one
step earlier. That is a 17-step detour caused by output formatting.
Suggested fix
match column, or print
offset=<n>alongside the truncation marker so the reader knowsbytes were skipped before the match.
--around-matchwindow ofkbytes centred on the match.and that a match may be outside the visible window, so
Found N matchis itselfevidence of presence.
Reproduction
Actual:
Found 1 match+ first 2000 bytes +(line truncated);"glm-5.1"not shown.All reactions