feat: expose KILROY_PREDECESSOR_NODE/OUTCOME env to handlers (#13)#88
Merged
mattleaverton merged 1 commit intoApr 27, 2026
Merged
Conversation
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
From
docs/plans/2026-04-24-kilroy-fixes-from-feedback.mditem #13.Bug: Failure-handling tool-command nodes (like
fail_reportinpr-review) have no clean way to know which predecessor stage failed. The shipped workflow works around this by probing filesystem state (pr-meta.jsonexists?build-report.jsonexists? fall through phases in order) — a workaround for the engine not telling the handler what it needs to know.Fix: Two new env vars exposed to every node:
KILROY_PREDECESSOR_NODE— id of the previously completed nodeKILROY_PREDECESSOR_OUTCOME—success/fail/canceledof that nodeReuses the existing
previous_nodecontext key in the run loop, added a parallelprevious_outcomeusing the already-maintainednodeOutcomesmap. Both are assembled inBuildStageRuntimeEnv, so they flow through toToolHandler,CodergenHandler(API), andTmuxAgentHandler(tmux) without per-handler changes.Semantics on first node
KILROY_PREDECESSOR_NODEKILROY_PREDECESSOR_OUTCOMEstartnode itself""""start"start""success"Both keys always present in the subprocess env (possibly empty) so callers don't need to special-case absence vs empty.
Test plan
TestToolGraph_PredecessorEnvVars— 3-node graphstart → a (exit 1) → b [condition=fail]; nodebcaptures both vars into a file; assertsa+fail.TestToolGraph_PredecessorEnvVarsSuccessPath—start → check → done;checkcaptures vars; assertsstart+success.go test ./internal/attractor/engine/...and./internal/attractor/agents/...pass (2 pre-existing unrelated failures confirmed on base).Risks / follow-ups
previous_nodekey.baseNodeEnvStripKeysso a parent run's values don't leak into a child node.Context
Produced by a dogfood quick-launch run against this repo.
🤖 Generated with Claude Code