Repository navigation
durable-harness/fx: Agent Runs from libfx hooks (#11), with handed-off and fenced turns kept open - #14
Closed
pranaygp wants to merge 5 commits into
Closed
durable-harness/fx: Agent Runs from libfx hooks (#11), with handed-off and fenced turns kept open#14pranaygp wants to merge 5 commits into
pranaygp wants to merge 5 commits into
Conversation
…ts semantic hooks Signed-off-by: Chad Hietala <chad.hietala@vercel.com>
A session's trace is found or made, and its event queued, synchronously in onEvent, and dropped only when its turn finished with nothing queued behind it. Deleting it at turn.end orphaned a next turn whose turn.start was already queued: its later events went to a new, empty session and were dropped, its completion among them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const { outcome, error, handoff } = e.data; | ||
| // Handed to another worker, fenced out by one (libfx then ends it `interrupted`), yielded or paused: | ||
| // the execution that resumes it continues the turn, with its cut-off calls still open. | ||
| if (!handoff && !turn.fenced && outcome !== 'yielded' && outcome !== 'paused' && outcome !== 'fenced') { |
…execution and session is its own
libfx 0.0.14 ends a fenced execution `interrupted` after a `journal.error { fenced: true }` that names no turn or execution, and a handoff `interrupted` with `handoff: true`, after `tool.end` reports the call it cut off as cancelled (measured on a bare createFxEngine). So:
- A turn handed off or fenced out stays open, and its cut-off tool calls stay open until the turn's end, so the rerun continues the same call. `interrupted` with no handoff is the user's cancel and ends as `cancelled`.
- Events are scoped to the execution that started the turn: after a takeover in this process, the old execution's end doesn't close the new one's steps or the turn.
- A session's trace starts only with a turn's start, and is dropped between turns once its queue drains: journal receipts and calls that outlive their turn make none.
- With agentRuns() registered before the agent is made, `captureContent` follows the audience's capture decision (`hook.capture()`). Failures go to `hook.onError`, and turns take the session's persisted sequence.
- A cancelled model or tool call ends as `cancelled` rather than failed.
- harness-world: `SessionTracing.step()` keeps #11's `at` (the execution and its step index) on chad/agent-runs-library's interface.
Tests: handoff, fence, interrupted, cancelled and failed endings; a takeover in one process; turn numbering and eviction; a private audience; and no recording before registration.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
pranaygp
force-pushed
the
pgp/agent-runs-fx-fixes
branch
from
October 16, 2026 15:40
3921109 to
cf8e06d
Compare
pranaygp
changed the base branch from
chad/agent-runs-fx-hooks
to
chad/agent-runs-library
October 16, 2026 15:40
Collaborator
Author
|
Superseded by Chad's cfeff14 on 🤖 Posted by Claude Code |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#11 (Chad's
agentRunsHooksfor libfx's own durable agents) with the fixes from my review of it, on top ofchad/agent-runs-library(#10) as it is now.chad/agent-runs-libraryshows durable-harness/fx: Agent Runs for libfx's own durable agents, from its semantic hooks #11 as merged too.chad/agent-runs-libraryis 6e36c39. Before it, 8767aa0 takes the library'sharness-world/src/agent-runs.ts, the one file that conflicted. Then cf8e06d puts durable-harness/fx: Agent Runs for libfx's own durable agents, from its semantic hooks #11'sstep(at)back on Chad's interface, with the fixes.hook.capture(),hook.onErrorand the persisted turnsequence(ff4eb4b), instead of hook members of their own.What libfx 0.0.14 sends, measured on a bare
createFxEngine:journal.error { fenced: true }(null turn and execution ids), thenturn.end { outcome: 'interrupted' }: nofencedoutcome, nohandofftool.end { status: 'cancelled' }, thenturn.end { outcome: 'interrupted', handoff: true }handoffChanges in
agentRunsHooks:tool.endwaits for the turn's end, so the rerun continues the same call instead of opening a second one.journal.error { fenced }marks the execution recording at that moment.interruptedwithout a handoff is the user's cancel: it ends ascancelled, as doescancelled.turn.start, and is dropped between turns once its queue drains. Journal receipts and a title call that outlives its turn make no entry.captureContentfollows the capture decision whenagentRuns()is registered before the agent is made (libfx reads it once, then), and staystruebefore that.agentRuns({ onError })(hook.onError).sequence, since libfx's hooks carry no turn number.cancelledrather than failed.@vercel/agent-runs0.0.1's model result.Tests (
test/fx-agent-runs.test.ts, 14 pass):interrupted,cancelledandfailedendings;captureContent: false;The takeover test and six of the others fail on d2cc60d's hook.
Also run on this head: workspace typecheck; durable-harness (356 pass), harness-world (374 pass) and demo (25 pass) tests.
Left as-is: the libfx peer range still admits 0.0.13-dev builds, whose types have no
FxHooks. That only matters for an app on such a build that type-checksnode_modules.🤖 Generated with Claude Code