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
16 changes: 15 additions & 1 deletion propr-ui/src/pages/GoalsPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ describe('GoalsPage', () => {
expect(await screen.findByText('Goal detail')).toBeInTheDocument();
});

it('hides unsupported runtime diagnostics when at least one agent supports goals', async () => {
vi.mocked(goalsApi.getGoalCapabilities).mockResolvedValue({ agents: [
capability,
{ ...capability, agentId: 'agent-2', agentAlias: 'opencode', agentType: 'opencode', goalCapable: false, reason: 'OpenCode does not support goal sessions' },
] });
render(<MemoryRouter initialEntries={['/goals']}><Routes><Route path="/goals" element={<GoalsPage />} /></Routes></MemoryRouter>);

await screen.findByRole('option', { name: 'codex' });
expect(screen.getByRole('option', { name: 'opencode — unsupported' })).toBeDisabled();
expect(screen.queryByText('OpenCode does not support goal sessions')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Recheck runtimes' })).not.toBeInTheDocument();
});

it('shows each unsupported provider reason, gates creation, and can recheck runtimes', async () => {
vi.mocked(goalsApi.getGoalCapabilities)
.mockResolvedValueOnce({ agents: [
Expand All @@ -75,7 +88,8 @@ describe('GoalsPage', () => {
] })
.mockResolvedValueOnce({ agents: [capability] });
render(<MemoryRouter initialEntries={['/goals']}><Routes><Route path="/goals" element={<GoalsPage />} /></Routes></MemoryRouter>);
expect(await screen.findByText('Codex schema lacks thread/goal/clear')).toBeInTheDocument();
expect(await screen.findByText('No configured coding-agent runtime currently supports goals.')).toBeInTheDocument();
expect(screen.getByText('Codex schema lacks thread/goal/clear')).toBeInTheDocument();
expect(screen.getByText('Antigravity lacks --conversation')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Start goal' })).toBeDisabled();
fireEvent.click(screen.getByRole('button', { name: 'Recheck runtimes' }));
Expand Down
5 changes: 3 additions & 2 deletions propr-ui/src/pages/GoalsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function CreateGoalForm({ onCreated }: { onCreated: (goal: Goal) => void }) {
const [error, setError] = useState<string | null>(null);
const selectedAgent = agents.find(agent => agent.agentId === agentId);
const unsupportedAgents = agents.filter(agent => !agent.goalCapable);
const showRuntimeDiagnostics = agents.length > 0 && unsupportedAgents.length === agents.length;

const applyCapabilities = useCallback((capabilities: GoalCapability[]) => {
setAgents(capabilities);
Expand Down Expand Up @@ -99,8 +100,8 @@ function CreateGoalForm({ onCreated }: { onCreated: (goal: Goal) => void }) {
<form onSubmit={submit} className="rounded-lg border border-slate-200 bg-white p-5 shadow-sm">
<h2 className="mb-4 flex items-center gap-2 text-lg font-semibold"><Plus className="h-5 w-5" /> Start a goal</h2>
{error && <p role="alert" className="mb-3 text-sm text-red-600">{error}</p>}
{unsupportedAgents.length > 0 && <div className="mb-3 rounded bg-amber-50 p-3 text-sm text-amber-800">
<p>{unsupportedAgents.length === agents.length ? 'No configured coding-agent runtime currently supports goals.' : 'Some configured coding-agent runtimes do not support goals.'}</p>
{showRuntimeDiagnostics && <div className="mb-3 rounded bg-amber-50 p-3 text-sm text-amber-800">
<p>No configured coding-agent runtime currently supports goals.</p>
<ul className="mt-2 list-disc space-y-1 pl-5">
{unsupportedAgents.map(agent => <li key={agent.agentId}><span className="font-medium">{agent.agentAlias}:</span> {agent.reason || 'Required goal/session transport is unavailable'}</li>)}
</ul>
Expand Down
Loading