Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions frontend/src/components/workflows/AgentCodeInspector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,28 @@ describe("AgentCodeInspector", () => {
expect(onConfigChange).toHaveBeenCalledWith({ harness: "codex-cli", approvalConversationId: "conv1" });
});

it("shows and edits the primary repository's base ref as an expression-capable input", () => {
const onInputsChange = vi.fn();
render(<AgentCodeInspector {...baseProps} onInputsChange={onInputsChange} config={{ harness: "codex-cli" }} inputs={{ repositoryId: "p1", baseRef: "{{trigger.sourceBranch}}" }} />);

expect(screen.getByText("Base ref / 基础分支")).toBeInTheDocument();
const input = screen.getByLabelText("Default branch");
expect(input).toHaveValue("{{trigger.sourceBranch}}");

fireEvent.change(input, { target: { value: "release/2.x" } });

expect(onInputsChange).toHaveBeenCalledWith({ repositoryId: "p1", baseRef: "release/2.x" });
});

it("preserves baseRef when the repository workspace changes", () => {
const onInputsChange = vi.fn();
render(<AgentCodeInspector {...baseProps} onInputsChange={onInputsChange} config={{ harness: "codex-cli" }} inputs={{ repositoryId: "p1", baseRef: "release/2.x" }} />);

fireEvent.click(screen.getByText("add-row"));

expect(onInputsChange).toHaveBeenCalledWith(expect.objectContaining({ baseRef: "release/2.x" }));
});

// The picker's blank-row channel: "Add a repository" creates a row with an empty id, which neither
// repositoryId nor relatedRepositories can carry. Both directions of the wiring must therefore survive —
// feed drafts DOWN, and hand the emitted drafts back UP on onChange. Dropping either end makes the click a
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/workflows/AgentCodeInspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function AgentCodeInspector({ config, inputs, onConfigChange, onInputsCha
const credentialId = str(config.modelCredentialId);
const credentialedModelId = str(config.modelCredentialModelId);
const repositoryId = str(inputs.repositoryId);
const baseRef = str(inputs.baseRef);
const approvalConversationId = str(config.approvalConversationId);
const timeoutSeconds = typeof config.timeoutSeconds === "number" ? config.timeoutSeconds : undefined;
const network = config.network === true;
Expand Down Expand Up @@ -187,6 +188,17 @@ export function AgentCodeInspector({ config, inputs, onConfigChange, onInputsCha
<span className="wf-form-help">The first repo is the primary — the writable workspace root the agent runs in. Add more to clone alongside it for a coordinated change (e.g. a frontend + its backend).</span>
</div>

<label className="wf-form-row">
<span className="wf-form-label">Base ref / 基础分支</span>
<VariablePickerInput
value={baseRef}
onChange={(v) => onInputsChange({ ...inputs, baseRef: v })}
suggestions={suggestions}
placeholder="Default branch"
/>
<span className="wf-form-help">Branch or ref to clone the primary repository at. Leave empty for its default branch.</span>
</label>

<label className="wf-form-row">
<span className="wf-form-label">Approval conversation</span>
<ConversationSelector value={approvalConversationId} onChange={(v) => patch({ approvalConversationId: v })} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/styles/ai-code-space.css
Original file line number Diff line number Diff line change
Expand Up @@ -6309,7 +6309,7 @@ body.chat-resizing .acs-root .app { transition: none; }
/* execution map */
.room-exec { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 15px 18px 14px; }
.room-exec-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 13px; }
.room-exec-flow { display: flex; align-items: flex-start; }
.room-exec-flow { display: flex; align-items: flex-start; overflow-x: auto; overscroll-behavior-x: contain; }
.room-exec-note { margin: 13px 0 0; font-size: 11.5px; color: var(--muted); }
.room-exec-node { flex: 0 0 auto; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.room-exec-node[data-idle] { opacity: .45; }
Expand Down
Loading