Skip to content

Add report_error log frequency mode#11971

Merged
alokedesai merged 3 commits into
masterfrom
oz-agent/report-error-log-mode
Jun 1, 2026
Merged

Add report_error log frequency mode#11971
alokedesai merged 3 commits into
masterfrom
oz-agent/report-error-log-mode

Conversation

@alokedesai
Copy link
Copy Markdown
Member

Description

Adds a ReportErrorLogMode enum for report_error! so call sites can choose between the existing default EveryTime behavior and a new OncePerRun mode.

The OncePerRun mode uses a per-macro-invocation static AtomicBool, so each call site logs the first time it is reached during the app run and suppresses later hits. The default one-argument report_error!(err) form remains backwards-compatible and logs every time.

Also threads the same option through report_if_error!(result, log_mode) for callers that use the result helper.

Linked Issue

N/A — Slack request.

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

Added warp_core::errors::tests::report_error_log_mode_controls_log_frequency, which installs a test logger and verifies:

  • default report_error!(err) logs twice for two hits
  • ReportErrorLogMode::EveryTime logs twice for two hits
  • ReportErrorLogMode::OncePerRun logs once for two hits of the same macro callsite

Validation run:

  • ./script/format
  • ./script/format --check && cargo clippy -p warp_core --all-targets --tests -- -D warnings
  • cargo nextest run -p warp_core -E 'test(report_error_log_mode_controls_log_frequency)' — 1 passed
  • cargo nextest run -p warp_core — 44 passed
  • cargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warnings
  • cargo clippy -p warp_completer --all-targets --tests -- -D warnings

I also tried cargo clippy --workspace --all-targets --all-features --tests -- -D warnings; it failed before reaching this change because release-bundle app binaries expected generated channel config files such as stable_config.json, dev_config.json, local_config.json, and preview_config.json under OUT_DIR.

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

N/A — no UI change.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

Co-Authored-By: Oz oz-agent@warp.dev

Conversation: https://staging.warp.dev/conversation/b3b97505-1e9f-427c-b87d-7f8757773bd3
Run: https://oz.staging.warp.dev/runs/019e7f0b-9f95-72e6-bb15-5b5b3ad074db

This PR was generated with Oz.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 31, 2026
@alokedesai alokedesai marked this pull request as ready for review May 31, 2026 17:37
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 31, 2026

@alokedesai

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

Adds ReportErrorLogMode so report_error! and report_if_error! callers can opt into per-run log suppression while preserving the default every-time behavior. The implementation is small, localized to warp_core error reporting, and includes a focused logger-based test for the direct report_error! behavior.

Concerns

  • No blocking correctness, security, or spec-alignment concerns found.
  • One non-blocking test coverage suggestion is noted inline for the new macro surface.

Verdict

Found: 0 critical, 0 important, 1 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread crates/warp_core/src/errors_tests.rs
Co-Authored-By: Oz <oz-agent@warp.dev>

Co-Authored-By: Aloke Desai <alokedesai@users.noreply.github.com>
@alokedesai alokedesai requested a review from vorporeal June 1, 2026 18:58
Comment thread crates/warp_core/src/errors.rs
Co-Authored-By: Aloke Desai <alokedesai@users.noreply.github.com>
@alokedesai alokedesai merged commit b8e86f3 into master Jun 1, 2026
28 checks passed
@alokedesai alokedesai deleted the oz-agent/report-error-log-mode branch June 1, 2026 22:14
alokedesai added a commit that referenced this pull request Jun 3, 2026
## Description
Updates the GraphQL client type drift error reports that end with `Make
sure to update client GraphQL types!` to use the
`ReportErrorLogMode::OncePerRun` option introduced by #11971.

This applies to 12 enum-conversion fallback paths across:
- `app/src/server/server_api/ai.rs`
- `app/src/workspaces/gql_convert.rs`

Each matching `report_error!` call now passes
`warp_core::errors::ReportErrorLogMode::OncePerRun`, so repeated hits
from the same call site are logged only once per app run instead of on
every invocation.

## Linked Issue
N/A — Slack follow-up.

- [ ] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`.
- [ ] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes).

## Testing
- [x] `./script/format`
- [x] `./script/format --check`
- [x] Evidence script: checked 12 `Make sure to update client GraphQL
types!` call sites and confirmed all use
`warp_core::errors::ReportErrorLogMode::OncePerRun`
- [x] `cargo clippy -p warp --all-targets --tests -- -D warnings`
- [x] `cargo nextest run -p warp_core -E
'test(report_error_log_mode_controls_log_frequency)'` — passed, proving
the once-per-run mode logs once across two hits of the same call site

- [ ] I have manually tested my changes locally with `./script/run`

### Screenshots / Videos
N/A — no UI change.

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

Co-Authored-By: Oz <oz-agent@warp.dev>

_Conversation:
https://staging.warp.dev/conversation/b3b97505-1e9f-427c-b87d-7f8757773bd3_
_Run:
https://oz.staging.warp.dev/runs/019e7f0b-9f95-72e6-bb15-5b5b3ad074db_

_This PR was generated with [Oz](https://warp.dev/oz)._

Co-authored-by: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants