This repository was archived by the owner on May 26, 2026. It is now read-only.
feat(kora): KR-CC3-CLEANUP-AND-DAEMON-PREP-MEGABUCKET — #189 follow-ups + daemon audit + upstream prep#192
Merged
rafe-walker merged 1 commit intoMay 24, 2026
Conversation
…ion_reason + api_call_count pin)
Deliverable A: escalation_reason structured telemetry field. Threaded through CostStateHolder.record_inference → CostRouteTelemetry.record_call → _RouteCounters.escalation_reason_breakdown. haiku_router plugin now returns {"reissue_with": ..., "escalation_reason": <reason>}; conversation_loop reads the reason from the hook result and passes it to record_inference_from_response. Legacy callers omitting the field still work (escalation_count increments without per-reason bucket).
Deliverable B: api_call_count accounting confirmation. Per #189 PR body, re-issued calls are part of the same iteration ("transparent upgrade" semantic) — api_call_count NOT incremented, iteration_budget NOT consumed. Documented inline in haiku_router/plugin.py docstring + conversation_loop reissue site comment. Test pins both invariants by slicing the source between the hook firing and the post_api_request observer and asserting neither bump nor consume appears.
Deliverables C + D: research-only docs landing in a separate kora-docs PR. C audits all 16 daemon listeners against agent/background_daemon_registry.py + recommends 15-16 sequential PRs for KR-DAEMON-LISTENERS-VIA-GATEWAY (snapshot listener first as proof-of-pattern). D drafts 5 upstream-Hermes PRs for the local extensions added by #172/#181/#189; recommends submission order #1-3 (3+ days soak met) and holding #4 + #5 for the 7-day soak.
Tests: 178/178 focused-scope tests green (haiku_router + kora_hermes_plugin + cost_ladder + cost_telemetry + cost_telemetry_listener + post_llm_can_reissue). Includes 7 new tests covering escalation_reason structured-field semantics (omission/non-escalation/empty-string/non-string fallback) and the api_call_count + iteration_budget invariants.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
4-deliverable batched bucket: 2 code follow-ups to #189 + 2 research-only docs (in companion kora-docs PR linked below).
Deliverable A — escalation_reason structured telemetry field
Threaded through the existing telemetry layers:
After this lands, cost-telemetry snapshot exposes per-reason escalation breakdown — cockpit panels can show "X% low_confidence_marker, Y% short_response_for_long_input".
Deliverable B — api_call_count accounting confirmation
Per #189 PR body the chosen semantic was "transparent upgrade" — a re-issue is part of the same iteration; `api_call_count` is NOT incremented and `iteration_budget` is NOT consumed. Documented explicitly in:
Pinned by two structural tests that slice the loop source between the hook firing and the `post_api_request` observer and assert there's NO `api_call_count += 1` and NO `iteration_budget.consume(` in that slice.
Deliverables C + D — research only (separate docs PR)
Land in kora-docs at `kora_docs/14_research/`. Both available for review at:
Test plan
🤖 Generated with Claude Code