Skip to content

fix(platform): name the title limit when task_create refuses - #3529

Merged
yannickmonney merged 1 commit into
mainfrom
fix/task-create-title-limit
Sep 27, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/task-create-title-limit

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What changed

An agent's task_create with a title over 200 characters went all the way to agentCreateTaskTrusted. There validateTitle refused it as a bare TASK_TITLE_INVALID, and the bridge relayed:

{"status":"invalid_args","message":"TASK_TITLE_INVALID: the domain refused these arguments."}

The model could not tell what to change. With a parentTaskId it got not_found instead, because the parent's scope read ran before anything looked at the title.

  • Refusal at the tool boundary (workspace_domain_tools.ts): the task_create branch refuses a title longer than TASK_TITLE_MAX right after the non-empty check, before any read or mutation. It measures the trimmed title, as validateTitle does, so the tool refuses nothing the domain would take:
    {"status":"invalid_args","message":"The task title is capped at 200 characters (this one has 209) — shorten it and put the detail in \"description\"."}
  • Signature (workspace_tools_bridge.ts): workspace_status now lists title: string (≤ 200 characters). Both strings read TASK_TITLE_MAX from core/tasks/helpers.ts, where the task limits live, so they cannot drift from the domain.
  • Tests:
    • Unit (workspace_tools_bridge.test.ts):
      • An over-long title is refused with the limit and the length. Neither the parent read nor agentCreateTask runs.
      • A title of exactly 200 characters with surrounding whitespace reaches the domain trimmed.
      • The signature states the limit.
    • Integration: checkAutomationRunToolLane sends one over-long title through the real /api/tools/execute door and checks that no card is written.
  • Coverage map: a row in tests/manual/reference/automation.md.

task_upsert_by_external_ref is unchanged. It truncates an over-long title on purpose (truncateImportedTitle), and an empty title is already refused at its boundary.

Refs #3155. That issue's acceptance is now met on the public tree. Empty and whitespace-only titles were already refused at the tool boundary with a message, this PR covers the over-max case, and the tool path records no error event (the refusal is returned as a result, not thrown). Its fix direction 1 names the Convex overlay, which has since been retired. I left closing the issue to a maintainer.

How I verified it

  • bunx vitest run --project server on workspace_tools_bridge.test.ts, domains/sandbox/dispatch-routes.test.ts and domains/sandbox/shim.test.ts: 72/72 passed.
  • Unit negative control: with origin/main's two implementation files and the new tests kept, 2 of the 3 new tests fail. The over-long call answers not_found, and the signature lacks the limit. The boundary test passes there too, which is intended: it guards against refusing too much.
  • backend:integration, filtered run (ITEST_LANES=checkAutomationRunToolLane) on a local PG 16 + pg_search + pgvector cluster:
    • The new check passes. The door answers the message above, and 0 rows land.
    • On origin/main's implementation it fails, with the door answering TASK_TITLE_INVALID: the domain refused these arguments..
    • Two other checks in the same lane, automation-run tool lane and document_create authority, fail identically on origin/main. Every document_create answers invalid_args because this sandbox has no S3 endpoint: the lane's blob store is only seeded with ITEST_S3_ENDPOINT. This is environmental and has nothing to do with this change.
  • Type-check: tsc on a scoped config over the changed files plus dispatch-routes.ts and integration-check.ts is clean.
  • Lint and SAST:
    • oxlint --type-aware on the four TS files is clean.
    • oxfmt --check is clean.
    • tools/opengrep/run.sh on the changed files reports 0 findings.
    • bun run lint:manual passes.
  • The workspace-wide gates (full tsc, bun run check, the full suites) are left to CI. The sandbox's 4 GB cap cannot run them.

Left open

  • task_create's description over TASK_DESCRIPTION_MAX (20,000) still comes back as the bare TASK_DESCRIPTION_INVALID. The same pre-check would fix it; it was outside this task.
  • The domain's validateTitle still throws 'Invalid title' with no limit. The agent path no longer reaches it for length. The REST door refuses a long title as must be at most 200 characters, and the app form caps input with maxLength.

An agent's task_create with a title over 200 characters reached the
domain, which refused it as a bare TASK_TITLE_INVALID. The bridge relayed
"TASK_TITLE_INVALID: the domain refused these arguments.", so the model
could not tell what to change. With a parentTaskId the parent's scope
read ran first and answered not_found instead.

The task_create branch now refuses a title longer than TASK_TITLE_MAX,
measured trimmed as validateTitle measures it, before any read or
mutation. The invalid_args message names the limit and the title's
length. The tool signature states "title: string (≤ 200 characters)",
and both read the shared constant.

Unit tests cover the over-long refusal, the exact-limit boundary and the
signature. The automation-run tool lane checks the refusal through
/api/tools/execute on real Postgres and that no card is written.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant