Skip to content

Commit 56bcbef

Browse files
committed
fix(web): resolve permissions for the target of new threads
1 parent 8c5c457 commit 56bcbef

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ import {
153153
} from "../proposedPlan";
154154
import {
155155
DEFAULT_INTERACTION_MODE,
156-
DEFAULT_RUNTIME_MODE,
157156
DEFAULT_THREAD_TERMINAL_ID,
158157
MAX_TERMINALS_PER_GROUP,
159158
type ChatMessage,
@@ -1838,7 +1837,11 @@ export default function ChatView(props: ChatViewProps) {
18381837
// session.lastError. Bump a tick so the banner hides immediately. Mirrors
18391838
// the branch mismatch banner.
18401839
const [, setThreadErrorBannerDismissTick] = useState(0);
1841-
const runtimeMode = composerRuntimeMode ?? activeThread?.runtimeMode ?? DEFAULT_RUNTIME_MODE;
1840+
const defaultRuntimeMode = resolveProjectSettings(settings, activeThread?.projectId ?? null)
1841+
.settings.defaultRuntimeMode;
1842+
// Implicit drafts follow their current project/environment, including retargets.
1843+
// Explicit composer choices and existing server threads retain their permissions.
1844+
const runtimeMode = composerRuntimeMode ?? activeServerThread?.runtimeMode ?? defaultRuntimeMode;
18421845
const isLocalDraftThread = !isServerThread && localDraftThread !== undefined;
18431846
const canCheckoutPullRequestIntoThread = isLocalDraftThread;
18441847
const activeThreadId = activeThread?.id ?? null;
@@ -7887,7 +7890,7 @@ export default function ChatView(props: ChatViewProps) {
78877890
projectId: activeProject.id,
78887891
title: nextThreadTitle,
78897892
modelSelection: nextThreadModelSelection,
7890-
runtimeMode,
7893+
runtimeMode: defaultRuntimeMode,
78917894
interactionMode: "default",
78927895
branch: activeThreadBranch,
78937896
worktreePath: activeThread.worktreePath,
@@ -7910,7 +7913,7 @@ export default function ChatView(props: ChatViewProps) {
79107913
},
79117914
modelSelection: ctxSelectedModelSelection,
79127915
titleSeed: nextThreadTitle,
7913-
runtimeMode,
7916+
runtimeMode: defaultRuntimeMode,
79147917
interactionMode: "default",
79157918
sourceProposedPlan: {
79167919
threadId: activeThread.id,
@@ -7984,7 +7987,7 @@ export default function ChatView(props: ChatViewProps) {
79847987
isServerThread,
79857988
navigate,
79867989
resetLocalDispatch,
7987-
runtimeMode,
7990+
defaultRuntimeMode,
79887991
startThreadTurn,
79897992
environmentId,
79907993
composerRef,

0 commit comments

Comments
 (0)