Phase 0.4: Decision logging for edge evaluation, provider selection, retries#76
Merged
mattleaverton merged 6 commits intodanshapiro:mainfrom Apr 1, 2026
Merged
Conversation
Thread a ProgressFunc callback through resolveNextHop and selectMatchingConditionalEdge so routing functions can emit structured progress events without depending on the engine. Emit edge_condition_evaluated events for each condition evaluated during fan-in failure routing, showing the node, target, condition expression, and whether it matched. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Thread ProgressFunc through selectAllEligibleEdges and selectNextEdge using variadic parameter for backward compatibility with tests. Emit edge_condition_evaluated for each conditional edge evaluated in selectAllEligibleEdges, matching the fan-in path events. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add edgeSelectionMeta struct to track how edges were selected: condition_match, preferred_label, suggested_next_ids, weight, lexical_tiebreak, only_edge, or fallback. Thread this through selectAllEligibleEdgesWithMeta, selectNextEdgeWithMeta, and resolvedNextHop so the edge_selected progress event includes selection_method, candidates_evaluated, and conditions_matched. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Log a structured progress event when a provider, model, and backend are resolved for a node. The source field indicates how the selection was made: graph_attrs, force_model, or cli_only_override. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Log a structured event after each failed attempt capturing whether the engine will retry, the attempt number, max retries, and a human-readable reason explaining why or why not. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
TestDecisionLogging_ConditionalRoute verifies that edge_condition_evaluated events appear with correct matched/unmatched values and that edge_selected shows selection_method=condition_match. TestDecisionLogging_HillClimber verifies the retry loop produces edge evaluation events for each iteration, fail->implement edges on failures, success->done on final iteration, and retry_decision events. Also fix: remove progress callback from fan-out probe call to avoid duplicate edge_condition_evaluated events. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
leegonzales
added a commit
to leegonzales/kilroy
that referenced
this pull request
Apr 3, 2026
engine.go — struct literal alignment drift from PR danshapiro#76 (decision logging) worktree_hint_test.go — comment alignment drift from PR danshapiro#78 (error UX) No logic changes. Pure whitespace. gofmt -l . → clean go vet ./... → clean go build ./... → clean 🤖 Servitor heartbeat fix — unblocks main CI Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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
selection_method(condition_match, preferred_label, weight, lexical_tiebreak, etc.),candidates_evaluated, andconditions_matchedAll events go to progress.ndjson as structured JSON. Best-effort, non-blocking — never impacts run performance or correctness.
Files changed
next_hop.go— AddedProgressFunccallback, emitedge_condition_evaluatedeventsengine.go— Enhancededge_selected, addedretry_decisionevents, selection metadata trackingcodergen_router.go— Addedprovider_selectedeventdecision_logging_test.go— Two integration tests (conditional routing + hill-climber loop)next_hop_test.go,resume.go,subgraph.go— Signature updates for new callback parameterTest plan
go test ./internal/attractor/engine/... -run TestDecisionLogging— 2 new tests passgo test ./internal/attractor/engine/... -run TestToolGraph— all existing Phase 0 tests pass🤖 Generated with Claude Code