Give CautionDrafter the frame tallies RunDebriefer already sees - #713
Open
xmap wants to merge 1 commit into
Open
Give CautionDrafter the frame tallies RunDebriefer already sees#713xmap wants to merge 1 commit into
xmap wants to merge 1 commit into
Conversation
CautionDrafterPayload never carried capture_progress, so the agent was structurally blind to frame-count shortfalls even though the terminal event's tallies were already being extracted and handed to its sibling RunDebriefer. Wire the same extract_capture_progress helper into the subscriber and document the tallies on the payload, mirroring RunDebriefPayload's field of the same name. The system prompt draws a hard line: a shortfall is a fact about ONE Run, RunDebriefer already records it as DataSuspect, and this payload carries only one Run, so a shortfall alone must never originate a Caution. The lookback-then-propose ProposeSupersede path survives as a secondary route, since it is genuinely reachable once any Caution exists for a target, but the pilot currently has zero Caution streams, so it is explicitly not presented as the primary mechanism. Cross-Run recurrence, the signal that would make an asset-level claim sound, is out of scope here: no new port or lookup. The module docstring names that as a deliberate v1 boundary, not a TODO, grounded in the pilot's own numbers (364 of 974 completions short, clustered tightly around an 11-frame offset), and leaves it for the next slice.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||
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
CautionDrafterproposes standing "Caution" advisories on Assets/Procedures from terminal Run events, butCautionDrafterPayloadnever carried frame tallies, unlike its siblingRunDebriefer, which already receives them viaextract_capture_progressand correctly flagsDataSuspect.CautionDrafterwas structurally blind to frame-count shortfalls: the data existed on the terminal event, but never reached the LLM call.capture_progress: dict[str, int] | None = NonetoCautionDrafterPayload, mirroringRunDebriefPayload's field of the same name.extract_capture_progress(event)into the subscriber, same helperRunDebrieferalready uses.DataSuspect; a Caution is a claim about an ASSET, which a single Run cannot establish a pattern for. A shortfall alone must never originate a proposal, andNoActionis correct for an isolated shortfall. Refusing discards nothing: the tallies live permanently on the terminal event and RunDebriefer's verdict is a durable Decision.ProposeSupersedebranch (shortfall + a matching existing Active Caution) is kept, but demoted to an explicitly secondary path, not the primary mechanism, because the pilot currently has zero Caution streams and it would otherwise be dead on arrival.capture_progressabsence stays ordinary (not every Run is a witnessed capture); never compare a saved count with a collected count (verbatim rule fromrun_debrief.py, different upstream instruments).CAUTION_DRAFTER_PROMPT_TEMPLATE_IDis unchanged (per design, pre-PromptTemplate-aggregate); its one-line description inKNOWN_PROMPT_TEMPLATESwas updated to note the payload now carriescapture_progress. Note: the ID is stable across this change even though the underlying prompt bytes differ before/after, which is the known provenance limitation of the stopgap registry.Deliberately does not enable origination from a shortfall pattern. This slice is awareness-only by design: the agent sees the tallies and can reason about them in a corroboration role, but nothing in this change lets a shortfall, by itself or by recurrence, produce a new Caution proposal on its own.
Out of scope (unchanged): no new port/lookup/query/projection, no change to
RunDebrieferorextract_capture_progressitself, no change to the 5-choice vocabulary/severity anchors/tier quotas, and the unrelatedagent_namerepr bug inregenerate_run_debrief/handler.pyis left alone.Test plan
uv run pytest apps/api/tests/unit apps/api/tests/architecture -q— 45320 passed, 631 skippeduv run pytest apps/api/tests/integration -q— 1273 passed, 1 skippedmake lint— cleanmake typecheck— 0 errorsNonewhen absent, both the shortfall-with-matching-Caution and shortfall-with-no-existing-Caution payload shapes), never asserting what the model chooses.🤖 Generated with Claude Code