Skip to content

feat(workflow): handoff formation is traced under its own 'handoff' role - #88

Merged
EdmondDantes merged 1 commit into
mainfrom
feat/handoff-attribution
Jul 24, 2026
Merged

feat(workflow): handoff formation is traced under its own 'handoff' role#88
EdmondDantes merged 1 commit into
mainfrom
feat/handoff-attribution

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

What

The handoff-formation exchange — where the model is asked to write the baton for the next step — is now traced under its own role, handoff, instead of worker.

Why

Handoff formation runs lazily at the first ai() of the NEXT step, so its ai span sat inside that step's span under the generic worker role. In the trace it read as the next step doing work it had not begun — an assess-style step looked like it did nothing, its only visible exchange actually being the previous step's handoff. Naming the exchange handoff makes it what it is.

Pure trace-label change: formPendingHandoff() passes 'handoff' as the $agent to runTurns. agentModel('handoff') falls back to the scope's default model (no such role configured → no throw), so routing and content are unchanged; only the span's role differs.

Test handoffFormationIsTracedUnderItsOwnRoleNotTheNextStepsWork asserts the ai roles across a two-step relay are ['worker', 'handoff', 'worker'].

Scope note

This is part (a) of the "handoff attribution" item. Part (b) — skipping the model call entirely for single-exchange steps and handing the reply on verbatim — was dropped by design: it would replace a consciously-formed, forward-looking baton with the step's own backward-looking reply, and (per the project direction) a well-made workflow should have essentially no single-exchange/trivial steps in the first place.

@EdmondDantes
EdmondDantes merged commit 974d96f into main Jul 24, 2026
2 checks passed
@EdmondDantes
EdmondDantes deleted the feat/handoff-attribution branch July 24, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant