SIGN IN SIGN UP

feat(workflow): support named agent threads (#145)

* feat(workflow): support named agent threads

* fix(workflow): propagate nested resume barriers

* fix: isolate threaded turns from compaction rewrites of session.messages

Turn isolation used a pre-prompt() length snapshot of session.messages and
sliced from it for empty-output detection and the structured-output lastText
fallback. Auto-compaction can rewrite session.messages inside prompt() (the
array is rebuilt as summary + kept tail), so the stale index sliced an empty
window and misclassified a successful threaded turn as AGENT_EMPTY_OUTPUT,
rolling it back and retrying into the same wall.

Collect the turn's own transcript from message_end events instead: the
collected window is append-only per turn, survives compaction, and spans the
schema path's repair re-prompts. Both the unstructured finalAssistantText
check and the structured lastAssistantText fallback now read it.

Regression tests trigger real auto-compaction mid-prompt() (tiny reserve
threshold + a huge reply, exercising the split-turn path) for both the
unstructured and structured paths; both fail with the old index-based
isolation.

Also document that nested workflows share the parent's thread namespace
(prefix child-internal threads) and that model/tier/agentType may change
across turns on one thread.

---------

Co-authored-by: rgarcia <72655+rgarcia@users.noreply.github.com>
R
Rafael committed
f38f32b91a4d62efa48d018989adbd7f81e38116
Parent: f1e05aa
Committed by GitHub <noreply@github.com> on 8/19/2026, 2:46:46 PM