Skip to content

bug(prompt): background subagent completion turn fails on claude-bridge (prompt-capture miss; appended harness likely missing) #1528

Description

@yenhernandezmkt

Summary

With the claude-bridge provider, the automatic turn that gentle-shell starts when a background subagent finishes can fail in pi-claude-bridge with:

Error: prompt-capture: no capture for this 66034-char system prompt, and it embeds none of the 2 known.
Closest known match diverges at offset 66034 (68707-char key, last recorded at turn_start).

When that happens, the primary session's turn is lost. The model replied only "No response requested." and never processed the subagent result. The next turn, started by a user prompt, worked.

Reproduction (observed once)

  1. Primary session on claude-bridge (claude-opus-5-5, Max plan).
  2. Launch gentle-ai-explore with subagent_run in background mode.
  3. The primary turn ends and the session goes idle.
  4. The subagent finishes. gentle-agents.ts delivers the result with pi.sendMessage(..., { deliverAs: "steer", triggerTurn: true }), which starts a new turn.
  5. The bridge throws the error above.

Why it may involve gentle-shell

The failing prompt is an exact prefix of the last recorded prompt: the divergence offset equals the failing prompt's length, and 2673 characters are missing from the end. Since #1485, gentle's harness blocks (orchestrator, todo, and others) are added by mutating systemPromptOptions.appendSystemPrompt in before_agent_start. The likely explanation is that the triggerTurn turn was rendered without those appended blocks. If so, then even without the bridge's throw, a background-completion turn would run without the gentle harness, the same silent-loss class as #1485.

I have not confirmed whether this comes from pi's triggerTurn path or from the append mechanism. I filed the bridge side here: elidickinson/pi-claude-bridge#144

Environment

  • gentle-shell / gentle-pi 3.7.0 (git package, HEAD f14b19a)
  • pi 0.87.1, pi-claude-bridge 0.9.0, gentle-engram 0.1.16, pi-mcp-adapter, pi-web-access
  • Background subagent policy: on; Linux

Suggestion

Check that a background-subagent completion turn (triggerTurn while idle) receives the same appended harness as a user-prompted turn. It may be worth a regression test with the claude-bridge provider.

Related: #1485, elidickinson/pi-claude-bridge#144

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:approvedIssue approved by maintainer; PR may be openedtype:bugBug fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions