Repository navigation
fix(platform): name every refused limit in task tools and doors - #3546
Merged
Merged
Conversation
The workspace-tool bridge kept only the code of a domain refusal. An agent's task_create with a description over 20,000 code units or a label over 50 came back as "TASK_DESCRIPTION_INVALID: the domain refused these arguments.", so the model could not tell which limit it broke. The domain threw one "Invalid title" for an empty and an over-long title on the human create and edit paths, and the tasks app door dropped the domain's message altogether. - core/tasks/helpers.ts now holds the refusal sentences beside the limits. Each names the cap, the unit every cap is measured in (UTF-16 code units, where most emoji count as 2) and the length measured, never the value. validateTitle tells an empty title from an over-long one, and the description, label count, label name and comment caps are named. - toolResultFromError relays the domain's sentence beside the code, and nothing else from the refusal's payload. - The agent-comment writer moves into the coded write shim, so an over-long comment answers invalid_args instead of error. - workspace_status states every cap of task_create, task_comment and task_upsert_by_external_ref from the shared constants, in code units. - The tasks app door answers a domain refusal with its message, and an empty title on create reaches the domain instead of a bare invalid body. Closes #3155
asAppError translated every error carrying a string code and a numeric status, so a MentionDirectoryError (503) on an agent comment reached the model as invalid_args and was audited so. Only a 4xx refusal is translated now; a coded 5xx stays a plain error and answers `error`.
…ence A blank or whitespace-only title at the tool door still answered the generic 'needs a non-empty "title" string', naming neither the range nor its unit. It now answers taskTitleRefusal's empty sentence, the one the domain's validateTitle throws; a missing or non-string title keeps the generic text.
The tasks door's schema carried caps of its own above the domain's (a
title up to 500, a description up to 50,000, up to 100 labels, a comment
min(1)), and anything it refused answered a bare `invalid body` that
could not tell an empty title or comment from an over-long one. The
title, description, label count and comment body are now checked with
the domain's own refusal helpers and answer `{error: <code>, message}`,
before a rate-limit slot is spent.
A task refusal's sentence now reaches the app door and an agent's tool result, yet SETUP_FOLDER_MISSING echoed the setup folder name it was sent. The sentence names the rule instead, and a guard reads every TaskError, TaskReviewError and task-domain ProjectError message so a new interpolated value fails until it is made static or reviewed.
The REST reference and the house schema messages said "characters" for the task title, description, label, comment and translation caps, which count UTF-16 code units like the domain's refusals. The schema messages and the en/de/fr reference now name the unit.
The row for named task limits now covers the app door's schema, the empty task_create title, a coded outage staying `error`, the value-free setup-folder refusal with its guard, and REST's unit wording.
yannickmonney
added a commit
that referenced
this pull request
Sep 28, 2026
Follow-up to #3546. A blank task_comment body or task_upsert_by_external_ref title now answers the shared empty sentence at the tool door. The app's label create/rename and from-external-issue schemas answer the domain's sentences instead of their own caps. The upsert cuts an over-long description to 20,000 UTF-16 code units ending in "…", as it cuts a title; the signature says so. The refusal guard also reads the ProjectErrors a task door reaches. The REST reference names the description, label and comment-body caps in that unit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Follow-up to #3529.
toolResultFromErrorinworkspace_domain_tools.tskept only the code of a domain refusal. Every other refused limit therefore reached the agent without its number. This is what/api/tools/executeanswered onorigin/main(Postgres,checkAutomationRunToolLane):{"status":"invalid_args","message":"TASK_DESCRIPTION_INVALID: the domain refused these arguments."} {"status":"invalid_args","message":"TASK_LABELS_INVALID: the domain refused these arguments."} {"status":"error","message":"Invalid comment body"}The comment answered
error, which reads as "try again": the agent-comment writer was the one write-shim handler outside the coded translation. On the human side,validateTitlethrew the sameInvalid titlefor an empty title and an over-long one. The tasks app door also dropped the domain's message and answered{"error":"TASK_TITLE_INVALID"}alone.The same calls on this branch:
{"status":"invalid_args","message":"TASK_DESCRIPTION_INVALID: The task description is capped at 20,000 UTF-16 code units (most emoji count as 2); this one has 20,001."} {"status":"invalid_args","message":"TASK_LABELS_INVALID: A label name is capped at 50 UTF-16 code units (most emoji count as 2); this one has 56."} {"status":"invalid_args","message":"TASK_COMMENT_INVALID: The comment is capped at 10,000 UTF-16 code units (most emoji count as 2); this one has 10,001."}core/tasks/helpers.ts, where the limits already live):The task title is empty — it takes 1 to 200 UTF-16 code units.An over-long one readsThe task title is capped at 200 UTF-16 code units (most emoji count as 2); this one has 201.validateTitle,validateDescriptionandnormalizeLabelNames(domains/tasks/service.ts) throw these sentences under their existing codes, so no code changes.comments.ts) do the same.toolResultFromErroranswersinvalid_argsas<CODE>: <domain sentence>. Only the sentence travels, capped at 400 characters, and never any other field of the refusal. A refusal that carries no sentence keeps the old generic text.agentAddCommentmoves fromsandbox/shim.tsintoworkspace-write-shim.tsbehindcoded(), like its sibling writers.coded()translates only a 4xx refusal. A coded 5xx stays a plain error and answerserror, notinvalid_args. An example is aMENTION_DIRECTORY_UNAVAILABLE503 on a comment.task_createtitle answers the domain's empty sentence (… is empty — it takes 1 to 200 UTF-16 code units.). A missing or non-string title keeps the generic text.taskTitleRefusal, so the tool door and the domain cannot drift apart.workspace_tools_bridge.ts):workspace_statusstates every cap, built from the shared constants:task_create: title ≤ 200, description ≤ 20,000, and labels (the first 20 are kept, each ≤ 50).task_comment: body ≤ 10,000, and at most 16 locales inbodyByLocale.task_upsert_by_external_ref: says an over-long title is cut to 200, ending in "…". It is not refused, which is intended.bodyByLocalerefusal names both of its caps from constants.TASK_COMMENT_LOCALES_MAXis new, inlib/shared/schemas/task-comment.ts.String.length, which is UTF-16 code units: the dialog'smaxLength, the REST zod schemas and the domain. So this PR names that unit instead of "characters", as the REST chatcontentcap already does (evaluation J2-1). No limit changes./api/app/tasks):handleErroranswersTaskError/ProjectErroras{error: <code>, message, data?}. That is the shape the same function already used forTaskReviewErrorandAutomationError, and the oneappErrorResponsedocuments. The sentences are the domain's own prose..min(1)), and they answered a bareinvalid body. An empty or over-long value now answers{error: <code>, message}, however far past the cap. The check runs before a rate-limit slot is spent.SETUP_FOLDER_MISSINGno longer repeats the folder name that was sent.domains/tasks/errors.test.tsreads everyTaskError,TaskReviewErrorand task-domainProjectErrormessage with the TypeScript AST. A new interpolated value fails the test until it is made static or reviewed onto its list.must be at most 200 UTF-16 code units, not "characters". The en/de/fr API reference names the unit for the title and comment caps.#3155's acceptance holds on the public tree:
"", whitespace-only and over-long titles each get a structured refusal naming the constraint.How I verified it
--project server,--maxWorkers=2): 71 files, 841 tests, all green. They are every test underdomains/tasks,domains/sandboxandcore/tasks, the bridge, and each test that imports a changed module (v1-tasks,error-codes,platform-tasks,task-store,spec, …). New tests:core/tasks/helpers.test.ts: the sentences. Also emoji measured in code units (100 🎯 fit, 101 report 202), and a decomposed label measured NFC-composed as the catalog stores it.domains/tasks/service.limits.test.ts:createTask/updateTask/agentCreateTaskTrusted. An empty vs over-long title, a description over the cap, and a label over 50, with no write.domains/tasks/comments.limits.test.ts: the comment post and edit.domains/tasks/routes.limits.test.ts: the app door runs the real domain on a stub connection.""and" "both answer the empty sentence, and 201 characters answer the over-long one, on create and on edit.domains/sandbox/workspace-write-shim.test.ts: the real writers behind the shim. Each answers{code, message}for a description, a label and a comment over the cap.workspace_tools_bridge.test.ts: the relay itself, including "no payload beside the sentence" and "generic text when there is no sentence". Also the signatures, which must never say "characters".origin/main's eight implementation files and the new tests kept, 26 tests fail. The only new or changed tests that pass there should pass on both sides: the fallback-sentence guard, and the pure helper tests, whose module the control keeps.backend:integration, filtered run on a local PG 16 + pg_search + pgvector cluster (ITEST_LANES=checkAutomationRunToolLane,checkTasks,checkTasksCollabIntegrity): 42 pass./api/tools/execute. It gets the three answers above, and no card, label or comment is written.origin/mainboth checks fail. The three calls answer the "before" block above, and the title refusal still says "capped at 200 characters".origin/mainand here:automation-run tool laneanddocument_create authority.document_createneeds an S3 endpoint (ITEST_S3_ENDPOINT), which this sandbox does not have.tscon a scoped config over every changed file plusdispatch-routes.tsandintegration-check.ts: clean.oxlint --type-awareandoxfmt --checkon the changed files: clean.tools/opengrep/run.sh: 0 findings.bun run lint:manual: passes.knip --workspace services/platform: only the existingoidcOrganizationClaims.tsc,bun run check, the full suites) are left to CI. The sandbox's 4 GB cap cannot run them.origin/main):--project serveroverdomains/{sandbox,tasks},core/tasks,core/node_only/sandbox,rest,lib/connectors/natives,lib/shared/schemasandscripts/openapi: 123 files, 2,159 tests, all green.tsc --noEmit: clean.oxlint --type-awareon the changed files: clean.bun run lint:manual: passes.SETUP_FOLDER_MISSINGmessage is put back.Left open
task_upsert_by_external_refstores a description of any length.upsertTaskByExternalRefhas no cap, while the REST intake refuses one over 20,000. Refusing it, or cutting it like the imported title, is a product call, so the signature states no cap for it.maxLength. Showing the limit needs localized copy (en/de/fr), not the server's English sentence.label-editor.tsxandlabel-manage-dialog.tsxdeclare their ownMAX_LABEL_LENGTH = 50instead of importingTASK_LABEL_CHARS_MAX.Closes #3155