fix(backend): track Pi turn lifecycle
This commit is contained in:
@@ -94,6 +94,7 @@ export class PiProcessManager {
|
||||
const rpc = new RpcClient(child);
|
||||
const bridge = new SessionBridge(rpc);
|
||||
const rt: SessionRuntime = { rpc, bridge, child };
|
||||
bridge.beginTurn();
|
||||
this.runtimes.set(sessionId, rt);
|
||||
// Identity-checked: a stale child's exit must not evict a newer runtime.
|
||||
// Expected teardowns (teardown()/respawn) delete the runtime from the map BEFORE the
|
||||
@@ -136,6 +137,7 @@ export class PiProcessManager {
|
||||
const message = o.mode === "resume"
|
||||
? `/riprendi-sessione ${sessionId}`
|
||||
: `/nuova-domanda ${JSON.stringify(o.question ?? "")}`;
|
||||
rt.bridge.beginTurn();
|
||||
rt.rpc.send({ type: "prompt", message });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user