Repository navigation
fix(local): offer a new chat when an agent thread's model cannot run it - #2175
Conversation
|
@Cedric921 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe frontend now recognizes a specific unsupported-model refusal and records it as a chat error. The error notice offers “Start a new chat” instead of Retry. Localized guidance tells users to start a new chat or choose another model. ChangesUnsupported model refusal
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Unsupported-model refusals now direct users to start a new chat instead of retrying a turn that cannot proceed; the reviewed changes show no remaining merge-blocking risk. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change provides a clearer recovery action without changing access permissions or allowing a refused request to proceed. No material security risk was identified in the changed flow. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…efusal-offers-new-chat # Conflicts: # docs/architecture/agent.md # docs/architecture/chat.md # surfsense_local/backend/modules/agent/agent_threads/turn.py # surfsense_local/frontend/src/features/agent/agent-thread.test.tsx # surfsense_local/frontend/src/features/chat/chat-error-notice.tsx # surfsense_local/frontend/src/features/chat/message.tsx # surfsense_local/frontend/src/features/chat/use-chat-runtime.ts # surfsense_local/frontend/translations/de.json # surfsense_local/frontend/translations/en.json # surfsense_local/frontend/translations/es.json # surfsense_local/frontend/translations/fr.json # surfsense_local/frontend/translations/hi.json # surfsense_local/frontend/translations/ja.json # surfsense_local/frontend/translations/ko.json # surfsense_local/frontend/translations/pt-BR.json # surfsense_local/frontend/translations/ru.json # surfsense_local/frontend/translations/zh-CN.json
…it, on dev's new-chat action
|
Merged |
…efusal-offers-new-chat # Conflicts: # docs/architecture/chat.md # surfsense_local/frontend/src/features/chat/use-chat-runtime.ts
What
When the selected model cannot run the agent, a turn sent to an agent thread used to show a generic error with Retry. It now says the thread can't continue with that model and offers Start a new chat, as the agent proposal has it.
This is built on the new-chat action
devadded for legacy threads in cf80ccf, and follows its pattern:features/agent/unsupported-model.ts:isUnsupportedModelRefusalrecognises the backend's409sentence, mirroringoutdated-thread.ts.use-chat-runtime: turns that refusal into a turn error of the frontend-only kindagent_model_unsupported, besideagent_thread_outdated.ChatErrorNotice: gives that kind the existingnew-chataction, so the reply shows "Start a new chat" and no Retry.chat_error_agent_model_unsupported, in all ten languages. It follows the glossary and the existing context-too-long wording for chat.There are no backend changes. The refusal's text is unchanged, and
unsupported-model.tsnames the backend line it mirrors.Why
docs/architecture/agent.mdlisted it under Known gaps: "A turn refused because the selected model cannot run the agent shows as an error with Retry; the composer does not offer a new thread". A thread keeps its engine, so Retry meets the same refusal, and only a new thread takes that model.Fixes
No issue. This closes that Known gaps line, which is deleted here.
agent.md(Which threads get it) andchat.md(agent threads, Sending) describe what the screen shows.How to test
New test
unsupported-model-thread.test.tsx, mirroringoutdated-agent-thread.test.tsx: the refused turn shows the notice with no Retry, and "Start a new chat" opens a new chat. It failed before the change. Agent, chat and dashboard: 126 passed.Summary by CodeRabbit