Repository navigation
feat(guardrails): surface advisory findings to the TUI (#170) - #180
Merged
Merged
Conversation
Advisory-mode guardrail findings went only to the operator log and returned
an empty HookOutcome — dispatch only emits EvHook on Block/Mutated, so the
TUI never saw advisory findings. This defeated advisory mode's stated purpose
(measure the false-positive rate before promoting to block): the operator
could not see what the checker flagged without leaving the TUI and grepping
a log file.
The advisory arm now returns HookOutcome{Message:...} (no Block, no Mutated).
Dispatch recognises the message-only shape (a previously-unreachable state)
and emits an EvHook with HookAdvisory — a new HookDecision value, warning-
coloured in the TUI (⚠ glyph). The tool result is byte-unchanged
(model-invisible). The operator diag log stays for headless deployments.
New: session.HookAdvisory const + HOOK_DECISION_ADVISORY proto enum value.
governance.HookOutcome is NOT widened (Message is the signal). ADR 0021's
advisory-visibility clause superseded by ADR 0051.
Tests: loop-level TestAdvisoryHookEmitsEvHookAndLeavesResultUnchanged proves
EvHook+HookAdvisory emitted + result unchanged (model-invisible). TUI
TestRenderHookAdvisory proves ⚠ glyph + warning style. Mapper + client
round-trip tests for the new enum value. API-compat gate updated
(engine/api/session.txt + CHANGELOG).
Closes #170.
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.
What
Advisory-mode guardrail findings now emit a client-visible
EvHook(withHookAdvisorydecision, warning-coloured ⚠ in the TUI) in addition to the operator diag log. The model sees nothing — the tool result is byte-unchanged.Why
Advisory findings went only to the operator log and returned an empty
HookOutcome— dispatch only emitsEvHookon Block/Mutated, so the TUI never saw them. This defeated advisory mode's stated purpose (measure the false-positive rate before promoting to block): the operator could not see what the checker flagged without leaving the TUI and grepping a log file.Changes
engine/session/event.go— newHookAdvisory HookDecision = "advisory"(client-visible, model-invisible).contracts/proto/mecatl/v1/harness.proto— newHOOK_DECISION_ADVISORY = 4enum value.internal/adapter/modelhook/modelhook.go— advisory arm returnsHookOutcome{Message:...}instead of empty; diag log stays.engine/agent/dispatch.go— recognises the message-only shape (Message!="" && !Block && len(Mutated)==0) and emitsEvHookwithHookAdvisory(both Pre and Post phases).internal/adapter/server/mapper.go— mapsHookAdvisory→HOOK_DECISION_ADVISORY.client/msgs.go(HookAdvisoryconst +hookDecisionFrom),theme/theme.go(hookAdvisorywarning style),ui/render.go(⚠ glyph arm inrenderHook).TestAdvisoryHookEmitsEvHookAndLeavesResultUnchanged), TUI render test (TestRenderHookAdvisory), mapper + client round-trip tests, ACP projector test.Closes #170.