Per-chat reasoning effort in contextual sheet#8674
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4d75802 to
7ce9eef
Compare
b60ace4 to
2882db3
Compare
7ce9eef to
7159e2d
Compare
2882db3 to
6f9a5f1
Compare
malmstein
left a comment
There was a problem hiding this comment.
tested locally and confirmed it works as expected.
clean wire-up of contextual into the per-chat reasoning flow. nice that this PR also fixes the fullModeUrl correctness gap on the existing-chat-restore and new-chat-clear paths — easy to miss those were never being assigned before. the ReasoningModePickerViewModel.onModeTapped snapshot of modelState is a small but real win against the chance of a fetchModels emission landing mid-handler.
main note is the fullModeUrl / _chatId pair-assignment drift risk below. separately worth keeping on the radar: PR #8631 (still open) adds Uri.toChatIdOrNull(duckChat) in duckchat-api doing similar parsing — once it lands, both this PR's extractChatId and any other in-flight extractors could converge on the api extension. not blocking either way.
note for outcome tracking: the model-fallback asymmetry I flagged on #8666 (L161, getSelectedModelId vs getResolvedReasoningEffort when chat's model isn't in modelState) isn't touched here — that one's still pending on #8666's side.
| } else { | ||
| withContext(dispatchers.main()) { | ||
| fullModeUrl = existingChatUrl | ||
| _chatId.value = extractChatId(existingChatUrl) |
There was a problem hiding this comment.
nit: fullModeUrl = ...; _chatId.value = extractChatId(...) is now repeated at L190-191, L243-244, and L289+292 (and a clearing pair at L649-650). a future addition that sets a new sheet URL but forgets the chatId update would silently break per-chat resolution. can we wrap this in a private helper like setSheetUrl(url: String?) that owns both fields, plus a clearSheetUrl() for the new-chat path? keeps the invariant in one place.
There was a problem hiding this comment.
Good catch. Addressed.
7159e2d to
9f586f9
Compare
6f9a5f1 to
caae8f5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9f586f9. Configure here.
9f586f9 to
b204f93
Compare
b204f93 to
666691b
Compare


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
ReasoningModePickerViewModelSteps to test this PR
Per-chat scope restored on reopen
Globals untouched
Note
Medium Risk
Medium risk because it changes contextual sheet state management and URL/chat-id tracking, which can affect session restore behavior and what model/reasoning settings get applied to submissions.
Overview
Wires the contextual Duck.ai sheet to a per-chat identifier by extracting
chatIDfrom the webview URL and exposing it as aStateFlowonDuckChatContextualViewModel.The contextual native input widget now receives this
chatIdFlow(viaContextualNativeInputManager.init) and binds it into the native-input state, enabling chat-scoped reasoning/model selection to follow the active chat across sheet reopen/tab switches. The view model centralizes URL/chat-id updates viasetSheetUrl/clearSheetUrland adds tests to ensurechatIdis set/cleared correctly;ReasoningModePickerViewModelis lightly refactored to use a single snapshot ofmodelState, with tests adjusted accordingly.Reviewed by Cursor Bugbot for commit 666691b. Bugbot is set up for automated code reviews on this repo. Configure here.