Skip to content

Resumed over-limit session is permanently stuck: prompts fail with "Prompt is too long", auto-compaction never triggers, and "/compact" is a silent no-op #1024

Description

@feiandxs

Environment

  • @zed-industries/claude-code-acp 0.16.2 (spawned via npx -y @zed-industries/claude-code-acp@0.16.2)
  • Claude Code CLI 2.1.237, logged in via claude /login
  • Node v26.0.0, macOS (arm64)
  • Protocol: ACP v1 over stdio, plain JSON-RPC (no editor involved — reproduced with a raw stdio driver)

Summary

A session whose history is already near/over the model context limit (created in terminal Claude Code; ~21 MB jsonl, ~4200 updates replayed on session/load) becomes permanently unusable through the adapter:

  1. session/load succeeds and replays history normally.
  2. Any session/prompt fails with -32603 Internal error: Prompt is too long. The rejection is near-instant (~200 ms), so it looks like an SDK-side pre-check rather than an API round-trip.
  3. SDK-side auto-compaction never triggers on this path — related to the position in Does claude-agent-acp currently trigger SDK-side automatic compaction? #887 ("managed by Claude Code entirely"), but empirically it does not happen for resumed sessions that are already over the limit.
  4. Sending /compact" as a prompt (it is advertised in available_commands) returns stop_reason: end_turnin **~40 ms** with **zero**session/updatenotifications — nocompactingstatus, nocompact_boundary, no summary — and the session remains stuck: the next session/prompt` fails with the same error.

In terminal Claude Code the same situation is recoverable (claude --resume <id> + /compact), so the capability exists in the CLI; it is just unreachable through the adapter exactly when it is needed most.

Repro (raw JSON-RPC over stdio)

→ initialize {protocolVersion: 1}
→ session/load {sessionId: <big-session>, cwd: <its cwd>, mcpServers: []}
← ok (history replayed as session/update stream)
→ session/prompt {sessionId, prompt: [{type: "text", text: "hi"}]}
← error -32603 "Internal error: Prompt is too long"   (~200 ms)
→ session/prompt {sessionId, prompt: [{type: "text", text: "/compact"}]}
← result {stopReason: "end_turn"}                      (~40 ms, no notifications at all)
→ session/prompt {sessionId, prompt: [{type: "text", text: "hi"}]}
← error -32603 "Internal error: Prompt is too long"

Expected (any of these would unblock hosts)

  1. Auto-compaction runs on the resumed-session path the same way it does in interactive terminal sessions (per Does claude-agent-acp currently trigger SDK-side automatic compaction? #887 this is expected to be Claude Code's job — but it observably doesn't happen here); or
  2. /compact" over session/prompt` actually executes compaction (today it silently no-ops in this state — possibly related to Surface the /compact conversation summary over ACP instead of dropping it #873, but here nothing runs at all, rather than the summary being dropped); or
  3. At minimum, a structured/typed error (instead of a string inside -32603) so hosts can detect the condition and guide users to recover in the terminal.

Happy to provide the full driver script or additional traces if useful.

Related: #887, #296, #26, #873

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions