Skip to content

fix: keep session-read failures from switching models - #188080

Merged
shakkernerd merged 1 commit into
mainfrom
session-read-fallback-classification
Oct 30, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
session-read-fallback-classification

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #188064

What Problem This Solves

A local session-read consistency failure could consume the next configured model fallback. The fallback runner treated SessionEntryChangedDuringReadError as an unknown provider failure, even though switching models does not repair the underlying local read. A successful fallback could conceal that incorrect routing.

User Impact

Session-read failures now retain the selected model and propagate through the existing local failure path. Existing bounded recovery stays with the reader, including the final serialized transcript read used after repeated contention. If a read still cannot be accepted, the conversation retains its existing check-before-retry guidance and accepted input remains available to a fresh authorized continuation. Genuine provider failures continue to use configured fallback.

No retry policy, configuration, credentials, storage format, or permissions change. This correction does not claim to fix the producer of every session-read conflict.

Why This Change Was Made

The existing runtime-coordination classifier already owns this distinction. Adding the named exception there keeps fallback decisions, embedded prompt handling and diagnostics aligned, including errors preserved through worker serialization and cleanup wrappers. The implementation adds one production entry, with no additional recovery mechanism.

Evidence

  • The current-base regression drives the real ordered session-entry reader, native metadata writer and runWithModelFallback. A metadata change invalidates the prepared snapshot before consumption. On base 8dad19d8b7b, the runner incorrectly completes on the configured fallback with reason unknown. With the fix, the original local error propagates, no fallback is attempted, and a fresh admitted attempt reads current metadata and the original committed input on the selected model.
  • The terminal-boundary suite covers the actual worker-error encode/decode path around a read failure and cleanup error, plus genuine provider-failure, cancellation and lifecycle controls. The current transcript-reader suite also confirms that repeated ordinary contention still completes through its serialized recovery.
  • Changed formatting/lint, refreshed type-graph discovery, both affected agent test-type graphs and all 41 cases in those three focused files passed on this tree. The new regression's measured file duration was 10.99 seconds, including imports/setup. Earlier unchanged classifier/caller proof is retained separately. Exact-head hosted CI and independent engineering review passed; the hosted review found no actionable defects and retains the in-process/historical-live proof limits below. The 96-line allocation covers distinct native read/fallback and worker-error transport regressions and leaves the shared ceiling unchanged.
  • Existing natural guest evidence independently demonstrated both incorrect fallback and an ordinary terminal failure followed by one successful Try again, preserving the original input and failure record. This is retained recovery evidence, not a claim that the natural failure was reproduced on this PR. The original invalidating writer and provider-request phase remain unknown.

@shakkernerd shakkernerd self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 30, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR classifies session-entry read invalidation as local coordination failure so it cannot trigger another model candidate.

Example: The ordered reader loads the saved input “Plan the museum visit” while a native writer changes the session label to “Planning”.

  • Before: The read error is classified as unknown, allowing fixture-provider/selected to advance to fixture-next/fallback.
  • After: The local error propagates without fallback, and a fresh admitted attempt reads the updated label and saved input on fixture-provider/selected.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with meaningful production-owner regressions and no code findings; behavioral evidence remains in-process rather than a demonstrated shipped entry point.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; supplied validation exercises the real ordered reader, native writer, fallback runner, and worker-error codec, while natural guest recovery evidence is explicitly historical.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An agent turn can switch to another configured model because of a local session-read failure unrelated to provider health.
Reason: The maintainer-authored direction restores the documented local-coordination contract with one production entry and leaves the underlying read-recovery owner intact.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it narrowly repairs a current fallback-classification defect, and maintainer authorship also protects it from cleanup closure. No introduced correctness or security defect was found; required CI remains pending.

Priority: P2
Reviewed head: 726374d03a98bd3142bc6b273c9e04d78dbf6a89

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No current-head shipped Gateway or CLI capture demonstrates this exact invalidation and subsequent recovery; supplied validation exercises production owners in process.
Agent review details

How this fits together

The agent fallback layer receives errors from session preparation and provider execution, classifies them, and either preserves a local failure or advances to a configured model candidate.

flowchart TD
  A[Session reader] --> B[Error transport and wrappers]
  B --> C[Coordination classifier]
  C --> D[Model fallback runner]
  D -->|Local coordination error| E[Preserve original failure]
  D -->|Eligible provider failure| F[Next configured model]
Loading

Technical review

Best possible solution:

Merge this minimal classifier repair after required CI succeeds, retaining reader-owned recovery and genuine provider fallback.

Do we have a high-confidence way to reproduce the issue?

Current source establishes the native invalidation producer, missing main-branch classification, and fallback path; the author reports base-red/head-green production-owner coverage, while this read-only review executed no target code.

Is this the best way to solve the issue?

The existing coordination classifier is the correct owner, and adding this identity is the smallest complete repair without changing read admission, bounded recovery, or provider policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5055329484a2.

Provenance checked

  • Local session failures at the model-fallback boundary keeps the original intent (fix: stop model fallback on session admission races #179347: Session-state changes must preserve local error identity instead of reporting healthy providers as failed; the later transcript-fence repair follows the same policy.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6ddf5a6 adds src/agents/failover-error.ts:684 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6ddf5a6106c1; files: src/agents/failover-error.ts)
  • Dallin Romney: Raw commit 4f6dfcb adds src/config/sessions/session-entry-read-errors.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4f6dfcb693d1; files: src/config/sessions/session-entry-read-errors.ts)
  • sunlit-deng: Raw commit bef193c adds src/agents/failover-error.ts:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: bef193c521b7; files: src/agents/failover-error.ts)

PR surface

Source +1, Tests +96, Docs +4, Other +2. Total +103 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 2 96 0 +96
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 103 0 +103

Review metrics

Metric Value Why it matters
Production versus regression-test growth Production +1; tests +96 The single classifier entry is supported by distinct native-reader and worker-error-transport regressions, with an exact 96-line allocation and unchanged shared ceiling.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A local consistency failure can unexpectedly change the answering model, with no demonstrated lost work or broad outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-30T04:01:33.202Z sha cafdd81 :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 12:37 AM ET / 04:37 UTC (Revision 2).

@shakkernerd
shakkernerd force-pushed the session-read-fallback-classification branch from cafdd81 to 726374d Compare October 30, 2026 04:29
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@shakkernerd
shakkernerd merged commit 80b9e7b into main Oct 30, 2026
149 of 150 checks passed
@shakkernerd
shakkernerd deleted the session-read-fallback-classification branch October 30, 2026 05:02
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: session read invalidation no longer consumes a configured model fallback.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
Keep session read invalidation from consuming a configured model fallback while preserving existing recovery.

Fixes openclaw#188064.
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Backport the existing coordination-error identity without changing reader
recovery, provider policy, or persistent state.

Source: 80b9e7b

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local session-read errors consume configured model fallbacks

1 participant