From 0d53603d9efe305548410a551ffb7c7aa74e4b3e Mon Sep 17 00:00:00 2001 From: nntrivi2001 Date: Thu, 27 Aug 2026 10:53:03 +0700 Subject: [PATCH] fix(run): update file headers to reflect per-tool setup, add resume-last test --- client/src/components/run/LaneConsolePane.tsx | 18 ++++++++++-------- client/src/components/run/RunSetup.tsx | 15 +++++++++------ .../components/run/__tests__/RunSetup.test.tsx | 11 +++++++++++ client/src/pages/Workspace.tsx | 13 +++++++------ 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/client/src/components/run/LaneConsolePane.tsx b/client/src/components/run/LaneConsolePane.tsx index e8849700..8e3d0ea3 100644 --- a/client/src/components/run/LaneConsolePane.tsx +++ b/client/src/components/run/LaneConsolePane.tsx @@ -3,16 +3,18 @@ * @description One lane's run console: the RunSetup ↔ TerminalView switcher, * moved out of Workspace.tsx so the Workspace page can render 1, 2, or 4 of * these side by side (split terminal view). Owns its own prompt/cwd/model/ - * permissionMode/effort/resumeSession/handle/busy/runHistory state — nothing - * is shared between panes. `lanes`, `binaryStatus`, `cwdSuggestions`, - * `activeRuns`, and `externalSessions` are supplied as props because they are global, not - * lane-specific, and fetching them per pane would mean N redundant identical - * requests for an N-pane layout. + * permissionMode/effort/sandbox/approval/resumeSession/handle/busy/runHistory + * state — nothing is shared between panes. `lanes`, `binaryStatus`, + * `cwdSuggestions`, `activeRuns`, and `externalSessions` are supplied as props + * because they are global, not lane-specific, and fetching them per pane would + * mean N redundant identical requests for an N-pane layout. `binaryStatus` is + * keyed by tool (claude | codex) and probed once globally, so gating the Start + * button uses the binary status for the lane's configured tool. * * That state is bound to the lane the pane currently shows: switching `laneId` - * swaps the whole pane over to the new lane — its cwd, its history, and its - * live tmux session — instead of leaving the previous lane's terminal on - * screen under a new lane's header. + * swaps the whole pane over to the new lane — its cwd, its tool, its history, + * and its live tmux session — instead of leaving the previous lane's terminal + * on screen under a new lane's header. * @author Nguyễn Ngọc Trí Vĩ */ diff --git a/client/src/components/run/RunSetup.tsx b/client/src/components/run/RunSetup.tsx index 4ccbdf4a..d323a33d 100644 --- a/client/src/components/run/RunSetup.tsx +++ b/client/src/components/run/RunSetup.tsx @@ -6,12 +6,15 @@ * * What lives here: * - `RunSetup` — fresh-vs-resume source, the prompt editor, and the cwd / - * model / permission-mode / effort fields, plus the concurrency hint and - * the Start button. Its disabled state is driven by the `binaryFound` prop, - * so a missing `claude` binary is a surfaced state here rather than a probe - * of its own. Picking a session to resume starts that run immediately — - * a resume carries its own history, so there is nothing to type first; - * the prompt stays optional for resumes and required for fresh runs. + * model / effort fields, plus per-tool advanced fields (permission-mode for + * Claude; sandbox and approval for Codex), plus the concurrency hint and + * the Start button. Its disabled state is driven by the `binaryFound` prop + * for the lane's tool, so a missing binary is a surfaced state here rather + * than a probe of its own. Picking a session to resume starts that run + * immediately — a resume carries its own history, so there is nothing to + * type first; the prompt stays optional for resumes and required for fresh + * runs. Codex lanes show a "resume --last" button instead of the session + * picker (no sessions in the dashboard database to list). * - the pickers the panel owns: `CwdAutocomplete`, `SessionPicker`, * `ModelPicker`, and the small `Field` layout helper. * diff --git a/client/src/components/run/__tests__/RunSetup.test.tsx b/client/src/components/run/__tests__/RunSetup.test.tsx index 0ab3ff77..0ea399a3 100644 --- a/client/src/components/run/__tests__/RunSetup.test.tsx +++ b/client/src/components/run/__tests__/RunSetup.test.tsx @@ -329,4 +329,15 @@ describe("RunSetup — per-tool fields", () => { ); expect(onStart.mock.calls[0]?.[0]?.permissionMode).toBeUndefined(); }); + + it("calls onResumeLast when a codex lane's resume-last button is clicked", async () => { + const onResumeLast = vi.fn(); + const user = userEvent.setup(); + renderSetup({ tool: "codex", onResumeLast }); + // Switch to resume mode + fireEvent.click(screen.getByText(i18n.t("run:resume.resumeOption"))); + // Click the resume-last button + await user.click(screen.getByText(i18n.t("run:resume.lastOption"))); + expect(onResumeLast).toHaveBeenCalled(); + }); }); diff --git a/client/src/pages/Workspace.tsx b/client/src/pages/Workspace.tsx index a12671cd..3cb521ab 100644 --- a/client/src/pages/Workspace.tsx +++ b/client/src/pages/Workspace.tsx @@ -1,12 +1,13 @@ /** * @file Workspace.tsx * @description Merged workspace page combining lanes (agent work units) and runs - * (Claude Code spawns). Displays a horizontal lane strip at the top with counters, - * the selected lane's pipeline map, and run configuration/console/history below. - * Runs are tied to lanes: starting a run posts to POST /api/lanes/:id/start. - * When a cwd isn't owned by any lane, calls POST /api/lanes/ensure first. - * Polls GET /api/sessions?status=active alongside the run list so Claude Code - * sessions started outside the dashboard also appear in the active-runs list. + * (CLI spawns: Claude Code or Codex, determined per lane). Displays a horizontal + * lane strip at the top with counters, the selected lane's pipeline map, and run + * configuration/console/history below. Runs are tied to lanes: starting a run + * posts to POST /api/lanes/:id/start with tool-appropriate fields. When a cwd + * isn't owned by any lane, calls POST /api/lanes/ensure first. Polls GET + * /api/sessions?status=active alongside the run list so Claude Code sessions + * started outside the dashboard also appear in the active-runs list. * * @author Nguyễn Ngọc Trí Vĩ */