fix(agent): ne câbler le PTY qu'en lancement brut, pas structuré — §17.4/§17.6

Un launch structuré route vers une AgentSession enregistrée dans
StructuredSessions ; son id n'est jamais un PTY vivant. Câbler le bridge PTY
appelait subscribe_output avec un id inconnu de l'adapter → NotFound
("pty handle not found"), faisant échouer tout lancement d'agent structuré.
On ne pompe les octets que sur le chemin PTY brut (structured: None).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 23:15:36 +02:00
parent 2f20fdbab4
commit 5f45c22941

View File

@ -1064,6 +1064,14 @@ pub async fn launch_agent(
let session_id = output.session.id;
// §17.4/§17.6: a structured launch routes to an `AgentSession`, registered
// **only** in `StructuredSessions` — its id is never a live PTY. Such a cell is
// a chat view driven by `agent_send`/`reattach_agent_chat`, not by xterm bytes,
// so we must NOT wire it to the PTY bridge. Doing so would call
// `subscribe_output` with an id the PTY adapter has never seen → `NotFound`
// ("process error: pty handle not found"), failing every structured agent
// launch. Only the raw-PTY path (`structured: None`) gets the byte pump.
if output.structured.is_none() {
// Register the xterm output channel for this session.
let gen = state.pty_bridge.register(session_id, on_output);
@ -1088,6 +1096,7 @@ pub async fn launch_agent(
return Err(ErrorDto::from(AppError::from(e)));
}
}
}
Ok(TerminalSessionDto::from(output))
}