refactor(core): remove redundant step closeout flags (#46937)

This commit is contained in:
Kit Langton
2026-09-03 13:35:42 -04:00
committed by GitHub
Unverified
parent 2dcfc89fab
commit 282c84d79f
2 changed files with 3 additions and 6 deletions
@@ -90,10 +90,8 @@ export const createLLMEventPublisher = (bus: Pick<Bus.Interface, "publish">, inp
}
const assistantMessageID = input.assistantMessageID
let stepStarted = false
let stepFailed = false
let providerFailed = false
let outputStarted = false
let stepStreamed = false
let stepFailure: SessionError.Error | undefined
let stepSettlement: StepRecord["finish"]
@@ -112,8 +110,6 @@ export const createLLMEventPublisher = (bus: Pick<Bus.Interface, "publish">, inp
const currentAssistantMessageID = () =>
stepStarted ? Effect.succeed(assistantMessageID) : Effect.die(new Error("Tool event before assistant step start"))
const streamed = Effect.fnUntraced(function* () {
if (stepStreamed) return
stepStreamed = true
yield* bus.publish(SessionEvent.Step.Streamed, {
sessionID: input.sessionID,
assistantMessageID: yield* startAssistant(),
@@ -367,9 +363,8 @@ export const createLLMEventPublisher = (bus: Pick<Bus.Interface, "publish">, inp
readonly snapshot?: Snapshot.ID
readonly files?: readonly RelativePath[]
}) {
if (stepFailed || stepFailure === undefined) return
if (stepFailure === undefined) return
const assistantMessageID = yield* startAssistant()
stepFailed = true
yield* bus.publish(SessionEvent.Step.Failed, {
sessionID: input.sessionID,
assistantMessageID,
+2
View File
@@ -148,7 +148,9 @@ for (const fixture of [
.all()
const types = events.map((event) => event.type)
const terminal = fixture.finish === "stop" ? "session.step.ended.1" : "session.step.failed.1"
expect(types.filter((type) => type === "session.step.streamed.1")).toHaveLength(1)
expect(types.filter((type) => type === terminal)).toHaveLength(1)
expect(types.indexOf("session.step.streamed.1")).toBeLessThan(types.indexOf(terminal))
expect(
types.indexOf(fixture.toolChoice === "none" ? "session.tool.failed.2" : "session.tool.success.2"),
).toBeLessThan(types.indexOf(terminal))