diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx
index 958cb3743c..2ccaf4144e 100644
--- a/apps/web/src/components/BranchToolbar.tsx
+++ b/apps/web/src/components/BranchToolbar.tsx
@@ -24,6 +24,7 @@ import {
import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector";
import { BranchToolbarEnvironmentSelector } from "./BranchToolbarEnvironmentSelector";
import { BranchToolbarEnvModeSelector } from "./BranchToolbarEnvModeSelector";
+import { ProjectFavicon } from "./ProjectFavicon";
import { Button } from "./ui/button";
import {
Menu,
@@ -240,6 +241,21 @@ export const BranchToolbar = memo(function BranchToolbar({
return (
+ {/* The submit target leads the run-context strip: this is the one
+ surface where "which project am I about to send this to" must be
+ answered before the first keystroke, especially on drafts.
+ Mirrors the sidebar cards' title bar — favicon + mono name. */}
+
+
+
+ {activeProject.title}
+
+
+
{isMobile ? (
{
});
describe("sortThreadsForSidebarV2", () => {
- const sortable = (input: {
- id: string;
- hasPendingApprovals?: boolean;
- latestUserMessageAt: string;
- updatedAt?: string;
- }) => ({
+ const sortable = (input: { id: string; createdAt: string }) => ({
id: input.id,
- hasPendingApprovals: input.hasPendingApprovals ?? false,
- session: null,
- createdAt: "2026-03-09T10:00:00.000Z",
- updatedAt: input.updatedAt ?? input.latestUserMessageAt,
- latestUserMessageAt: input.latestUserMessageAt,
+ createdAt: input.createdAt,
});
- it("pins approval-blocked threads above the recency flow, longest wait first", () => {
+ it("orders by creation time, newest first, ignoring activity", () => {
const sorted = sortThreadsForSidebarV2([
- sortable({ id: "fresh", latestUserMessageAt: "2026-03-09T12:00:00.000Z" }),
- sortable({
- id: "approval-new",
- hasPendingApprovals: true,
- latestUserMessageAt: "2026-03-09T08:00:00.000Z",
- updatedAt: "2026-03-09T11:00:00.000Z",
- }),
- sortable({
- id: "approval-old",
- hasPendingApprovals: true,
- latestUserMessageAt: "2026-03-09T11:30:00.000Z",
- updatedAt: "2026-03-09T09:00:00.000Z",
- }),
- sortable({ id: "stale", latestUserMessageAt: "2026-03-09T08:00:00.000Z" }),
+ sortable({ id: "oldest", createdAt: "2026-03-09T08:00:00.000Z" }),
+ sortable({ id: "newest", createdAt: "2026-03-09T12:00:00.000Z" }),
+ sortable({ id: "middle", createdAt: "2026-03-09T10:00:00.000Z" }),
]);
- expect(sorted.map((thread) => thread.id)).toEqual([
- "approval-old",
- "approval-new",
- "fresh",
- "stale",
+ expect(sorted.map((thread) => thread.id)).toEqual(["newest", "middle", "oldest"]);
+ });
+
+ it("breaks creation-time ties by id so the order is stable", () => {
+ const sorted = sortThreadsForSidebarV2([
+ sortable({ id: "b", createdAt: "2026-03-09T10:00:00.000Z" }),
+ sortable({ id: "a", createdAt: "2026-03-09T10:00:00.000Z" }),
]);
+
+ expect(sorted.map((thread) => thread.id)).toEqual(["a", "b"]);
});
});
diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts
index bce7c48be0..d240b57d7d 100644
--- a/apps/web/src/components/Sidebar.logic.ts
+++ b/apps/web/src/components/Sidebar.logic.ts
@@ -379,29 +379,17 @@ export function resolveSidebarV2Status(thread: SidebarV2StatusInput): SidebarV2S
return "ready";
}
-// v2 sort: approval-blocked threads pin above the recency flow, longest wait
-// first, so nothing actionable can scroll away. Everything else is recency.
+// v2 sort: static creation order, newest thread on top. Activity NEVER
+// reorders the list — a row holds its position from open until settled, so
+// the screen only moves at lifecycle transitions. Status (including pending
+// approval) is carried by each card's edge strip, not by position.
export function sortThreadsForSidebarV2<
- T extends SidebarV2StatusInput & ThreadSortInput & { readonly id: string },
+ T extends { readonly id: string; readonly createdAt: string },
>(threads: readonly T[]): T[] {
- return [...threads].toSorted((left, right) => {
- const leftApproval = resolveSidebarV2Status(left) === "approval";
- const rightApproval = resolveSidebarV2Status(right) === "approval";
- if (leftApproval !== rightApproval) {
- return leftApproval ? -1 : 1;
- }
- // Approval activities update the shell's updatedAt in the projection
- // pipeline, making it the best available request-time proxy. Oldest waits
- // pin first. (The shell does not expose the approval request timestamp.)
- if (leftApproval && rightApproval) {
- return (
- Date.parse(left.updatedAt) - Date.parse(right.updatedAt) || left.id.localeCompare(right.id)
- );
- }
- const byRecency =
- getThreadSortTimestamp(right, "updated_at") - getThreadSortTimestamp(left, "updated_at");
- return byRecency || left.id.localeCompare(right.id);
- });
+ return [...threads].toSorted(
+ (left, right) =>
+ Date.parse(right.createdAt) - Date.parse(left.createdAt) || left.id.localeCompare(right.id),
+ );
}
export function resolveThreadStatusPill(input: {
diff --git a/apps/web/src/components/SidebarV2.tsx b/apps/web/src/components/SidebarV2.tsx
index 67057d5553..b5bab64576 100644
--- a/apps/web/src/components/SidebarV2.tsx
+++ b/apps/web/src/components/SidebarV2.tsx
@@ -140,15 +140,16 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
// Slim rows are either settled (action: un-settle) or merely quiet
// (seen Ready threads — action: settle).
variantAction: "settle" | "unsettle";
- // Draws a hairline above the first quiet row after the card block, so the
- // active island and the history tail read as separate zones (mock's
- // SETTLED rule) without a labeled section header.
+ // Draws a hairline above the first settled row after a group's card
+ // block, so active work and the history tail read as separate zones
+ // inside each project section.
showQuietDivider?: boolean;
isActive: boolean;
jumpLabel: string | null;
currentEnvironmentId: string | null;
environmentLabel: string | null;
projectCwd: string | null;
+ projectTitle: string | null;
providerEntryByInstanceId: ReadonlyMap;
onThreadClick: (event: ReactMouseEvent, threadRef: ScopedThreadRef) => void;
onThreadActivate: (threadRef: ScopedThreadRef) => void;
@@ -310,14 +311,6 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
: "hover:bg-foreground/5 dark:hover:bg-white/[0.06]",
);
- const favicon = (
-
- );
-
const title = isRenaming ? (
- {/* Settled history recedes: desaturated and dimmed at rest, restored
- on hover so the tail stays scannable when you're hunting. */}
+ {/* Settled history recedes: dimmed favicon at rest, restored on
+ hover so the tail stays scannable when you're hunting. */}
- {favicon}
+
{title}
{prBadge}
@@ -445,14 +442,14 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
return (
{statusEdge ? (
-
+
) : null}
-
-
{favicon}
- {title}
- {diff ? (
-
- +{diff.insertions}{" "}
- −{diff.deletions}
+ {/* Title bar: the card is a tiny window whose chrome carries project
+ identity — favicon + name up top, separated by a hairline, so
+ "which project" reads before the thread content does. */}
+
+
+ {props.projectTitle ? (
+
+ {props.projectTitle}
) : null}
-
+
{props.jumpLabel ?? workingTimer ?? threadTimeLabel(thread, status)}
@@ -491,68 +500,79 @@ const SidebarV2Row = memo(function SidebarV2Row(props: {
type="button"
aria-label="Settle thread"
onClick={handleSettleClick}
- className="absolute inset-y-0 right-0 inline-flex items-center gap-1 border border-border bg-background px-2 text-[11px] text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover/v2-row:opacity-100"
+ className="absolute inset-y-0 right-0 inline-flex items-center gap-1 border border-border bg-background px-2 text-[10px] text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover/v2-row:opacity-100"
>
Settle
-
- {statusWord ? (
-
- {statusWord.label}
-
- ) : null}
- {status === "failed" && thread.session?.lastError ? (
-
- {thread.session.lastError}
-
- ) : (
- <>
- {thread.branch ? (
-
- {thread.branch}
-
+
+
+ {title}
+ {diff ? (
+
+ +{diff.insertions}{" "}
+ −{diff.deletions}
+
+ ) : null}
+
+
+ {statusWord ? (
+
+ {statusWord.label}
+
+ ) : null}
+ {status === "failed" && thread.session?.lastError ? (
+
+ {thread.session.lastError}
+
+ ) : (
+ <>
+ {thread.branch ? (
+
+ {thread.branch}
+
+ ) : null}
+ {prBadge}
+ >
+ )}
+
+ {driverKind ? (
+
+ }
+ >
+
+
+ {thread.modelSelection.model}
+
) : null}
- {prBadge}
- >
- )}
-
- {driverKind ? (
-
- }
- >
-
-
- {thread.modelSelection.model}
-
- ) : null}
- {isRemote ? (
-
-
- }
- >
-
-
-
- Running on {props.environmentLabel ?? "a remote environment"}
-
-
- ) : null}
-
+ {isRemote ? (
+
+
+ }
+ >
+
+
+
+ Running on {props.environmentLabel ?? "a remote environment"}
+
+
+ ) : null}
+
+
@@ -622,6 +642,11 @@ export default function SidebarV2() {
),
[projects],
);
+ const projectTitleByKey = useMemo(
+ () =>
+ new Map(projects.map((project) => [`${project.environmentId}:${project.id}`, project.title])),
+ [projects],
+ );
// now is quantized to the minute so effectiveSettled memoization doesn't
// churn on every render; auto-settle thresholds are day-granular anyway.
@@ -1344,6 +1369,9 @@ export default function SidebarV2() {
projectCwd={
projectCwdByKey.get(`${thread.environmentId}:${thread.projectId}`) ?? null
}
+ projectTitle={
+ projectTitleByKey.get(`${thread.environmentId}:${thread.projectId}`) ?? null
+ }
providerEntryByInstanceId={providerEntryByInstanceId}
onThreadClick={handleThreadClick}
onThreadActivate={navigateToThread}
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx
index 5f9aec837c..b568dc6208 100644
--- a/apps/web/src/components/chat/ChatComposer.tsx
+++ b/apps/web/src/components/chat/ChatComposer.tsx
@@ -2049,7 +2049,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
>
{!isComposerCollapsedMobile &&
(activePendingApproval ? (
-
+
) : pendingUserInputs.length > 0 ? (
-
+
) : showPlanFollowUpPrompt && activeProposedPlan ? (
-
+
) : isComposerCollapsedMobile && pendingUserInputs.length > 0 ? (
| undefined;
preferredScriptId: string | null;
@@ -58,6 +60,7 @@ export const ChatHeader = memo(function ChatHeader({
draftId,
activeThreadTitle,
activeProjectName,
+ activeProjectCwd,
openInCwd,
activeProjectScripts,
preferredScriptId,
@@ -79,6 +82,27 @@ export const ChatHeader = memo(function ChatHeader({
return (
+ {/* The project always leads the header: knowing which project a
+ thread lives in is priority zero, and the thread title alone
+ doesn't answer it. Mirrors the sidebar cards' title bar —
+ favicon + mono uppercase name. */}
+ {activeProjectName ? (
+
+
+
+
+ {activeProjectName}
+
+
+
+ /
+
+
+ ) : null}