refactor(core): name the unsettled-tool sweep scope and untangle hosted settlement (#38724)
This commit is contained in:
parent
68ef893818
commit
2200d100d0
2 changed files with 13 additions and 28 deletions
|
|
@ -364,32 +364,17 @@ const layer = Layer.effect(
|
||||||
// these sweeps only close calls that could not produce a truthful settlement.
|
// these sweeps only close calls that could not produce a truthful settlement.
|
||||||
if (providerFailed)
|
if (providerFailed)
|
||||||
yield* serialized(publisher.failUnsettledTools({ type: "aborted", message: "Tool execution interrupted" }))
|
yield* serialized(publisher.failUnsettledTools({ type: "aborted", message: "Tool execution interrupted" }))
|
||||||
if (llmFailure && !providerFailed)
|
const resultMissing = {
|
||||||
yield* serialized(
|
type: "tool.result-missing",
|
||||||
publisher.failUnsettledTools(
|
message: "Provider did not return a tool result",
|
||||||
{
|
} as const
|
||||||
type: "tool.result-missing",
|
if (llmFailure && !providerFailed) yield* serialized(publisher.failUnsettledTools(resultMissing, "hosted"))
|
||||||
message: "Provider did not return a tool result",
|
// A clean stream that still left hosted calls unresolved fails the step itself.
|
||||||
},
|
if (stream._tag === "Success" && !providerFailed) {
|
||||||
true,
|
const hostedResultMissing = yield* serialized(publisher.failUnsettledTools(resultMissing, "hosted"))
|
||||||
),
|
if (hostedResultMissing && !publisher.stepSettlement())
|
||||||
)
|
yield* serialized(publisher.failAssistant(resultMissing))
|
||||||
const hostedResultMissing =
|
}
|
||||||
stream._tag === "Success" && !providerFailed
|
|
||||||
? yield* serialized(
|
|
||||||
publisher.failUnsettledTools(
|
|
||||||
{ type: "tool.result-missing", message: "Provider did not return a tool result" },
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: false
|
|
||||||
if (hostedResultMissing && !publisher.stepSettlement())
|
|
||||||
yield* serialized(
|
|
||||||
publisher.failAssistant({
|
|
||||||
type: "tool.result-missing",
|
|
||||||
message: "Provider did not return a tool result",
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
const stepFailure = publisher.stepFailure()
|
const stepFailure = publisher.stepFailure()
|
||||||
const stepSettlement = publisher.stepSettlement()
|
const stepSettlement = publisher.stepSettlement()
|
||||||
|
|
|
||||||
|
|
@ -277,9 +277,9 @@ export const createLLMEventPublisher = (events: Pick<EventV2.Interface, "publish
|
||||||
|
|
||||||
const failUnsettledTools = Effect.fn("SessionRunner.failUnsettledTools")(function* (
|
const failUnsettledTools = Effect.fn("SessionRunner.failUnsettledTools")(function* (
|
||||||
error: SessionError.Error,
|
error: SessionError.Error,
|
||||||
hostedOnly = false,
|
scope: "hosted" | "all" = "all",
|
||||||
) {
|
) {
|
||||||
return yield* failTools(error, hostedOnly ? "hosted" : "all")
|
return yield* failTools(error, scope)
|
||||||
})
|
})
|
||||||
|
|
||||||
const assistantMessageIDForTool = (callID: string) => {
|
const assistantMessageIDForTool = (callID: string) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue