feat: HITL continuation recording/replay support#233
Merged
Conversation
commit: |
Add toolCallId field to AGUIFixtureMatch and AGUIConfigFixture types, getLastMessageIfToolResult helper, matchesFixture toolCallId check, and re-exports from agui-stub and index.
Add onToolResult(toolCallId, events, delayMs?) method to AGUIMock. Config loader now passes through toolCallId and warns when text shorthand is used with toolCallId (text shorthand ignores it).
…ixtures Three-way match priority in the recorder: toolCallId from the last tool-result message takes precedence over user message content, with predicate fallback for sessions with no user message.
…en sentinel persistence Guard against non-2xx upstream responses to avoid recording error fixtures. Add settled flag to prevent double-resolve on error+end race. Skip disk write for predicate fixtures instead of writing unmatchable sentinel. Include parse error reason in SSE warning log.
Tests for getLastMessageIfToolResult, matchesFixture toolCallId, onToolResult fluent API, config loader pass-through, recorder continuation/priority, and full HITL round-trip integration.
eba9801 to
fac1a56
Compare
fac1a56 to
3b3fcdb
Compare
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.
Summary
Closes #232. Adds
toolCallId-based fixture matching so aimock can record and replay HITL (Human-in-the-Loop) continuation requests — the second leg of auseHumanInTheLoopflow where the last message isrole: "tool"instead ofrole: "user".toolCallId?: stringtoAGUIFixtureMatchandAGUIConfigFixturegetLastMessageIfToolResulthelper (checks absolute last message only)toolCallIdcheck inmatchesFixture(AND logic with existing fields)toolCallId→ user message → sentinel fallbackonToolResult(toolCallId, events, delayMs?)fluent API methodtoolCallIdin events path, warns on text shorthand misusegetLastMessageIfToolResultfrom both entry pointsAlso hardens the recorder against pre-existing robustness issues surfaced during CR:
settledflag to prevent double-settle on error+end race__NO_USER_MESSAGE__sentinel was semantically broken on reload)Test plan
🤖 Generated with Claude Code