Skip to content

feat(agents): stop surfacing model-fallback notice to users - #93

Merged
convyusboy merged 2 commits into
boonfrom
ridho/eng-17078-remove-model-fallback-message-shown-in-agents
Jul 31, 2026
Merged

convyusboy merged 2 commits into
boonfrom
ridho/eng-17078-remove-model-fallback-message-shown-in-agents

Conversation

@convyusboy

@convyusboy convyusboy commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The agents surface was showing users an internal operational notice whenever the runtime fell back to a backup model mid-turn, e.g.:

↪️ Model Fallback: boon-llm-gateway/claude-opus-4-7-bedrock (selected boon-llm-gateway/claude-opus-4-8-bedrock; timeout)

A self-recovering gateway timeout that swaps models mid-turn is an internal reliability detail. The turn still streams and completes normally, so surfacing a chat line just draws attention to plumbing and makes a normal fast turn look like it stalled. Deepti (via #project-rohan) asked for this to be removed from the agents UI.

Why This Change Was Made

The notice already had an audience seam (operator vs consumer), but the agents deployment runs the default operator audience — agents.defaults.messaging.audience is not set in any committed config, render.yaml, or env — so consumer-only suppression would not have hidden it there. The clean fix is to stop surfacing the notice on every audience and keep the fallback observable only where operators actually debug it: structured lifecycle events and logs.

This removes the two notice text builders (buildFallbackNotice / buildFallbackClearedNotice) and garbage-collects the now-dead internal isFallbackNotice payload flag (internal-only; not part of the plugin SDK or gateway protocol). Kept intact:

  • resolveFallbackTransition + the persisted notice-state fields (cross-turn dedupe).
  • Both emitAgentEvent lifecycle events (fallback / fallback_cleared).
  • The separate silent-fallback-failure error path (buildSilentFallbackFailurePayload), which surfaces a genuine error when the fallback produced no visible reply.

Net −92 non-test prod LOC (one canonical path, no dead flag left behind).

User Impact

  • Users no longer see any Model Fallback / Model Fallback cleared chat message on any channel. A mid-turn model swap is now invisible; the turn just completes normally.
  • No change to the genuine failure case: if a fallback produces no visible reply, the user still gets the ⚠️ … produced no visible reply error.
  • Operators retain full observability via the fallback / fallback_cleared structured lifecycle events, the model.failover diagnostic, and the openclaw_model_failover_total counter.

Evidence

  • Touched-file test runs (via scripts/run-vitest.mjs), all green:
    • src/auto-reply/fallback-state.test.ts — 14 passed
    • src/auto-reply/reply/dispatch-acp-delivery.test.ts — 31 passed
    • src/auto-reply/reply/reply-utils.test.ts — 75 passed
    • src/auto-reply/reply/dispatch-from-config.test.ts — 215 passed
    • src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts — 59 passed
  • Tests were rewritten to assert the fallback stays silent to the user while the lifecycle events still fire and the silent-failure error path is preserved.
  • git grep confirms zero remaining isFallbackNotice / buildFallbackNotice / buildFallbackClearedNotice / CONSUMER_FALLBACK references.
  • Docs updated: docs/concepts/model-failover.md now documents that fallback is invisible to users and recorded only in logs + structured events.

Known proof gaps

  • 2 pre-existing, unrelated failures remain in agent-runner.runreplyagent.e2e.test.ts ("overflow fallback" tests asserting Auto-compaction could not recover this turn, a string that no longer exists in source). Not touched by this change; worth a separate follow-up.
  • oxfmt / tsgo / check:changed could not run in this linked worktree (binaries absent). The commit used committer --fast (--no-verify) to skip the format hook; format + typecheck + changed-gate still need a Testbox run before merge.

Summary by cubic

Removed the user-visible “Model Fallback” and “Model Fallback cleared” messages in agents. Fallback swaps are now silent; transitions are tracked only via lifecycle events and logs. Aligns with Linear ENG-17078.

  • Refactors
    • Deleted the fallback notice builders and removed the isFallbackNotice flag from ReplyPayload and AgentRuntimeReplyPayload; simplified payload handling and the coalescer.
    • Removed the consumer-audience soft notice path; no audience surfaces fallback text.
    • Kept resolveFallbackTransition and persisted notice-state to dedupe lifecycle events; preserved the silent-fallback-failure error path.
    • Updated tests to assert silence across channels/verbose modes and to keep status notices out of transcripts.
    • Cleaned up docs to fully reflect silent behavior and removed contradictory notice language.

Written for commit a3a1463. Summary will update on new commits.

Review in cubic

A self-recovering mid-turn model swap is an internal reliability detail,
so the '↪️ Model Fallback:' / 'Model Fallback cleared:' chat notices are
no longer surfaced on any audience. The transition stays observable via
the structured fallback/fallback_cleared lifecycle events and logs.

Deletes the notice text builders and the now-dead internal isFallbackNotice
payload flag; keeps transition tracking, persisted notice-state dedupe, and
the separate silent-fallback-failure error path.

Requested by Deepti.
@claude

claude Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cubic analysis

All reported issues were addressed across 13 files

Linked issue analysis

Linked issue: ENG-17078: Remove Model Fallback message shown in agents

Status Acceptance criteria Notes
✅ No user-visible “Model Fallback” or “Model Fallback cleared” messages are rendered in agent replies The code that built and injected user-visible fallback notices was removed and the run path no longer composes or injects fallback notice payloads. Tests were updated to assert the absence of the fallback text in reply payloads.
✅ A forced fallback still returns the assistant response (no duplicated bubble / gap) and the swap is silent to the user E2E tests were updated to verify payloads do not contain the fallback notice and that the final/visible reply is still delivered.
✅ Fallback transitions remain observable in telemetry/lifecycle events (UI suppression only — logging/events unchanged) and deduplication of lifecycle events preserved The code that computes transitions (resolveFallbackTransition) and persisted notice-state used for dedupe is retained; tests assert lifecycle events and counts rather than user-visible text.
✅ The silent-fallback-failure path is preserved: if a fallback produces no visible reply, the user still gets an error The logic that returns the silent-failure payload is still present and the run path still checks/returns it when no visible payloads exist; tests were adapted around delivered vs. silent-failure behavior.
✅ Other agent status/system messages still render normally (rate-limit, tool-execution errors, compaction notices, etc.) The generic status-notice mechanism remains (isStatusNotice) and the tests were adjusted to ensure other notices are still delivered and excluded from transcripts as before.
❌ Previously persisted messages in history no longer show the fallback notice (or an explicit handling plan is provided if messages remain stored) The issue/test plan asked to confirm persisted messages no longer show the notice or to document intended handling (render-only suppression vs. stored content migration). The PR removes UI builders going forward but does not show code that strips or migrates previously persisted message content, nor an explicit test verifying history reload behavior.
❌ No new React warnings or console errors introduced by removing the notice rendering The test plan requested checking the browser console for React warnings/errors. The PR includes unit and e2e test updates, but there is no evidence of a browser-console check or an explicit test that would catch runtime React warnings.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread docs/concepts/model-failover.md Resolved
…ilent behavior

The 'Fallback is invisible to users' section contradicted two other passages
that still described sending a visible notice / announcing transitions in user
replies. Reword both to internal lifecycle-event + log observability, keeping
the dedupe/sticky detail.

@gandalfboon gandalfboon Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved. Clean, well-scoped removal of the user-visible Model Fallback / cleared notices, tracing directly to ENG-17078 (Deepti's #project-rohan ask).

What I checked:

  • Root cause is correctly diagnosed: the agents deployment runs the default operator audience (no committed agents.defaults.messaging.audience), so consumer-only suppression wouldn't have hidden it — removing the notice on every audience is the right fix.
  • Dead code fully garbage-collected: buildFallbackNotice / buildFallbackClearedNotice removed, isFallbackNotice dropped from ReplyPayload + AgentRuntimeReplyPayload, and the coalescer/dispatch/chat call sites cleaned up consistently.
  • Correctly PRESERVES the important seams: resolveFallbackTransition + persisted notice-state (cross-turn dedupe), both fallback/fallback_cleared lifecycle events, the model.failover diagnostic + counter, and the separate silent-fallback-FAILURE error path (no visible reply).
  • Tests rewritten properly — they now assert the swap stays silent to the user across verbose levels/channels while lifecycle events still fire once per state change and the silent-failure path is intact. Not just deleted assertions.
  • Docs (model-failover.md) updated to match, no contradictory notice language left.

Non-blocking, already flagged by the author:

  • 2 pre-existing overflow-fallback failures in agent-runner e2e are unrelated to this change (untouched tests asserting a string outside this scope) — worth a separate follow-up.
  • oxfmt / tsgo / check:changed couldn't run in the linked worktree; commit used --no-verify. Please run format + typecheck + changed-gate on Testbox before merge — that's the one thing to close out.

@convyusboy
convyusboy merged commit 4900f5a into boon Jul 31, 2026
146 of 148 checks passed
@convyusboy
convyusboy deleted the ridho/eng-17078-remove-model-fallback-message-shown-in-agents branch July 31, 2026 09:58
convyusboy added a commit that referenced this pull request Aug 3, 2026
Version-bump release carrying the 5 commits merged onto boon since boon.12:
#90 (ENG-16868), #92 (ENG-16854), #93, #94 (ENG-15788), #95 (ENG-17134).

Bumps gateway + slack + msteams + diagnostics-prometheus to
2026.6.11-boon.13 in lockstep (9 files). CI: 108 pass / 0 fail / 7 skip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant