{"version":96,"agent":"pinch","message":"Issue comments over 4000 characters go up in parts: abso issue N --comment (or --comment-file) splits at paragraph breaks, else line breaks or spaces, marks each part (1/3), (2/3)..., never ends a part inside a code block it doesn't close, and puts attachments on the first part. An objection over the limit is refused before anything is sent. The help names the limit.","time":1791643087412,"timeIso":"2026-10-10T14:38:07.412Z","changes":4,"change":1071,"files":["client/src/issues.ts","client/src/main.ts","client/test/comment-parts.test.ts"],"draft":null,"diff":[{"path":"client/src/issues.ts","added":82,"removed":3,"diff":"--- a/client/src/issues.ts\n+++ b/client/src/issues.ts\n@@ -604,11 +604,27 @@\n \tif (str(args, \"attach\") !== undefined && comment === undefined && object === undefined)\n \t\tthrow new UsageError(\"--attach goes with abso issue new or --comment (or --object)\");\n \tif (comment !== undefined || object !== undefined) {\n+\t\t// Refused before anything goes up: an objection is one comment, and a part of one would read as a whole.\n+\t\tif (object !== undefined && object.length > COMMENT_MAX)\n+\t\t\tthrow new UsageError(\n+\t\t\t\t`an objection holds up to ${COMMENT_MAX} characters, and this one has ${object.length}: say it shorter, and put the rest in a --comment`,\n+\t\t\t);\n+\t\tconst parts = object !== undefined ? [object] : commentParts(comment!);\n \t\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));\n-\t\tconst r = await api.issueComment(id, (comment ?? object)!, object !== undefined, attachments);\n+\t\tconst ids: number[] = [];\n+\t\tfor (const [i, part] of parts.entries()) {\n+\t\t\t// The attachments go on the first part, which the rest follow.\n+\t\t\tids.push((await api.issueComment(id, part, object !== undefined, i === 0 ? attachments : [])).id);\n+\t\t}\n+\t\tconst inParts = parts.length > 1 ? ` in ${parts.length} parts (comments ${ids.join(\", \")})` : \"\";\n \t\treturn {\n-\t\t\ttext: `${object !== undefined ? \"Objected\" : \"Commented\"} on issue ${id}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. Its agents hear it.`,\n-\t\t\tjson: { id: r.id, issue: id, ...(attachments.length > 0 ? { attachments } : {}) },\n+\t\t\ttext: `${object !== undefined ? \"Objected\" : \"Commented\"} on issue ${id}${inParts}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. Its agents hear it.`,\n+\t\t\tjson: {\n+\t\t\t\tid: ids[0],\n+\t\t\t\tissue: id,\n+\t\t\t\t...(parts.length > 1 ? { parts: ids } : {}),\n+\t\t\t\t...(attachments.length > 0 ? { attachments } : {}),\n+\t\t\t},\n \t\t};\n \t}\n \tif (bool(args, \"drop\")) {\n@@ -877,3 +893,66 @@\n \t\tjson: { ask: r.ask, ...(lost ? { notKept: lost } : {}) },\n \t};\n }\n+\n+/** What the Issues Worker takes in one comment (its LIMITS.text). */\n+export const COMMENT_MAX = 4000;\n+\n+/** Room a part keeps for its \"(i/n)\" line and blank line, and for closing a code block it ends inside. */\n+const PART_MARK = 12;\n+const FENCE_CLOSE = 5;\n+\n+/**\n+ * A comment too long for one, as parts that each fit, each starting with \"(i/n)\". A part ends at the last\n+ * paragraph break that fits, else the last line break, else the last space, else at the limit. A part that\n+ * would end inside a fenced code block closes it, and the next part opens it again with the same fence line.\n+ */\n+export function commentParts(text: string, max = COMMENT_MAX): string[] {\n+\tif (text.length <= max) return [text];\n+\tconst bodies: string[] = [];\n+\tlet rest = text;\n+\tlet reopen = \"\";\n+\twhile (rest !== \"\") {\n+\t\tconst room = max - PART_MARK - FENCE_CLOSE - reopen.length;\n+\t\tlet body: string;\n+\t\tif (reopen.length + rest.length <= max - PART_MARK) {\n+\t\t\tbody = rest;\n+\t\t\trest = \"\";\n+\t\t} else {\n+\t\t\tconst cut = cutAt(rest, room);\n+\t\t\tbody = rest.slice(0, cut).trimEnd();\n+\t\t\t// A space cut at goes with neither part; the line breaks between paragraphs go too.\n+\t\t\trest = rest.slice(rest[cut] === \" \" ? cut + 1 : cut).replace(/^\\n+/, \"\");\n+\t\t\tif (rest.trim() === \"\") rest = \"\";\n+\t\t}\n+\t\tlet part = reopen + body;\n+\t\tconst fence = openFence(part);\n+\t\tif (fence && rest !== \"\") {\n+\t\t\tpart += `\\n${fence.marker}`;\n+\t\t\treopen = `${fence.line}\\n`;\n+\t\t} else reopen = \"\";\n+\t\tbodies.push(part);\n+\t}\n+\treturn bodies.map((b, i) => `(${i + 1}/${bodies.length})\\n\\n${b}`);\n+}\n+\n+/** Where to end a part of at most `room` characters of `text`: a paragraph break, a line break, a space, or the limit. */\n+function cutAt(text: string, room: number): number {\n+\tconst head = text.slice(0, room);\n+\tconst floor = room / 4;\n+\tfor (const at of [head.lastIndexOf(\"\\n\\n\"), head.lastIndexOf(\"\\n\"), head.lastIndexOf(\" \")]) if (at > floor) return at;\n+\t// Not between the two halves of a character outside the Basic Multilingual Plane.\n+\tconst code = text.charCodeAt(room - 1);\n+\treturn code >= 0xd800 && code <= 0xdbff ? room - 1 : room;\n+}\n+\n+/** The fence line of a code block still open at the end of `text`, and the marker that closes it, or undefined. */\n+function openFence(text: string): { line: string; marker: string } | undefined {\n+\tlet open: { line: string; marker: string } | undefined;\n+\tfor (const line of text.split(\"\\n\")) {\n+\t\tconst m = /^\\s*(`{3,}|~{3,})/.exec(line);\n+\t\tif (!m) continue;\n+\t\tif (!open) open = { line, marker: m[1]! };\n+\t\telse if (m[1]!.startsWith(open.marker) && line.trim() === m[1]) open = undefined;\n+\t}\n+\treturn open;\n+}"},{"path":"client/src/main.ts","added":1,"removed":1,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -457,7 +457,7 @@\n \t\tusage:\n \t\t\t'abso issue <N> --save-attachments <folder> | abso issue <N> --copy-to <project> [--clean <file>] [--dry-run] | abso issue <N> [--comment \"...\" [--attach <file,file>] | --object \"...\" | --drop | --reopen | --done [--done-by <version>]] | abso issue <N> [--title \"...\"] [--description \"...\"] [--parent <N|none>] [--agent <agent|none>] [--blocked-by <N,N|none>] [--label <l,l>] [--unlabel <l,l>] [--notify <who,who> | --quiet] | abso issue new \"<title>\" [--description \"...\"] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>] [--attach <file,file>]',\n \t\tabout:\n-\t\t\t\"One issue: its description, Agent, Blocked by, labels, asks, comments, edits, sub-issues and watchers. --comment comments on it and --object objects; its agents hear either. --drop drops it. --reopen opens a dropped issue again. --done marks it done by hand, and --done-by <version> names the published version that did it. publish --done still marks it done too. --title, --description, --parent, --agent and --blocked-by edit it, and the edit tells its watchers (who opened it, its Agent and agents, its Reviewer, whoever was named in Notify, and whoever commented); --notify tells more people, --quiet tells nobody. --label adds labels and --unlabel takes them off (friction, area:client: lower-case letters, digits and - _ . :); a label-only edit tells nobody unless --notify names people. An issue is Blocked until each issue it's blocked by is Done. abso issue new opens one; --lines ties it to lines at a version of shared, --agent says who it's for, --notify tells people now, and --label labels it. --attach shot.png,after.png puts images on a new issue or a comment (png, jpeg, gif or webp, 10 MB each; the server checks the type by the bytes and takes out metadata such as where a photo was taken. An svg, up to 1 MB, is drawn as a png, and its own file is kept as a download, on servers that take svg), and prints each one's id for the text to point at; the issue's page lists them with a link, and --save-attachments <folder> saves every one on the issue and its comments there as <id>-<name> (an svg's own file too), outside the abso folder or where abso leaves files out. --copy-to <project> copies the issue into another project, with its comments, answered asks and labels, each keeping its author and time; --dry-run shows what would go and writes nothing, and --clean <file> gives cleaned texts by source id as JSON ({title, description, comments: [{id, text}], asks: [{id, question, answer}]}; a comment left out of a given list isn't copied). Copying out of a project on a live server takes an owner of that project. abso issue draft \\\"<title>\\\" [the same fields] saves a draft instead: yours alone, with no number and no news; abso issue draft <D> [fields] changes it, --open opens it as an issue, --delete deletes it.\",\n+\t\t\t\"One issue: its description, Agent, Blocked by, labels, asks, comments, edits, sub-issues and watchers. --comment comments on it and --object objects; its agents hear either. A comment holds up to 4000 characters: a longer --comment (or --comment-file) goes up in parts, split at paragraph breaks and each starting (1/3), (2/3) and so on, and a longer --object is refused before anything is sent. --drop drops it. --reopen opens a dropped issue again. --done marks it done by hand, and --done-by <version> names the published version that did it. publish --done still marks it done too. --title, --description, --parent, --agent and --blocked-by edit it, and the edit tells its watchers (who opened it, its Agent and agents, its Reviewer, whoever was named in Notify, and whoever commented); --notify tells more people, --quiet tells nobody. --label adds labels and --unlabel takes them off (friction, area:client: lower-case letters, digits and - _ . :); a label-only edit tells nobody unless --notify names people. An issue is Blocked until each issue it's blocked by is Done. abso issue new opens one; --lines ties it to lines at a version of shared, --agent says who it's for, --notify tells people now, and --label labels it. --attach shot.png,after.png puts images on a new issue or a comment (png, jpeg, gif or webp, 10 MB each; the server checks the type by the bytes and takes out metadata such as where a photo was taken. An svg, up to 1 MB, is drawn as a png, and its own file is kept as a download, on servers that take svg), and prints each one's id for the text to point at; the issue's page lists them with a link, and --save-attachments <folder> saves every one on the issue and its comments there as <id>-<name> (an svg's own file too), outside the abso folder or where abso leaves files out. --copy-to <project> copies the issue into another project, with its comments, answered asks and labels, each keeping its author and time; --dry-run shows what would go and writes nothing, and --clean <file> gives cleaned texts by source id as JSON ({title, description, comments: [{id, text}], asks: [{id, question, answer}]}; a comment left out of a given list isn't copied). Copying out of a project on a live server takes an owner of that project. abso issue draft \\\"<title>\\\" [the same fields] saves a draft instead: yours alone, with no number and no news; abso issue draft <D> [fields] changes it, --open opens it as an issue, --delete deletes it.\",\n \t\trun: runIssue,\n \t},\n \task: {"},{"path":"client/test/comment-parts.test.ts","added":57,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/comment-parts.test.ts\n@@ -0,0 +1,57 @@\n+// A comment too long for the Issues Worker goes up in parts (abso issue 394): each fits, each says which part it\n+// is, and none ends inside a code block it doesn't close.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { COMMENT_MAX, commentParts } from \"../src/issues.ts\";\n+\n+const paragraph = (n: number) => `Paragraph ${n}. ${\"words go here \".repeat(40).trim()}`;\n+\n+test(\"a comment that fits goes up as it is, with no part marks\", () => {\n+\tconst text = \"x\".repeat(COMMENT_MAX);\n+\tassert.deepEqual(commentParts(text), [text]);\n+});\n+\n+test(\"a longer one is cut at paragraph breaks, each part fits and says which it is, and nothing is lost\", () => {\n+\tconst text = Array.from({ length: 20 }, (_, i) => paragraph(i + 1)).join(\"\\n\\n\");\n+\tconst parts = commentParts(text);\n+\tassert.ok(parts.length >= 2);\n+\tfor (const [i, p] of parts.entries()) {\n+\t\tassert.ok(p.length <= COMMENT_MAX, `part ${i + 1} has ${p.length}`);\n+\t\tassert.ok(p.startsWith(`(${i + 1}/${parts.length})\\n\\n`));\n+\t\t// Each part after its mark starts a paragraph.\n+\t\tassert.match(p.split(\"\\n\\n\")[1]!, /^Paragraph \\d+\\./);\n+\t}\n+\tconst rejoined = parts.map((p) => p.replace(/^\\(\\d+\\/\\d+\\)\\n\\n/, \"\")).join(\"\\n\\n\");\n+\tassert.equal(rejoined, text);\n+});\n+\n+test(\"text with no breaks is cut at spaces, and text with no spaces at the limit\", () => {\n+\tfor (const text of [\"word \".repeat(2000).trim(), \"y\".repeat(9000)]) {\n+\t\tconst parts = commentParts(text);\n+\t\tfor (const p of parts) assert.ok(p.length <= COMMENT_MAX);\n+\t\tconst body = parts.map((p) => p.replace(/^\\(\\d+\\/\\d+\\)\\n\\n/, \"\"));\n+\t\tassert.equal(body.join(text.includes(\" \") ? \" \" : \"\"), text);\n+\t}\n+});\n+\n+test(\"a part that would end inside a code block closes it, and the next part opens it again\", () => {\n+\tconst code = Array.from({ length: 400 }, (_, i) => `const line${i} = ${i};`).join(\"\\n\");\n+\tconst text = `Before.\\n\\n\\`\\`\\`ts\\n${code}\\n\\`\\`\\`\\n\\nAfter.`;\n+\tconst parts = commentParts(text);\n+\tassert.ok(parts.length >= 2);\n+\tfor (const p of parts) {\n+\t\tassert.ok(p.length <= COMMENT_MAX);\n+\t\tconst fences = p.split(\"\\n\").filter((l) => l.startsWith(\"```\")).length;\n+\t\tassert.equal(fences % 2, 0, `a part leaves a code block open:\\n${p.slice(-80)}`);\n+\t}\n+\tassert.match(parts[1]!, /^\\(2\\/\\d+\\)\\n\\n```ts\\n/);\n+});\n+\n+test(\"a character outside the Basic Multilingual Plane is never split in two\", () => {\n+\tconst text = \"😀\".repeat(3000);\n+\tfor (const p of commentParts(text)) {\n+\t\tassert.ok(p.length <= COMMENT_MAX);\n+\t\tassert.doesNotMatch(p, /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/);\n+\t}\n+});"}],"ci":null}