refactor(session): extract the engine host
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Engine lifecycle policy — spawn, handshake, respawn-on-crash, teardown, and the per-surface residency rules (resident chat engine; one-shot pass engines spawned per run, torn down at the verdict, ADR-0014) — moves out of MentorSessionModel into EngineHost behind the EngineTransport seam. The model keeps session + turn coordination and stays the only observable the panes see; ACPEngineClient becomes the seam's production adapter, and a scripted in-process engine (ScriptedEngine) becomes the second adapter — engine-behaviour tests (streaming, crash, cancel, restart, per-surface spawn) now run without child processes, retiring the zsh fake-server rigs from logic tests (#30 flake family). Exactly one real-process wire smoke per LLM surface survives (chat two-act + parameterized pass1/pass2): the held-turn cancel contract, hung-child SIGTERM teardown, handshake, streamed turn, crash, restart. One-shot teardown is structural (withOneShot closes at body end, every exit path); the one-shot slot is claimed before the first suspension so the at-most-one invariant holds across the spawn/handshake awaits. Suite: 652 executed / 652 passed / 0 failed (653 argument cases), counted from the xcresult; swiftformat idempotent, swiftlint clean on touched files. Closes #178
This commit is contained in:
1 parent
d14cb40e73
commit
627ecf515e
18 files changed
+1663
-639
No files matched your search
@@ -4,7 +4,8 @@
|
||||
//
|
||||
// #29 (S8.1–S8.3): the research-candidate pins, own file —
|
||||
// SessionLifecycleTests crossed its type-body ceiling (MCPToolsPromoteTests
|
||||
// precedent). Reuses the shared fake ACP harness. The payload SHAPE pins
|
||||
// precedent). #178: runs IN-PROCESS over ScriptedEngines rigs at the
|
||||
// EngineTransport seam — no child process. The payload SHAPE pins
|
||||
// live in ToolPayloadsTests (#177); this file pins the curation behavior.
|
||||
//
|
||||
|
||||
@@ -24,8 +25,8 @@ struct ResearchCandidateTests {
|
||||
let rosterDir = acpTempDir("research-roster")
|
||||
let entry = SessionEntry(sessionId: "sess-1", name: "Research", pieceTitle: nil, createdAt: Date())
|
||||
SessionRoster.save([entry], directory: rosterDir)
|
||||
let fake = makeFakeACP(at: acpTempDir("research"), mode: "loadReplay")
|
||||
let mentor = MentorSessionModel(binaryPath: fake, rosterDirectory: rosterDir)
|
||||
let engines = ScriptedEngines(mode: "loadReplay")
|
||||
let mentor = engines.makeMentor(rosterDirectory: rosterDir)
|
||||
defer { mentor.shutdown() }
|
||||
await mentor.openSession()
|
||||
|
||||
@@ -64,8 +65,8 @@ struct ResearchCandidateTests {
|
||||
let rosterDir = acpTempDir("disposition-roster")
|
||||
let entry = SessionEntry(sessionId: "sess-1", name: "Research", pieceTitle: nil, createdAt: Date())
|
||||
SessionRoster.save([entry], directory: rosterDir)
|
||||
let fake = makeFakeACP(at: acpTempDir("disposition"), mode: "loadReplay")
|
||||
let mentor = MentorSessionModel(binaryPath: fake, rosterDirectory: rosterDir)
|
||||
let engines = ScriptedEngines(mode: "loadReplay")
|
||||
let mentor = engines.makeMentor(rosterDirectory: rosterDir)
|
||||
defer { mentor.shutdown() }
|
||||
await mentor.openSession()
|
||||
|
||||
|
||||
Reference in new issue
Block a user