Skip to content

Per-chat reasoning effort in contextual sheet#8674

Open
YoussefKeyrouz wants to merge 1 commit into
feature/youssef/update_model_and_reasoning_picker_per_chatfrom
feature/youssef/per_contextual_chat_reasoning
Open

Per-chat reasoning effort in contextual sheet#8674
YoussefKeyrouz wants to merge 1 commit into
feature/youssef/update_model_and_reasoning_picker_per_chatfrom
feature/youssef/per_contextual_chat_reasoning

Conversation

@YoussefKeyrouz
Copy link
Copy Markdown
Collaborator

@YoussefKeyrouz YoussefKeyrouz commented May 22, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/1212810093780571/task/1215062229903137?focus=true

Description

Wires the contextual Duck.ai sheet into the per-chat reasoning flow introduced by #8666 and fixes two correctness bugs

  • Minor cleanup in ReasoningModePickerViewModel

Steps to test this PR

Per-chat scope restored on reopen

  • Start a chat in the contextual sheet on tab A; pick a non-default model and reasoning effort; submit a prompt.
  • Close the contextual sheet.
  • Open new duck ai on another tab or submit a prompt via the native input field using a new model (global default changes)
  • Reopen the contextual sheet on tab A (within the session window). Verify the picker reflects the reasoning effort, not the global default)
  • Submit another prompt; confirm that the submission carries the chat's modelId and reasoningEffort.
  • Open another tab and start a new chat in the contextual sheet on tab B
  • Switching between tabs properly restore the reasoning effort of the corresponding chat.

Globals untouched

  • After any per-chat submission above, dismiss the sheet and open Duck.ai from the address bar (or a fresh tab). Verify your global defaults are unchanged.

Note

Medium Risk
Moderate risk because it changes contextual sheet state management and how the native input widget resolves per-chat model/reasoning, which can affect prompt submission and session restore behavior.

Overview
Adds a chatId StateFlow to DuckChatContextualViewModel, extracted from the contextual webview URL and cleared on new-chat, so the UI can reliably identify the active chat across reopen/restore flows.

Wires that chatId into the contextual native input path by passing a chatIdFlow through DuckChatContextualFragment/ContextualNativeInputManager into NativeInputModeWidget.bindChatIdSource, enabling per-chat reasoning/model resolution in the native input picker. Includes a small correctness/cleanup tweak in ReasoningModePickerViewModel (single snapshot of modelState) and adds unit tests covering chatId lifecycle (initial, restore, page-load updates, and clearing).

Reviewed by Cursor Bugbot for commit 7159e2d. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@YoussefKeyrouz YoussefKeyrouz force-pushed the feature/youssef/per_contextual_chat_reasoning branch from 4d75802 to 7ce9eef Compare May 22, 2026 19:26
@YoussefKeyrouz YoussefKeyrouz force-pushed the feature/youssef/update_model_and_reasoning_picker_per_chat branch from b60ace4 to 2882db3 Compare May 22, 2026 19:26
@YoussefKeyrouz YoussefKeyrouz force-pushed the feature/youssef/per_contextual_chat_reasoning branch from 7ce9eef to 7159e2d Compare May 22, 2026 19:54
@YoussefKeyrouz YoussefKeyrouz force-pushed the feature/youssef/update_model_and_reasoning_picker_per_chat branch from 2882db3 to 6f9a5f1 Compare May 22, 2026 19:54
@YoussefKeyrouz YoussefKeyrouz requested a review from malmstein May 22, 2026 20:09
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.

2 participants