feat(cli): user-facing warning registry + startup banner#196
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
Non-fatal warnings (dangerous flags, missing binaries, deprecations) previously went to `tracing::warn!` → logs, which users rarely look at. Added a process-wide `services::warnings` registry that the REPL renders as a bannered block at startup. services::warnings::warn(msg) — severity "WARN" services::warnings::info(msg) — severity "INFO" services::warnings::snapshot() — read without clearing The registry de-duplicates on push (by level + message) so callers can be noisy without flooding the banner. Rendered as a bordered eprintln! block via ratatui, stderr so it doesn't contaminate stdout when piped. No-op when no warnings are registered, so the banner is invisible in the happy path. Initial sources wired up in main.rs: --dangerously-skip-permissions → warn (permission bypass) --no-sandbox → warn (sandbox disabled) --no-sandbox + security.disable_bypass_permissions → warn (ignored) Tests: 5 unit tests using a serialized Mutex to survive cargo's parallel test runner against the singleton.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Non-fatal warnings (dangerous flags, missing dependencies, deprecations) previously went to
tracing::warn!which routes to logs — users rarely look at logs. Added a process-wideservices::warningsregistry that the REPL renders as a bannered block at startup and an easy API for any code path to enqueue a warning.API
The registry de-duplicates on push (by level + message) so callers can re-push on every check without flooding the banner.
Wiring
Initial sources in
main.rs:--dangerously-skip-permissions--no-sandbox(sandbox disabled)--no-sandboxignored by security gateThe banner renders to stderr so it doesn't contaminate stdout when the REPL output is piped.
Why stderr and not the existing
tracing::warn!path?tracing::warn!writes with a log-formatter prefix and is invisible unlessRUST_LOG=warnis set. Users expect dangerous-flag warnings to be visible by default without opting in to logging. Both sources fire together (tracing keeps the log entry for telemetry, banner surfaces the user-facing message).Test plan
cargo fmt --all— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p agent-code-lib --lib services::warnings— 5/5 passpush_and_snapshot_roundtripduplicate_push_is_ignoreddifferent_levels_same_message_are_distinctclear_empties_registrysnapshot_does_not_draincargo test -p agent-code --test smoke— 4/4 passagent --dangerously-skip-permissions→ banner renders at REPL startup; normal startup → no banner