feat(run): Ports.FinalGuard — host seam that nudges an announce-then-stop run to deliver its artifact
A run can render an artifact into host storage, end on a text-only stop turn claiming "Done — sent you the file", and never call the host's delivery tool — the artifact strands while the user is told it shipped (mort general run e9e7bf40 2026-07-14, gifsmith run 29170c93 2026-07-12). The loop has no seam for the host to intervene at the stop turn. Add Ports.FinalGuard: consulted once when a single-loop run is about to finalize successfully. A non-empty nudge is appended to the SAME conversation as the next user turn and the agent runs ONE bounded extra round (same toolbox/observers, capped at finalNudgeMaxSteps=6) — enough to deliver the stranded file or correct the final text, not enough to start a new work spree. Guard panics and nudge-round failures are isolated: the original successful result always survives. The nudge is recorded as a final_nudge audit event and appended to the durable checkpoint transcript. stageInputFiles now also returns the staged file ids, surfaced to the guard via FinalState.StagedFileIDs — staged inputs live under run scope but are the user's attachments, not run-produced artifacts, so an undelivered-artifact check must exclude them. FinalState.ToolNames lets a host skip runs that have no delivery tool at all. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -54,6 +54,11 @@ type Ports struct {
|
||||
// loader tool. nil = SkillPacks are inert. The executus/skillpack battery
|
||||
// ships a default impl (skillpack.Activator).
|
||||
SkillPacks SkillPackActivator
|
||||
// FinalGuard is consulted when a single-loop run is about to finalize
|
||||
// successfully; a non-empty nudge sends the loop back for one bounded extra
|
||||
// round (the announce-then-stop undelivered-artifact check). nil = runs
|
||||
// finalize unguarded. See FinalGuard in final_guard.go.
|
||||
FinalGuard FinalGuard
|
||||
}
|
||||
|
||||
// SkillPackActivator resolves an agent's subscribed skill-pack names for a run
|
||||
|
||||
Reference in New Issue
Block a user