Repository navigation
fix(observability): drop cron agent-job session-expired events in before_send (TAURI-RUST-M) - #3736
CodeGhost21 wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice. Comment |
|
Triage check-in: this draft hasn't moved in a few weeks. Are you still working on it? If it's ready for feedback, mark it ready for review; if it's been superseded or abandoned, feel free to close it. No response in ~2 weeks and we'll close it to keep the queue tidy — it can always be reopened. |
ba21f4b to
c53fe96
Compare
|
Maintainer housekeeping — rebased onto current Your commit is unchanged ( I added one commit of my own (
That matters because Verified locally (via the fleet CI-slot runner):
Not approving and not marking ready for review — a maintainer does that. |
M3gA-Mind
left a comment
There was a problem hiding this comment.
Approved after a maintainer-side verification pass.
Verified on the current head: MERGEABLE against main, zero failing and zero pending required checks, and no unresolved, non-outdated review threads.
This is one of two required approvals; a second maintainer review is still needed before merge.
c53fe96 to
2c3aab0
Compare
…ore_send (TAURI-RUST-M) The morning_briefing cron agent fires while the user's backend JWT has lapsed; the retry loop exhausts and reports with domain=cron, operation=agent_job, failure=retries_exhausted carrying the raw SESSION_EXPIRED sentinel. The primary call-site guard (is_session_expired_failure, tinyhumansai#3350) halts on first occurrence, but the before_send defense-in-depth filter is_session_expired_event was scoped to llm_provider/backend_api/rpc and excluded cron, so any future cron call site that bypasses the guard would still flood Sentry (tinyhumansai#80, 42k+ events). Add cron to the allowlist and accept on the session-expired body alone (the cron report carries no status tag, mirroring the rpc pre-flight branch). Genuine non-session cron failures don't match the body classifier, so real defects still page.
… block Every test in this block is `#[cfg(feature = "crash-reporting")]` on `main`, because the symbols they use are: `is_session_expired_event`, `is_max_iterations_event` and the `event_with_*` helpers are all gated on that feature, and `crash-reporting` is NOT in the default feature list. Two tests here were left ungated: 1. `session_expired_before_send_keeps_genuine_cron_failures` -- the new negative test, added without the attribute its positive sibling `session_expired_before_send_matches_cron_agent_job` carries. 2. `max_iterations_filter_matches_message_path` -- a PRE-EXISTING test that `main` gates. Rebasing this branch attached that `#[cfg]` to the new test inserted directly above it instead, silently un-gating a test that was fine before. Insertion-by-adjacency: the attribute belongs to whichever item follows it, and a new item in between takes it. Without both, the test module does not compile on any lane that builds the contributor default set -- including `cargo clippy -p openhuman -- -D warnings` (ci-lite.yml:449). Verified: with these two lines reverted, `cargo check -p openhuman --lib --tests` fails E0425 on exactly these functions; with them, both that lane and `--features crash-reporting` compile clean. No change to any assertion or to production code.
2c3aab0 to
d4b29a3
Compare
|
Maintainer housekeeping — rebased onto current Nothing about your change was modified. Both commits keep their original content and authorship ( One note on how this was done, because it took two steps: I first used To be sure the second push changed nothing but the signatures, I compared the two results by tree hash: Identical — same content, same authorship, signatures restored. Also re-confirmed the gating this branch fixes is still intact after the replay: all six tests in the sentry block carry CI is re-running against the new base. Expect the approval to need re-confirming — that is a maintainer's call, not mine. Not approving and not merging. |
Dismissing this approval. It was granted during a bulk maintainer verification pass that should not have included draft PRs — this PR is a draft, so it was out of scope for that review. No judgement on the change itself; the approval is simply being withdrawn so a stale one is not sitting on a draft when it is later marked ready. Re-review will happen once it comes out of draft.
Summary
before_sendfilteris_session_expired_event: thecrondomain was excluded, so cron-fired agent-job session-expired noise (Sentry TAURI-RUST-M / Local AI: guided model selection by device capability (tiered presets + user override) #80, 42k+ events) had only the call-site guard protecting it.cronto the filter's domain allowlist and accepts on the session-expired body alone (the cronreport_errorpath carries nostatustag, mirroring the existingrpcpre-flight branch).is_session_expired_message.Problem
A scheduled
morning_briefingcron agent fires while the user's backend JWT has lapsed. Every retry hits the same global 401, the loop exhausts, andcron::scheduler::execute_job_with_retrycallsreport_errorwithdomain=cron,operation=agent_job,failure=retries_exhausted, carrying the rawSESSION_EXPIRED: backend session not active — sign in to resume LLM worksentinel. This is expected user state (only fixable by signing in from the UI), not a defect.The primary fix already shipped — PR #3350 (
is_session_expired_failure, inv0.57.18+) halts the retry loop on first occurrence and skipsreport_errorentirely. But thebefore_senddefense-in-depth filteris_session_expired_eventwas scoped tollm_provider/backend_api/rpcand excludedcron, leaving the call-site guard as the sole protection. Any future cron call site that re-emits the shape without routing through that guard would flood Sentry again.Note: this hardening helps future builds only — it cannot retroactively silence the live #80 events, which originate from clients on pre-fix builds (98.8% from a single client stuck on 0.56.0). Those go silent once clients update to a build containing #3350; the Sentry issue should be marked resolved in v0.57.18.
Solution
is_session_expired_event(src/core/observability.rs): addcronto the domainmatches!allowlist, and extend the body-only acceptance branch fromdomain == "rpc"tomatches!(domain, "rpc" | "cron").is_session_expired_message) keeps it narrowly scoped: a genuine cron failure with a non-session error body is not suppressed and still reaches Sentry.cronarm and its relationship to the fix(cron): halt agent-job retry on backend session-expired (TAURI-RUST-N) #3350 primary guard.Submission Checklist
session_expired_before_send_matches_cron_agent_job(positive) andsession_expired_before_send_keeps_genuine_cron_failures(negative/edge).src/core/observability.rs(cargo-llvm-cov path). Existing 39 session-expired tests still pass.N/A: behaviour-only defense-in-depth change, no new feature row.## Related—N/A: no matrix feature ID affected.N/A: internal Sentry-noise filter, no user-facing surface.Closes #NNNin the## Relatedsection —N/A: tracked in self-hosted Sentry (TAURI-RUST-M / #80), no GitHub issue.Impact
before_send.Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/sentry-80-cron-session-expired-before-sendba21f4bbd7845a19f0b37dfc4d8fd6346ee4fefbValidation Run
pnpm --filter openhuman-app format:check—N/A: Rust-only changepnpm typecheck—N/A: Rust-only changecargo test --lib session_expired— 39 passed, 0 failed (incl. 2 new cron tests)cargo fmt --checkcleanN/A: Tauri shell untouchedValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
before_send(defense-in-depth) on future builds.Parity Contract
llm_provider/backend_api/rpcmatching unchanged; only adds thecronarm.is_session_expired_message), so genuine cron failures still page — verified bysession_expired_before_send_keeps_genuine_cron_failures.Duplicate / Superseded PR Handling