Repository navigation
fix(ahp): restore stdio inheritance and emit turn lifecycle - #272
Merged
Merged
Conversation
Replace the background delivery worker with per-session queues that the session drains at its next hook point and whenever it goes idle.
…P v1 Run each session's drain in a spawned task serialized by a per-session lock, so a dropped caller cannot discard an observation mid-delivery. Drain after every ACP v1 actor iteration so turn.end is not held while the session is idle.
Tests built Runtime from the real ~/.agents, so a developer's global hooks and skills ran during tests.
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
Restore full host-environment inheritance for AHP stdio hooks and emit observe-only
turn.startandturn.endevents from Kit's native agent-loop boundaries.Motivation
The AHP SDK 0.7 upgrade changed the default subprocess environment, stripping the variables HerdR requires and silently disabling its reporting. HerdR's lifecycle subscriptions also require turn events that Kit previously did not grant or emit.
Impact
Stdio hooks receive Kit's full environment, including credentials; only trusted hooks should be configured. Explicit transport
enventries continue to override inherited values.Technical details
Turn observations preserve native session and turn IDs across CLI, A2A, and ACP runs. Tools and model continuations remain inside the same logical turn. The loop observer queues turn boundaries per session; the session delivers them in order before its next prompt, model, or session-end hook, and whenever it goes idle (ACP actor iteration, CLI wait on background tasks). No background worker; abrupt process exit remains best effort. Cancelling a CLI prompt now retires the interrupted turn, which also records cancellation results for unanswered tool calls.
mise run testandtest:headlessnow run with an empty temporary HOME, so tests no longer load the developer's global~/.agentshooks and skills.