Summary
agy-acp sends back the entire conversation history on every turn instead of only the new assistant response. Users see all previous responses repeated with each follow-up message.
Root Cause
agy --continue -p "prompt" dumps the full conversation output to stdout (all turns), not just the latest assistant reply. The adapter captures stdout verbatim and sends it as agent_message_chunk without filtering:
// agy-acp/src/main.rs
let text = String::from_utf8_lossy(&output.stdout).to_string();
// entire history sent back as agent_message_chunk
On turn 1: user sees response A.
On turn 2: user sees response A + response B.
On turn 3: user sees response A + response B + response C.
Expected Behavior
Each turn should only return the new assistant response for that turn:
- Turn 1: user sees response A only
- Turn 2: user sees response B only
- Turn 3: user sees response C only
Affected Code
Reproduction
- Deploy openab with agy-acp adapter
- Send first message → get response A (correct)
- Send second message → get response A + response B (bug: A is repeated)
- Send third message → get A + B + C (grows every turn)
Options Considered
Option 1: Remove --continue entirely
- Each
agy -p call is stateless — no multi-turn context
- Clean output, no history duplication
- ❌ Loses all conversation context between turns
Option 2: Track byte offset of previous output
- Store
last_output_len per session, emit text[last_output_len..]
- Simple implementation
- ❌ Fragile — breaks if agy reformats previous turns or adds metadata between runs
- ❌
--continue resumes the most recent conversation globally, unsafe for concurrent sessions
Option 3: Use --conversation <ID> + delta extraction ✅
- On first prompt: run
agy -p "prompt", capture full stdout, store per session
- On subsequent prompts: run
agy --conversation <ID> -p "prompt", capture full stdout, emit only the delta (new bytes beyond previous stored output)
- Track the agy conversation ID per session
- ✅ Append-only safe —
--conversation output grows monotonically, previous turns don't change
- ✅ Concurrent-session safe — each session targets a specific conversation ID, not "most recent"
- ✅ Preserves multi-turn context
Option 4: Pipe full context in prompt text
- Don't use
--continue or --conversation, prepend previous turns in the prompt itself
- openab already sends thread context, so agy gets it as one big prompt
- ❌ Loses agy's native tool-use continuity and internal state
- ❌ Token usage grows quadratically
Decision
Going with Option 3 — it preserves multi-turn context, is safe for concurrent sessions, and the delta extraction is reliable since --conversation output is append-only.
Environment
Summary
agy-acpsends back the entire conversation history on every turn instead of only the new assistant response. Users see all previous responses repeated with each follow-up message.Root Cause
agy --continue -p "prompt"dumps the full conversation output to stdout (all turns), not just the latest assistant reply. The adapter capturesstdoutverbatim and sends it asagent_message_chunkwithout filtering:On turn 1: user sees response A.
On turn 2: user sees response A + response B.
On turn 3: user sees response A + response B + response C.
Expected Behavior
Each turn should only return the new assistant response for that turn:
Affected Code
agy-acp/src/main.rs—handle_session_prompt()methodReproduction
Options Considered
Option 1: Remove
--continueentirelyagy -pcall is stateless — no multi-turn contextOption 2: Track byte offset of previous output
last_output_lenper session, emittext[last_output_len..]--continueresumes the most recent conversation globally, unsafe for concurrent sessionsOption 3: Use
--conversation <ID>+ delta extraction ✅agy -p "prompt", capture full stdout, store per sessionagy --conversation <ID> -p "prompt", capture full stdout, emit only the delta (new bytes beyond previous stored output)--conversationoutput grows monotonically, previous turns don't changeOption 4: Pipe full context in prompt text
--continueor--conversation, prepend previous turns in the prompt itselfDecision
Going with Option 3 — it preserves multi-turn context, is safe for concurrent sessions, and the delta extraction is reliable since
--conversationoutput is append-only.Environment
agy --continue -psubprocess invocation