worker: prompt-too-long hint is code-flow-specific; misleading for design agents #95

Closed
opened 2026-04-19 17:42:16 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As the operator debugging a failed run, I want the prompt-too-long hint in the service log to point at the real cause for the agent that failed, not a one-size-fits-all rule. Right now it sends designers down a rabbit-hole that doesn't apply to them.

What happens today

src/worker.ts:217–228 catches "prompt is too long" / "context_length_exceeded" and emits a fixed hint:

prompt-too-long failure on <repo>#<issue> — skills must use Edit/Write + git CLI
for code changes, not mcp__forgejo__update_file / create_file / delete_file (see #79)

That hint is code-flow-specific. It's the right rule for dev / boss / reviewer (where overflow was first observed: dev feeding an entire 400-line file as mcp__forgejo__update_file content — #79).

When designer overflows — as observed today on task d3883982 (#70) — the root cause is Penpot MCP accumulation (100+ create_frame / create_text round-trips), not a misuse of any forgejo file tool. The hint points at an irrelevant skill rule and covers the actual cause (raise context window / compact history).

Acceptance criteria

Code

  • src/worker.ts splits the hint by agent role:
    • Code-flow agents (dev, boss, reviewer): current wording; refs #79.
    • Design agents (designer, design-reviewer): new wording pointing at #94 ("designer needs 1M context") and the Penpot-accumulation cause — use claude-opus-4-7[1m] and/or split the task across multiple dispatches.
  • The stored result.error field (shown in the dashboard) mirrors the log hint, so the operator sees the right message in the task detail view too.
  • Uses the same agent classification mechanism already used in src/webhook-routing.ts (the REVIEWER_AGENTS / DESIGN_AGENTS sets, or equivalent).

Tests

  • worker.test.ts: a design-agent config + a prompt-too-long error yields the Penpot-flavored hint, not the mcp__forgejo__*_file one.
  • Code-agent + prompt-too-long yields today's hint (regression guard).
  • Unknown agent name falls through to a generic hint ("raise context window or split the task").

Out of scope

  • Fixing the underlying overflow (tracked in #79 for code agents, #94 for designer).
  • Rewriting #79's skill-level rule — still correct for code-flow.
  • A structured-error schema. The hint is a string today; keep it a string.

References

  • Failure that surfaced this: designer task d3883982-7b23-4083-ac18-38b42b98e633 on #70.
  • src/worker.ts:217 — the isPromptTooLong branch.
  • #79 — rule for code-flow agents (mcp__forgejo__*_file).
  • #94 — designer needs 1M context window.
  • src/webhook-routing.ts — existing agent classification (REVIEWER_AGENTS, design-reviewer-author routing).

Dependencies

  • Blocked by: nothing.
  • Blocks: operators interpreting designer overflow failures correctly.
  • Branch off: main.
## User story As the **operator debugging a failed run**, I want the `prompt-too-long` hint in the service log to point at the real cause for the agent that failed, not a one-size-fits-all rule. Right now it sends designers down a rabbit-hole that doesn't apply to them. ## What happens today `src/worker.ts:217–228` catches `"prompt is too long"` / `"context_length_exceeded"` and emits a fixed hint: ``` prompt-too-long failure on <repo>#<issue> — skills must use Edit/Write + git CLI for code changes, not mcp__forgejo__update_file / create_file / delete_file (see #79) ``` That hint is **code-flow-specific**. It's the right rule for `dev` / `boss` / `reviewer` (where overflow was first observed: dev feeding an entire 400-line file as `mcp__forgejo__update_file` content — #79). When `designer` overflows — as observed today on task `d3883982` (#70) — the root cause is Penpot MCP accumulation (100+ `create_frame` / `create_text` round-trips), not a misuse of any forgejo file tool. The hint points at an irrelevant skill rule and covers the actual cause (raise context window / compact history). ## Acceptance criteria ### Code - [ ] `src/worker.ts` splits the hint by agent role: - Code-flow agents (`dev`, `boss`, `reviewer`): current wording; refs #79. - Design agents (`designer`, `design-reviewer`): new wording pointing at #94 ("designer needs 1M context") and the Penpot-accumulation cause — use `claude-opus-4-7[1m]` and/or split the task across multiple dispatches. - [ ] The stored `result.error` field (shown in the dashboard) mirrors the log hint, so the operator sees the right message in the task detail view too. - [ ] Uses the same agent classification mechanism already used in `src/webhook-routing.ts` (the `REVIEWER_AGENTS` / `DESIGN_AGENTS` sets, or equivalent). ### Tests - [ ] `worker.test.ts`: a design-agent config + a prompt-too-long error yields the Penpot-flavored hint, not the `mcp__forgejo__*_file` one. - [ ] Code-agent + prompt-too-long yields today's hint (regression guard). - [ ] Unknown agent name falls through to a generic hint ("raise context window or split the task"). ## Out of scope - Fixing the *underlying* overflow (tracked in #79 for code agents, #94 for designer). - Rewriting #79's skill-level rule — still correct for code-flow. - A structured-error schema. The hint is a string today; keep it a string. ## References - Failure that surfaced this: designer task `d3883982-7b23-4083-ac18-38b42b98e633` on #70. - `src/worker.ts:217` — the `isPromptTooLong` branch. - #79 — rule for code-flow agents (`mcp__forgejo__*_file`). - #94 — designer needs 1M context window. - `src/webhook-routing.ts` — existing agent classification (`REVIEWER_AGENTS`, design-reviewer-author routing). ## Dependencies - **Blocked by:** nothing. - **Blocks:** operators interpreting designer overflow failures correctly. - **Branch off:** `main`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#95
No description provided.