fix(orchestrator): harden Grok v2 lifecycle (#3578)

Integrate the current Grok settlement, monitor/subagent lifecycle, interrupt containment, steer visibility, and image support stack into the orchestration-v2 branch.

Co-authored-by: codex <[email protected]>
This commit is contained in:
Mike Olsonandcodex authored and Julius Marminge committed 2026-08-15 16:49:58 +02:00
1 parent 0282ab8608
commit e16d4e514b
53 files changed
+15859 -985

No files matched your search

+105 -45
View File
@@ -1,17 +1,15 @@
<<<<<<< HEAD
import {
EnvironmentId,
MessageId,
ProjectId,
ProviderInstanceId,
ThreadId,
TurnId,
RunId,
TurnItemId,
type OrchestrationV2ProjectedTurnItem,
} from "@t3tools/contracts";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
=======
import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId, RunId } from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
import { describe, expect, it } from "vite-plus/test";
>>>>>>> 8f521e516e (Complete orchestration V2 frontend cutover)
import type { Thread } from "../types";
import { makeThreadFixture } from "../test-fixtures";
@@ -23,18 +21,16 @@ import {
buildLoadingThreadFromShell,
buildThreadTurnInterruptInput,
createLocalDispatchSnapshot,
deriveCommittedServerUserMessageIds,
deriveComposerSendState,
dismissBranchMismatchForSession,
ENVIRONMENT_RECONNECT_WARNING_GRACE_MS,
getStartedThreadModelChangeBlockReason,
hasEnvironmentReconnectWarningGraceElapsed,
hasServerAcknowledgedLocalDispatch,
isBranchMismatchDismissedForSession,
reconcileMountedTerminalThreadIds,
reconcileRetainedMountedThreadIds,
resolveThreadMetadataUpdateForNextTurn,
resolveSendEnvMode,
scheduleEnvironmentReconnectWarning,
startNewThreadForProject,
shouldShowBranchMismatchBanner,
shouldWriteThreadErrorToCurrentServerThread,
@@ -45,42 +41,6 @@ const projectId = ProjectId.make("project-1");
const threadId = ThreadId.make("thread-1");
const now = "2026-03-29T00:00:00.000Z";
describe("environment reconnect warning grace", () => {
afterEach(() => vi.useRealTimers());
it("shows a persistent reconnect after the grace period", () => {
vi.useFakeTimers();
const showWarning = vi.fn();
scheduleEnvironmentReconnectWarning(showWarning);
vi.advanceTimersByTime(ENVIRONMENT_RECONNECT_WARNING_GRACE_MS - 1);
expect(showWarning).not.toHaveBeenCalled();
vi.advanceTimersByTime(1);
expect(showWarning).toHaveBeenCalledOnce();
});
it("cancels the warning when the connection recovers during the grace period", () => {
vi.useFakeTimers();
const showWarning = vi.fn();
const cancel = scheduleEnvironmentReconnectWarning(showWarning);
cancel();
vi.advanceTimersByTime(ENVIRONMENT_RECONNECT_WARNING_GRACE_MS);
expect(showWarning).not.toHaveBeenCalled();
});
it("does not reuse elapsed grace from another environment", () => {
const anotherEnvironmentId = EnvironmentId.make("environment-remote");
expect(hasEnvironmentReconnectWarningGraceElapsed(environmentId, environmentId)).toBe(true);
expect(hasEnvironmentReconnectWarningGraceElapsed(anotherEnvironmentId, environmentId)).toBe(
false,
);
});
});
function makeThread(overrides: Partial<Thread> = {}): Thread {
return makeThreadFixture({
id: threadId,
@@ -714,3 +674,103 @@ describe("hasServerAcknowledgedLocalDispatch", () => {
expect(hasServerAcknowledgedLocalDispatch({ ...common, threadError: "failed" })).toBe(true);
});
});
describe("deriveCommittedServerUserMessageIds", () => {
it("tracks only committed user turn items, not assistant rows or projection-only messages", () => {
const turnStartId = MessageId.make("message-turn-start");
const steerId = MessageId.make("message-steer");
const assistantId = MessageId.make("message-assistant");
const committedAt = DateTime.makeUnsafe("2026-06-26T17:50:15.180Z");
const runId = RunId.make("run:thread:thread-1:ordinal:1");
const visibleTurnItems: ReadonlyArray<OrchestrationV2ProjectedTurnItem> = [
{
position: 0,
visibility: "local",
sourceThreadId: threadId,
sourceItemId: TurnItemId.make("turn-item:message-turn-start"),
item: {
id: TurnItemId.make("turn-item:message-turn-start"),
threadId,
runId,
nodeId: null,
providerThreadId: null,
providerTurnId: null,
nativeItemRef: null,
parentItemId: null,
ordinal: 1,
status: "completed",
title: null,
startedAt: committedAt,
completedAt: committedAt,
updatedAt: committedAt,
createdBy: "user",
creationSource: "web",
type: "user_message",
messageId: turnStartId,
inputIntent: "turn_start",
text: "start",
attachments: [],
},
},
{
position: 1,
visibility: "local",
sourceThreadId: threadId,
sourceItemId: TurnItemId.make("turn-item:message-assistant"),
item: {
id: TurnItemId.make("turn-item:message-assistant"),
threadId,
runId,
nodeId: null,
providerThreadId: null,
providerTurnId: null,
nativeItemRef: null,
parentItemId: null,
ordinal: 2,
status: "completed",
title: null,
startedAt: committedAt,
completedAt: committedAt,
updatedAt: committedAt,
type: "assistant_message",
messageId: assistantId,
text: "working",
streaming: false,
},
},
{
position: 2,
visibility: "local",
sourceThreadId: threadId,
sourceItemId: TurnItemId.make("turn-item:message-steer"),
item: {
id: TurnItemId.make("turn-item:message-steer"),
threadId,
runId,
nodeId: null,
providerThreadId: null,
providerTurnId: null,
nativeItemRef: null,
parentItemId: null,
ordinal: 3,
status: "completed",
title: null,
startedAt: committedAt,
completedAt: committedAt,
updatedAt: committedAt,
createdBy: "user",
creationSource: "web",
type: "user_message",
messageId: steerId,
inputIntent: "steer",
text: "continue",
attachments: [],
},
},
];
expect(deriveCommittedServerUserMessageIds(visibleTurnItems)).toEqual(
new Set([turnStartId, steerId]),
);
});
});
+17
View File
@@ -3,6 +3,7 @@ import {
isProviderDriverKind,
ProjectId,
type ModelSelection,
type OrchestrationV2ProjectedTurnItem,
type ProviderDriverKind,
type ServerProvider,
type ScopedProjectRef,
@@ -503,6 +504,22 @@ export function createLocalDispatchSnapshot(
};
}
/**
* The timeline renders committed user rows from `visibleTurnItems`, but
* `message.updated` can land in `projection.messages` one event earlier than
* the matching `turn-item.updated`. Basing optimistic eviction on visible user
* turn items avoids dropping steer rows in that gap.
*/
export function deriveCommittedServerUserMessageIds(
visibleTurnItems: ReadonlyArray<OrchestrationV2ProjectedTurnItem>,
): ReadonlySet<ChatMessage["id"]> {
return new Set(
visibleTurnItems.flatMap((row) =>
row.item.type === "user_message" ? [row.item.messageId] : [],
),
);
}
export function hasServerAcknowledgedLocalDispatch(input: {
localDispatch: LocalDispatchSnapshot | null;
phase: SessionPhase;
+13 -180
View File
@@ -131,7 +131,6 @@ import {
selectThreadPanelOpen,
selectThreadRightPanelState,
type RightPanelSurface,
updatePullRequestTabStatus,
useRightPanelStore,
} from "../rightPanelStore";
import {
@@ -148,11 +147,7 @@ import {
selectThreadPreviewMiniPlayer,
usePreviewMiniPlayerStore,
} from "../previewMiniPlayerStore";
import { isThreadOwnPullRequest } from "./pullRequest/pullRequestDetail.logic";
import { PullRequestDetailPanel } from "./pullRequest/PullRequestDetailPanel";
import { PullRequestDetailGhost } from "./pullRequest/PullRequestGhosts";
import { PullRequestsUnavailableState } from "./pullRequest/PullRequestsUnavailableState";
import { RightPanelTabs, type PullRequestTabStatus } from "./RightPanelTabs";
import { RightPanelTabs } from "./RightPanelTabs";
import { AgentsPanel } from "./AgentsPanel";
import {
deriveAgentPanelModel,
@@ -174,14 +169,9 @@ import {
projectScriptIdFromCommand,
} from "~/projectScripts";
import { newDraftId, newMessageId, newThreadId } from "~/lib/utils";
import { useBrowserHistoryStore } from "~/browserHistoryStore";
import { getProviderModelCapabilities, resolveSelectableProvider } from "../providerModels";
import { NO_PROVIDER_MODEL_SELECTION } from "../providerInstances";
import {
useClientSettings,
useClientSettingsHydrated,
useEnvironmentSettings,
} from "../hooks/useSettings";
import { useClientSettings, useEnvironmentSettings } from "../hooks/useSettings";
import { useNowMinute } from "../hooks/useNowMinute";
import { useNewThreadHandler } from "../hooks/useHandleNewThread";
import { resolveAppModelSelectionForInstance } from "../modelSelection";
@@ -189,7 +179,6 @@ import { getTerminalFocusOwner } from "../lib/terminalFocus";
import { preventRepeatedTerminalCloseShortcut } from "../lib/terminalCloseShortcut";
import { resolveNewDraftStartFromOrigin } from "../lib/chatThreadActions";
import {
derivePhysicalProjectKey,
deriveLogicalProjectKeyFromSettings,
selectProjectGroupingSettings,
} from "../logicalProject";
@@ -290,10 +279,9 @@ import {
buildThreadTurnInterruptInput,
collectUserMessageBlobPreviewUrls,
createLocalDispatchSnapshot,
deriveCommittedServerUserMessageIds,
deriveComposerSendState,
dismissBranchMismatchForSession,
hasEnvironmentReconnectWarningGraceElapsed,
scheduleEnvironmentReconnectWarning,
hasServerAcknowledgedLocalDispatch,
isBranchMismatchDismissedForSession,
shouldShowBranchMismatchBanner,
@@ -486,14 +474,6 @@ function shouldTypeToFocusComposer(event: KeyboardEvent): boolean {
if (eventPathContainsSelector(event, TYPE_TO_FOCUS_INTERACTIVE_SELECTOR)) return false;
if (document.querySelector(TYPE_TO_FOCUS_FLOATING_LAYER_SELECTOR)) return false;
// The right-panel surface launcher claims its shortcut letters while it is
// visible (data attribute set in RightPanelTabs); those keys open surfaces
// instead of typing into the composer.
const launcherKeys = document
.querySelector("[data-surface-launcher-keys]")
?.getAttribute("data-surface-launcher-keys");
if (launcherKeys && launcherKeys.toLowerCase().includes(event.key.toLowerCase())) return false;
return true;
}
@@ -1264,8 +1244,8 @@ function ChatViewContent(props: ChatViewProps) {
routeKind === "server" ? routeThreadRef : null,
);
const committedServerMessageIds = useMemo(
() => new Set(serverProjection?.messages.map((message) => message.id) ?? []),
[serverProjection],
() => deriveCommittedServerUserMessageIds(serverVisibleTurnItems),
[serverVisibleTurnItems],
);
const markThreadVisited = useUiStateStore((store) => store.markThreadVisited);
const activeThreadLastVisitedAt = useUiStateStore(
@@ -1582,11 +1562,11 @@ function ChatViewContent(props: ChatViewProps) {
const isLocalDraftThread = !isServerThread && localDraftThread !== undefined;
const canCheckoutPullRequestIntoThread = isLocalDraftThread;
const activeThreadId = activeThread?.id ?? null;
<<<<<<< HEAD
const activeThreadEnvironmentId = activeThread?.environmentId ?? null;
=======
const activeMessageCount = isServerThread ? committedServerMessageIds.size : 0;
>>>>>>> d849d1caf9 (Retire V1 client orchestration parity)
// Prefer the larger of turn-item-committed ids and projection messages so
// env lock does not unlock while turn items lag projection hydration.
const activeMessageCount = isServerThread
? Math.max(committedServerMessageIds.size, serverProjection?.messages.length ?? 0)
: 0;
const runningTerminalIds = useThreadRunningTerminalIds({
environmentId: activeThread?.environmentId ?? null,
threadId: activeThreadId,
@@ -1622,11 +1602,8 @@ function ChatViewContent(props: ChatViewProps) {
return labels;
}, [activeThreadKnownSessions]);
const activeThreadRef = useMemo(
() =>
activeThreadEnvironmentId && activeThreadId
? scopeThreadRef(activeThreadEnvironmentId, activeThreadId)
: null,
[activeThreadEnvironmentId, activeThreadId],
() => (activeThread ? scopeThreadRef(activeThread.environmentId, activeThread.id) : null),
[activeThread],
);
const activeThreadKey = activeThreadRef ? scopedThreadKey(activeThreadRef) : null;
const [timelineAnchor, setTimelineAnchor] = useState<{
@@ -1647,21 +1624,6 @@ function ChatViewContent(props: ChatViewProps) {
const activeRightPanelSurface = useRightPanelStore((state) =>
selectActiveRightPanelSurface(state.byThreadKey, activeThreadRef),
);
const [pullRequestTabStatuses, setPullRequestTabStatuses] = useState<
Record<string, PullRequestTabStatus>
>({});
// Keyed by the surface the panel is showing rather than by a key rebuilt from the status, so
// the tab is found again whether or not that surface was opened with an environment on it.
const activePullRequestSurfaceId =
activeRightPanelSurface?.kind === "pull-request" ? activeRightPanelSurface.id : undefined;
const handlePullRequestTabStatusChange = useCallback(
(status: PullRequestTabStatus) => {
const id = activePullRequestSurfaceId;
if (id === undefined) return;
setPullRequestTabStatuses((current) => updatePullRequestTabStatus(current, id, status));
},
[activePullRequestSurfaceId],
);
const activeFileSurface =
activeRightPanelSurface?.kind === "file" ? activeRightPanelSurface : null;
const activePreviewState = useThreadPreviewState(activeThreadRef);
@@ -1783,8 +1745,6 @@ function ChatViewContent(props: ChatViewProps) {
const activeProjectKey = activeProject
? `${activeProject.environmentId}:${activeProject.workspaceRoot}`
: null;
const projectGroupingSettings = useClientSettings(selectProjectGroupingSettings);
const clientSettingsHydrated = useClientSettingsHydrated();
const [pendingFileSurfaceIdsByProject, setPendingFileSurfaceIdsByProject] = useState<
ReadonlyMap<string, ReadonlySet<string>>
>(() => new Map());
@@ -1823,54 +1783,11 @@ function ChatViewContent(props: ChatViewProps) {
// drive the environment picker in BranchToolbar.
const allProjects = useProjects();
const primaryEnvironmentId = primaryEnvironment?.environmentId ?? null;
useEffect(() => {
if (!clientSettingsHydrated || !activeThreadRef || !activeProject) return;
// Reuse the sidebar's grouping so history follows the project rows the user
// sees. Deriving the key from the active project alone would miss the
// identity a duplicate row borrows from its siblings.
const logicalKeyByPhysicalKey = buildPhysicalToLogicalProjectKeyMap({
projects: allProjects,
settings: projectGroupingSettings,
primaryEnvironmentId,
});
useBrowserHistoryStore
.getState()
.registerThreadProject(
activeThreadRef,
logicalKeyByPhysicalKey.get(derivePhysicalProjectKey(activeProject)) ??
deriveLogicalProjectKeyFromSettings(activeProject, projectGroupingSettings),
);
}, [
activeProject,
activeThreadRef,
allProjects,
clientSettingsHydrated,
primaryEnvironmentId,
projectGroupingSettings,
]);
const activeEnvironment =
activeThread == null ? null : (environmentById.get(activeThread.environmentId) ?? null);
const activeEnvironmentConnectionPhase = activeEnvironment?.connection.phase ?? "available";
const activeEnvironmentUnavailable =
activeEnvironment !== null && activeEnvironmentConnectionPhase !== "connected";
const activeReconnectingEnvironmentId =
activeEnvironmentConnectionPhase === "connecting" ||
activeEnvironmentConnectionPhase === "reconnecting"
? (activeEnvironment?.environmentId ?? null)
: null;
const [reconnectWarningGraceElapsedEnvironmentId, setReconnectWarningGraceElapsedEnvironmentId] =
useState<EnvironmentId | null>(null);
const reconnectWarningGraceElapsed = hasEnvironmentReconnectWarningGraceElapsed(
activeReconnectingEnvironmentId,
reconnectWarningGraceElapsedEnvironmentId,
);
useEffect(() => {
setReconnectWarningGraceElapsedEnvironmentId(null);
if (activeReconnectingEnvironmentId === null) return;
return scheduleEnvironmentReconnectWarning(() =>
setReconnectWarningGraceElapsedEnvironmentId(activeReconnectingEnvironmentId),
);
}, [activeReconnectingEnvironmentId]);
const activeEnvironmentUnavailableLabel = activeEnvironment?.label ?? null;
const activeEnvironmentUnavailableState = useMemo<EnvironmentUnavailableState | null>(() => {
if (!activeEnvironmentUnavailable || !activeEnvironmentUnavailableLabel || !activeEnvironment) {
@@ -1899,6 +1816,7 @@ function ChatViewContent(props: ChatViewProps) {
},
[retryEnvironment],
);
const projectGroupingSettings = selectProjectGroupingSettings(settings);
const logicalProjectEnvironments = useMemo(() => {
if (!activeProject) return [];
const logicalKey = deriveLogicalProjectKeyFromSettings(activeProject, projectGroupingSettings);
@@ -2052,8 +1970,6 @@ function ChatViewContent(props: ChatViewProps) {
const serverConfig = activeThread
? (activeEnvironment?.serverConfig ?? null)
: (primaryEnvironment?.serverConfig ?? null);
const pullRequestsCapabilityKnown = serverConfig !== null;
const supportsPullRequests = serverConfig?.environment.capabilities.pullRequests === true;
const versionMismatch = resolveServerConfigVersionMismatch(serverConfig);
const versionMismatchDismissKey =
versionMismatch && activeThread
@@ -3167,27 +3083,6 @@ function ChatViewContent(props: ChatViewProps) {
},
[activeProject, activeThreadRef],
);
// The thread's own change request, placed against the project it belongs to. Without a
// project there is nothing to resolve it against, so the caller falls back to the browser.
const threadRepository = activeProject?.repositoryIdentity?.displayName ?? null;
const openThreadPullRequest = useCallback(
(number: number) => {
if (
!supportsPullRequests ||
!activeThreadRef ||
!activeProject ||
threadRepository === null
) {
return;
}
useRightPanelStore.getState().openPullRequest(activeThreadRef, {
projectId: activeProject.id,
repository: threadRepository,
number,
});
},
[activeProject, activeThreadRef, supportsPullRequests, threadRepository],
);
const togglePreviewPanel = useCallback(() => {
if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;
if (previewPanelOpen) {
@@ -4029,14 +3924,6 @@ function ChatViewContent(props: ChatViewProps) {
threadBranch: activeThread?.branch ?? null,
gitStatus: gitStatusQuery.data ?? null,
});
// The right panel offers the thread's own change request, so it can only offer it once the
// branch has one; until then the picker says so rather than opening an empty panel.
const addPullRequestSurface = useCallback(() => {
if (activeThreadPr === null) return;
openThreadPullRequest(activeThreadPr.number);
}, [activeThreadPr, openThreadPullRequest]);
const pullRequestSurfaceAvailable =
supportsPullRequests && activeThreadPr !== null && threadRepository !== null;
const supportsSettlement = serverConfig?.environment.capabilities.threadSettlement === true;
const supportsSnooze = serverConfig?.environment.capabilities.threadSnooze === true;
const nowMinute = useNowMinute();
@@ -4760,7 +4647,6 @@ function ChatViewContent(props: ChatViewProps) {
"This will discard newer messages and turn diffs in this thread.",
"This action cannot be undone.",
].join("\n"),
{ variant: "destructive" },
);
if (!confirmed) {
return;
@@ -6157,47 +6043,6 @@ function ChatViewContent(props: ChatViewProps) {
initialGitScope={initialDiffPanelGitScope}
/>
</Suspense>
) : activeRightPanelSurface?.kind === "pull-request" && !pullRequestsCapabilityKnown ? (
<PullRequestDetailGhost />
) : activeRightPanelSurface?.kind === "pull-request" && !supportsPullRequests ? (
<PullRequestsUnavailableState
title="Pull requests unavailable"
error="Update this environment's T3 Code server to browse pull requests."
/>
) : activeRightPanelSurface?.kind === "pull-request" ? (
// No onClose: the surface tab's own X owns closing here, and a second X in the header
// would be the same action twice. The thread context also drops the checkout button, so it
// is only right for the thread's own pull request, whose branch is already under the
// reader's feet. A link the agent wrote can open any other one here, and that one has to be
// checkable out like it is anywhere else.
<PullRequestDetailPanel
key={`${activeRightPanelSurface.repository}#${activeRightPanelSurface.number}`}
environmentId={activeThread.environmentId}
reference={{
projectId: activeRightPanelSurface.projectId as ProjectId,
repository: activeRightPanelSurface.repository,
number: activeRightPanelSurface.number,
}}
context={
isThreadOwnPullRequest(
{
projectId: activeProject?.id ?? null,
repository: threadRepository,
number: activeThreadPr?.number ?? null,
},
{
projectId: activeRightPanelSurface.projectId,
repository: activeRightPanelSurface.repository,
number: activeRightPanelSurface.number,
},
)
? "thread"
: "page"
}
chromeVariant="collapse"
composerDraftTarget={composerDraftTarget}
onStateChange={handlePullRequestTabStatusChange}
/>
) : activeRightPanelSurface?.kind === "agents" ? (
<AgentsPanel
model={agentPanelModel}
@@ -6668,16 +6513,10 @@ function ChatViewContent(props: ChatViewProps) {
onAddTerminal={addTerminalSurface}
onAddDiff={addDiffSurface}
onAddFiles={addFilesSurface}
onAddPullRequest={addPullRequestSurface}
onAddAgents={addAgentsSurface}
browserAvailable={isPreviewSupportedInRuntime()}
terminalAvailable={activeProject !== null}
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
pullRequestAvailable={pullRequestSurfaceAvailable}
agentsAvailable
pullRequestStatuses={pullRequestTabStatuses}
liveAgentCount={agentPanelModel.liveCount}
>
{rightPanelContent}
</RightPanelTabs>
@@ -6703,16 +6542,10 @@ function ChatViewContent(props: ChatViewProps) {
onAddTerminal={addTerminalSurface}
onAddDiff={addDiffSurface}
onAddFiles={addFilesSurface}
onAddPullRequest={addPullRequestSurface}
onAddAgents={addAgentsSurface}
browserAvailable={isPreviewSupportedInRuntime()}
terminalAvailable={activeProject !== null}
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
pullRequestAvailable={pullRequestSurfaceAvailable}
agentsAvailable
pullRequestStatuses={pullRequestTabStatuses}
liveAgentCount={agentPanelModel.liveCount}
>
{rightPanelContent}
</RightPanelTabs>
@@ -1352,10 +1352,6 @@ function ProposedPlanTimelineRow({
type V2EventTone = "muted" | "warning" | "danger" | "success";
function subagentDisplayTitle(title: string): string {
return title.replace(/^Subagent:\s*/i, "");
}
function v2EventPresentation(item: OrchestrationV2TurnItem): {
readonly label: string;
readonly detail: string | null;
@@ -1412,14 +1408,6 @@ function v2EventPresentation(item: OrchestrationV2TurnItem): {
icon: MinusIcon,
};
}
case "subagent":
return {
label: subagentDisplayTitle(item.title ?? "Subagent"),
detail: item.result ?? item.progress ?? item.prompt,
tone:
item.status === "failed" ? "danger" : item.status === "completed" ? "success" : "muted",
icon: BotIcon,
};
case "approval_request":
return {
label: "Approval requested",
@@ -1494,7 +1482,14 @@ function V2EventTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "event"
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
<span className="text-xs font-medium text-foreground/90">{presentation.label}</span>
{item.status !== "completed" ? (
<span className="rounded-full border border-border/70 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground">
<span
className={cn(
"rounded-full border px-1.5 py-0.5 font-mono text-[10px]",
item.status === "failed"
? "border-destructive/40 text-destructive"
: "border-border/70 text-muted-foreground",
)}
>
{item.status}
</span>
) : null}
@@ -2290,8 +2285,19 @@ function workEntryPreview(
workEntry: Pick<TimelineWorkEntry, "detail" | "command" | "changedFiles">,
workspaceRoot: string | undefined,
) {
// Prefer stdout/detail so completed shell/monitor results are visible collapsed
// (command alone hid ls listings behind expand-only inspector JSON).
if (workEntry.detail?.trim()) {
const lines = workEntry.detail
.trim()
.split(/\r?\n/)
.map((line) => line.trim())
.filter((line) => line.length > 0);
if (lines.length > 0) {
return lines.slice(0, 3).join(" · ");
}
}
if (workEntry.command) return workEntry.command;
if (workEntry.detail) return workEntry.detail;
if ((workEntry.changedFiles?.length ?? 0) === 0) return null;
const [firstPath] = workEntry.changedFiles ?? [];
if (!firstPath) return null;
+7
View File
@@ -517,6 +517,13 @@ describe("chat/editor shortcuts", () => {
platform: "Linux",
}),
);
assert.isFalse(
isOpenFavoriteEditorShortcut(
event({ key: "o", metaKey: true, repeat: true }),
DEFAULT_BINDINGS,
{ platform: "MacIntel" },
),
);
});
it("matches commandPalette.toggle shortcut outside terminal focus", () => {
+5 -1
View File
@@ -14,6 +14,7 @@ export interface ShortcutEventLike {
type?: string;
code?: string;
key: string;
repeat?: boolean;
metaKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
@@ -446,7 +447,10 @@ export function isOpenFavoriteEditorShortcut(
keybindings: ResolvedKeybindingsConfig,
options?: ShortcutMatchOptions,
): boolean {
return matchesCommandShortcut(event, keybindings, "editor.openFavorite", options);
return (
event.repeat !== true &&
matchesCommandShortcut(event, keybindings, "editor.openFavorite", options)
);
}
export function isTerminalClearShortcut(