session: clear auto-sourced model/auth overrides on /new and /reset#69419
Conversation
Greptile SummaryThis PR fixes a bug (#69301) where Confidence Score: 5/5Safe to merge — the fix is well-scoped, mirrors existing gateway behavior, and the regression test is seeded with the exact issue scenario. All findings are P2 or informational. The core logic in resolveResetPreservedSelection is correct: it preserves user-sourced overrides and legacy undefined-source model overrides while clearing auto-sourced ones, which exactly matches the gateway path that was already in production. The new modelOverrideSource threading is additive and tested. No files require special attention — the asymmetry between model and auth legacy-source handling is intentional and matches the pre-existing gateway path. Reviews (1): Last reviewed commit: "session: clear auto-sourced model/auth o..." | Re-trigger Greptile |
|
Carrying auto-created model/auth overrides across |
102492c to
00b8a2f
Compare
|
Landed via rebase. Thanks @sk7n4k3d. Validation:
Source head before merge: |
Fixes #69301.
Summary
/newand/resetin channel-bound auto-reply sessions (Telegram DM, group chats, etc.) currently carry over every persisted override — including auto-created ones from runtime fallbacks (rate-limit auth rotation, auto model pin). That left sessions stuck on e.g.openai-codex / gpt-5.4even after the user reset and the default was something else entirely.The Gateway
performGatewaySessionResetpath already had the right logic — it only preserves overrides sourced as"user"(plus legacy entries where the source field predates tracking). The auto-reply reset path insrc/auto-reply/reply/session.tswas doing a blind copy and never wired that logic through.This PR:
resolveResetPreservedSelectionintosrc/config/sessions/reset-preserved-selection.tsso both reset paths share one source of truth./new//reset, user-set overrides still carry across.modelOverrideSourcethrough thepersisted*locals so the field actually round-trips (it was being dropped silently before, which was part of the same class of bug).providerOverride: openai-codex,modelOverride: gpt-5.4,modelOverrideSource: auto,authProfileOverrideSource: auto) and asserts all four clear after/newand/reset, while unrelated behavior overrides (verboseLevel) still carry.Test plan
pnpm test src/auto-reply/reply/session.test.ts— 68 passed (including new regression case).pnpm check:changed— typecheck / lint / import-cycles clean; only pre-existing failures remain (missing Chrome in CI env, locale-dependentformatNextRun).authProfileOverrideSource: "user") still passes — user-set overrides are correctly preserved via the shared helper's legacy backfill.Developed with AI (Claude Code) assistance; reviewed and validated end-to-end against the issue's evidence (
~/.openclaw/agents/main/sessions/sessions.jsonsample).