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
6 changes: 3 additions & 3 deletions frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1398,11 +1398,11 @@
"starting": "Starting…",
"live": "Listening",
"noteHosted": "This is how it will appear in the pod. The face follows the name.",
"noteByo": "Appears in the pod once your runtime connects with the token."
"noteByo": "Appears in the pod once your runtime connects with the token.",
"noteMachine": "Appears in the pod once the daemon on {{machine}} starts it."
},
"persona": {
"hiring": "Hiring",
"none": "No colleague selected — this is the blank-agent path."
"hiring": "Hiring"
},
"machine": {
"online": "online",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1458,11 +1458,11 @@
"starting": "正在启动…",
"live": "监听中",
"noteHosted": "这就是它在 Pod 中的样子。头像跟随名字生成。",
"noteByo": "你的运行时使用令牌连接后即会出现在 Pod 中。"
"noteByo": "你的运行时使用令牌连接后即会出现在 Pod 中。",
"noteMachine": "{{machine}} 上的守护进程启动它后即会出现在 Pod 中。"
},
"persona": {
"hiring": "正在雇佣",
"none": "还没有选择同事——这是空白智能体路径。"
"hiring": "正在雇佣"
},
"machine": {
"online": "在线",
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/v2/__tests__/V2AgentBYOMachine.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ describe('BYO on-my-computer mode', () => {
expect(screen.getByTestId('byo-machine-select')).toHaveTextContent('Sam’s MacBook');
});

test('the preview note names the daemon machine in "on my computer" mode (#TASK-163)', async () => {
// Before TASK-163 the note read "Appears in the pod once your runtime
// connects with the token" in EVERY non-hosted mode, and this mode issues
// no token at all — ux-lead measured it drawing README frame 5. The name
// is derived once from machines+machineId, so this pins that it FOLLOWS
// the picker rather than merely being present.
const second = { id: 'm2', machineId: 'mach-b', name: 'Studio', status: 'online', agentStates: [] };
mockGet({ machines: [machineRow, second] });
renderPage();
await waitFor(() => expect(screen.getByTestId('byo-mode-machine')).toBeInTheDocument());

// Default mode is 'byo', where the token wording is still correct.
expect(screen.getByTestId('byo-preview')).toHaveTextContent('Appears in the pod once your runtime connects with the token.');

fireEvent.click(screen.getByTestId('byo-mode-machine'));
expect(screen.getByTestId('byo-preview')).toHaveTextContent('Appears in the pod once the daemon on Sam’s MacBook starts it.');

fireEvent.change(screen.getByTestId('byo-machine-select'), { target: { value: 'mach-b' } });
expect(screen.getByTestId('byo-preview')).toHaveTextContent('Appears in the pod once the daemon on Studio starts it.');
});

test('no machines — no card, and the one-paste setup panel shows instead', async () => {
mockGet({ machines: [] });
renderPage();
Expand Down
25 changes: 16 additions & 9 deletions frontend/src/v2/__tests__/V2AgentBYOPersona.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Sam (2026-09-01): "Hire an agent" and "Add a computer" converged on this
// page with the persona silently dropped. Pinned: a ?persona= param renders
// a context card, names the agent after the persona, and the
// install request records the choice; the bare entry says nobody was picked.
// install request records the choice. The bare entry renders no persona
// block at all: TASK-163 removed the "No colleague selected" notice, which
// described a catalog choice this page cannot offer (nothing in src links
// ?persona= since #1534), while the ?persona= reader above stays live.
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
Expand Down Expand Up @@ -77,22 +80,26 @@ describe('BYO persona carry-through', () => {
expect(context).toHaveTextContent(card.oneLiner);
// Agent name field is seeded from the persona, not the generic default.
expect(screen.getByDisplayValue(`sam-${card.key}`)).toBeInTheDocument();
expect(screen.queryByTestId('byo-persona-none')).toBeNull();
});

test('the bare entry says no colleague was selected without linking to the retired catalog', async () => {
test('the bare entry renders no persona block, and does not link to the retired catalog', async () => {
mockGet();
renderPage();
await waitFor(() => expect(screen.getByTestId('byo-persona-none')).toBeInTheDocument());
expect(screen.getByText('No colleague selected — this is the blank-agent path.')).toBeInTheDocument();
const { container } = renderPage();
// Absence IS the assertion here (TASK-163). The old notice rendered on
// every entry without ?persona=, and its testid is gone with it, so a
// queryByTestId('byo-persona-none') would now be vacuously null — hence
// the class query plus the positive proof that the page still rendered.
await waitFor(() => expect(screen.getByDisplayValue('sam-agent')).toBeInTheDocument());
expect(container.querySelector('.v2-byo__persona')).toBeNull();
expect(screen.queryByRole('button', { name: /browse colleagues/i })).toBeNull();
expect(screen.getByDisplayValue('sam-agent')).toBeInTheDocument();
});

test('an unknown persona key falls back to the bare entry, not a crash', async () => {
window.history.pushState({}, '', '/v2/agents/byo?persona=not-a-real-persona');
mockGet();
renderPage();
await waitFor(() => expect(screen.getByTestId('byo-persona-none')).toBeInTheDocument());
const { container } = renderPage();
await waitFor(() => expect(screen.getByDisplayValue('sam-agent')).toBeInTheDocument());
expect(container.querySelector('.v2-byo__persona')).toBeNull();
expect(container.querySelector('.v2-byo__form')).toBeInTheDocument();
});
});
20 changes: 13 additions & 7 deletions frontend/src/v2/components/V2AgentBYO.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const V2AgentBYO: React.FC = () => {
// daemon on the chosen machine adopts, provisions, and starts the agent.
const [machines, setMachines] = useState<MachineRow[]>([]);
const [machineId, setMachineId] = useState<string>('');
// One lookup, two readers (TASK-163): the preview note and the placement
// payload must name the SAME machine, so it is derived once here rather
// than restated at each call site.
const selectedMachineName = machines.find((m) => m.machineId === machineId)?.name || machineId;
// Model choice for the on-my-computer path. Aliases, not version-pinned
// ids: the seat runs on the USER's own CLI install, whose model ids move —
// 'opus'/'sonnet'/'haiku' stay valid across releases. Empty = the
Expand Down Expand Up @@ -364,7 +368,7 @@ const V2AgentBYO: React.FC = () => {
setPlaced({
agentName: cleanName,
machineId,
machineName: machines.find((m) => m.machineId === machineId)?.name || machineId,
machineName: selectedMachineName,
});
} catch (err) {
const e = err as { response?: { data?: { error?: string; message?: string } }; message?: string };
Expand Down Expand Up @@ -602,11 +606,6 @@ const V2AgentBYO: React.FC = () => {
</div>
</div>
)}
{!issued && !hosted && !personaCard && (
<div className="v2-byo__persona v2-byo__persona--none" data-testid="byo-persona-none">
<span>{t('agentByo.persona.none')}</span>
</div>
)}
{!issued && !hosted && !placed && (
<div className="v2-byo__form">
{(hosting?.configured || machines.length > 0) && (
Expand Down Expand Up @@ -992,7 +991,14 @@ const V2AgentBYO: React.FC = () => {
</div>
</div>
<p className="v2-byo__preview-note">
{mode === 'hosted' ? t('agentByo.preview.noteHosted') : t('agentByo.preview.noteByo')}
{mode === 'hosted'
? t('agentByo.preview.noteHosted')
: mode === 'machine'
// "On my computer" issues no runtime token — the daemon on the
// chosen machine starts the seat. Saying "token" here described
// the wrong path (TASK-163, found drawing README frame 5).
? t('agentByo.preview.noteMachine', { machine: selectedMachineName })
: t('agentByo.preview.noteByo')}
</p>
</aside>
</div>
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/v2/v2.css
Original file line number Diff line number Diff line change
Expand Up @@ -5951,11 +5951,6 @@ body.modern-ui.v2-canvas {
border-radius: 12px;
background: var(--v2-surface);
}
.v2-byo__persona--none {
justify-content: space-between;
font-size: 13px;
color: var(--v2-text-tertiary);
}
.v2-byo__persona-body { min-width: 0; flex: 1; }
.v2-byo__persona-title {
font-size: 14px;
Expand Down
Loading