Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Reject unsupported Assistant session diff/revert
rcourtman738fc4eb1315
diff --git a/docs/API.md b/docs/API.mdindex 332499d71b..4145f53b05 100644--- a/docs/API.md+++ b/docs/API.md@@ -983,10 +983,11 @@ Streaming variant of execute (used by the UI for incremental responses).- `GET /api/ai/sessions/{id}/messages`- `POST /api/ai/sessions/{id}/abort`- `POST /api/ai/sessions/{id}/summarize`-- `GET /api/ai/sessions/{id}/diff`- `POST /api/ai/sessions/{id}/fork`-- `POST /api/ai/sessions/{id}/revert`-- `POST /api/ai/sessions/{id}/unrevert`+- Legacy OpenCode-style file-change routes (`GET /api/ai/sessions/{id}/diff`,+ `POST /api/ai/sessions/{id}/revert`, `POST /api/ai/sessions/{id}/unrevert`)+ return `501 Not Implemented`; Pulse Assistant sessions do not own file diffs+ or file-level revert.### Question Answers- `POST /api/ai/question/{id}/answer`diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 97da38e5ca..d65383245c 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -1560,6 +1560,12 @@ The restored prompt, redo availability flag, and restored message count areconversation repair metadata only; lifecycle-adjacent surfaces must not treatthem as agent enrollment state, command authorization, update readiness, orfleet-control evidence.+Legacy OpenCode-style Assistant file-change routes under+`/api/ai/sessions/{id}/diff`, `/revert`, and `/unrevert` are not+agent-lifecycle operations. If those routes are called directly, the API must+fail them as unsupported rather than presenting file diffs or reverts as+agent command rollback, enrollment repair, update rollback, or fleet-control+authority.That same shared dependency now also assumes hosted cloud handoff authorizestenant org access before browser lifecycle continues. Lifecycle-adjacent opensinto hosted workspaces may depend on `internal/api/cloud_handoff_handlers.go`,diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 2b8aa0403a..ecad15199d 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -38,12 +38,11 @@ leave the transcript without exposing hidden provider/tool metadata.14. `frontend-modern/src/utils/aiCostPresentation.ts`15. `frontend-modern/src/utils/aiProviderHealthPresentation.ts`16. `frontend-modern/src/utils/aiProviderPresentation.ts`-17. `frontend-modern/src/utils/aiSessionDiffPresentation.ts`-18. `frontend-modern/src/utils/textPresentation.ts`-19. `frontend-modern/src/stores/aiRuntimeState.ts`-20. `frontend-modern/src/stores/aiChat.ts`-21. `docs/AI.md`-22. `pkg/aicontracts/investigation.go`+17. `frontend-modern/src/utils/textPresentation.ts`+18. `frontend-modern/src/stores/aiRuntimeState.ts`+19. `frontend-modern/src/stores/aiChat.ts`+20. `docs/AI.md`+21. `pkg/aicontracts/investigation.go`## Shared Boundaries@@ -1264,6 +1263,14 @@ leave the transcript without exposing hidden provider/tool metadata.tool-result relationships remain intact inside the fork. Forking must notmutate the source session, must continue through normal session list/loadcontracts, and must not return `not_implemented` from the local runtime.+ OpenCode-style session file diff/revert workflows do not apply to Pulse+ Assistant sessions: Pulse does not own local code-file edits, and+ infrastructure mutations are governed through approval/action history. The+ Settings maintenance surface must not advertise session file changes or+ session revert actions, and legacy direct calls to+ `/api/ai/sessions/{id}/diff`, `/revert`, and `/unrevert` must fail+ explicitly with `501 Not Implemented` rather than returning a success-shaped+ placeholder.The picker trigger and result rows are part of that source-backed workflow:the trigger must expose its accessible name and expanded state, opening thepicker must focus search, and each result must be a keyboard-addressable@@ -1375,7 +1382,7 @@ leave the transcript without exposing hidden provider/tool metadata.require an explicit `allow_broad_scope` request from a dedicated rulemanagement surface.5. Add or change AI usage/cost dashboard presentation through `frontend-modern/src/components/AI/AICostDashboard.tsx` and `frontend-modern/src/utils/aiCostPresentation.ts`-6. Add or change AI provider, control-level, or chat/session presentation through `frontend-modern/src/components/AI/Chat/`, `frontend-modern/src/utils/aiProviderPresentation.ts`, `frontend-modern/src/utils/aiProviderHealthPresentation.ts`, `frontend-modern/src/utils/aiControlLevelPresentation.ts`, `frontend-modern/src/utils/aiChatPresentation.ts`, and `frontend-modern/src/utils/aiSessionDiffPresentation.ts`+6. Add or change AI provider, control-level, or chat/session presentation through `frontend-modern/src/components/AI/Chat/`, `frontend-modern/src/utils/aiProviderPresentation.ts`, `frontend-modern/src/utils/aiProviderHealthPresentation.ts`, `frontend-modern/src/utils/aiControlLevelPresentation.ts`, and `frontend-modern/src/utils/aiChatPresentation.ts`AI provider/model presentation must preserve the model transport route whenthe selected provider is a gateway. OpenRouter-routed model IDs such as`openrouter:deepseek/...` must render with an explicit `via OpenRouter`@@ -2693,12 +2700,11 @@ helpers used across chat, settings, and usage surfaces.`frontend-modern/src/utils/aiProviderPresentation.ts`,`frontend-modern/src/utils/aiProviderHealthPresentation.ts`,`frontend-modern/src/utils/aiControlLevelPresentation.ts`,-`frontend-modern/src/utils/aiChatPresentation.ts`,-`frontend-modern/src/utils/aiSessionDiffPresentation.ts` are the canonical owners+`frontend-modern/src/utils/aiChatPresentation.ts` are the canonical ownersfor provider naming, provider health labels, control-level semantics,chat drawer title/subtitle, launcher title/aria copy, session-menu labeling,discovery hint framing, chat/session empty states, assistant message and-question-card labels, and session-diff badges.+question-card labels.Settings and chat surfaces must consume those helpers instead of keeping localAI wording or model/provider inference branches.Assistant chat must not render Pulse-authored explore pre-pass cards ordiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 360b5a4b2a..64656cab7f 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -505,6 +505,15 @@ payload shape change when the portal presents compact client rows.shared `AIChatAPI.undoLastTurn(sessionId)` and`AIChatAPI.redoLastTurn(sessionId)` helpers so path encoding and responseshape stay canonical.+ OpenCode-style file diff/revert session routes are deliberately not part+ of Pulse's supported Assistant session contract: Pulse sessions do not own+ local code-file edits, and infrastructure mutations must be reviewed+ through governed approval/action history. Browser clients must not expose+ or call `GET /api/ai/sessions/{id}/diff`,+ `POST /api/ai/sessions/{id}/revert`, or+ `POST /api/ai/sessions/{id}/unrevert`; legacy direct calls to those routes+ return `501 Not Implemented` with an explicit unsupported message rather+ than a placeholder success payload.Resource-context follow-up turns are different from Patrol-run rehydration:browser-safe `handoff_metadata.kind=resource_context` must not replace astored rich handoff envelope with a partial metadata-only envelope, and thediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex b8312d35d1..2775269184 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -998,7 +998,11 @@ not a replacement status card, CTA band, or page-local nested card.as execution permissions and session maintenance, must stay explicitlylabeled as Pulse Assistant controls, while Patrol schedule and autonomycontinue to live on Patrol-owned surfaces rather than drifting back into- the shared settings shell. Shared/default model choices may remain on the+ the shared settings shell. Session maintenance in that shell is limited to+ Pulse-owned conversation operations such as summarization; OpenCode-style+ file diff, revert, or unrevert actions must not appear in Settings unless+ Pulse owns a real governed infrastructure action-history/reversal contract+ for the affected resources. Shared/default model choices may remain on thecombined shell only when Assistant, Patrol, and Discovery overrides arepresented as explicit per-surface overrides instead of a generic advancedAI bucket. Each per-surface override must fall back to the shared defaultdiff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex f55a0f2c91..c833e6c94b 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -1107,7 +1107,6 @@"frontend-modern/src/utils/aiCostPresentation.ts","frontend-modern/src/utils/aiProviderHealthPresentation.ts","frontend-modern/src/utils/aiProviderPresentation.ts",- "frontend-modern/src/utils/aiSessionDiffPresentation.ts","internal/api/ai_handler.go","internal/api/ai_handlers.go","internal/api/ai_intelligence_handlers.go",@@ -1184,8 +1183,7 @@"frontend-modern/src/utils/aiChatPresentation.ts","frontend-modern/src/utils/aiControlLevelPresentation.ts","frontend-modern/src/utils/aiProviderHealthPresentation.ts",- "frontend-modern/src/utils/aiProviderPresentation.ts",- "frontend-modern/src/utils/aiSessionDiffPresentation.ts"+ "frontend-modern/src/utils/aiProviderPresentation.ts"],"allow_same_subsystem_tests": false,"test_prefixes": [],@@ -1194,7 +1192,6 @@"frontend-modern/src/utils/__tests__/aiControlLevelPresentation.test.ts","frontend-modern/src/utils/__tests__/aiProviderHealthPresentation.test.ts","frontend-modern/src/utils/__tests__/aiProviderPresentation.test.ts",- "frontend-modern/src/utils/__tests__/aiSessionDiffPresentation.test.ts","frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts"]},diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex d1ff891d6b..aa25eff107 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -221,6 +221,12 @@ state only. A restored prompt or restored message count may help an operatorcontinue a protected-item investigation, but it must not become backup coverageevidence, recovery freshness, restore entitlement, storage-owner identity,approval policy, or a provider-local recovery command handoff.+Legacy OpenCode-style Assistant file-change routes under+`/api/ai/sessions/{id}/diff`, `/revert`, and `/unrevert` are not+storage/recovery rollback operations. If those routes are called directly, the+API must fail them as unsupported rather than presenting file diffs or reverts+as backup rollback, restore eligibility, recovery freshness, storage-owner+identity, or provider-local recovery authority.Mock-mode Assistant chat startup through `internal/api/ai_handler.go` is alsoonly adjacent AI/runtime proof for storage/recovery consumers. The handler mayenable the Assistant runtime in memory during mock mode so the typed mock SSEdiff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.tsindex c8bbca9154..8a87813fa3 100644--- a/frontend-modern/src/api/__tests__/aiChat.test.ts+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts@@ -1,4 +1,5 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import aiChatSource from '../aiChat.ts?raw';vi.mock('@/utils/apiClient', () => ({apiFetchJSON: vi.fn(),@@ -958,6 +959,22 @@ describe('AIChatAPI', () => {});});+ it('does not expose unsupported file-change session operations from the browser client', () => {+ expect('getSessionDiff' in AIChatAPI).toBe(false);+ expect('revertSession' in AIChatAPI).toBe(false);+ expect('unrevertSession' in AIChatAPI).toBe(false);++ expect(aiChatSource).toContain('/summarize');+ expect(aiChatSource).toContain('/fork');+ expect(aiChatSource).toContain('/undo');+ expect(aiChatSource).toContain('/redo');+ expect(aiChatSource).not.toContain('SessionDiff');+ expect(aiChatSource).not.toContain('FileChange');+ expect(aiChatSource).not.toContain('/diff');+ expect(aiChatSource).not.toContain('/revert');+ expect(aiChatSource).not.toContain('/unrevert');+ });+it('preserves restored Assistant tool evidence on session messages', async () => {const messages = [{diff --git a/frontend-modern/src/api/aiChat.ts b/frontend-modern/src/api/aiChat.tsindex ea8e14e09f..d17803ea44 100644--- a/frontend-modern/src/api/aiChat.ts+++ b/frontend-modern/src/api/aiChat.ts@@ -200,20 +200,6 @@ export interface Agent {};}-// File change from a session-export interface FileChange {- path: string;- status: 'added' | 'modified' | 'deleted';- added: number;- removed: number;-}--// Session diff showing all file changes-export interface SessionDiff {- files: FileChange[];- summary?: string;-}-export class AIChatAPI {private static baseUrl = '/api/ai';@@ -321,13 +307,6 @@ export class AIChatAPI {}) as Promise<ChatSessionCompactionResult>;}- // Get file changes/diff for a session- static async getSessionDiff(sessionId: string): Promise<SessionDiff> {- return apiFetchJSON(- `${this.baseUrl}/sessions/${encodeURIComponent(sessionId)}/diff`,- ) as Promise<SessionDiff>;- }-// Fork a session (create a branch point)static async forkSession(sessionId: string): Promise<ChatSession> {return apiFetchJSON(`${this.baseUrl}/sessions/${encodeURIComponent(sessionId)}/fork`, {@@ -349,20 +328,6 @@ export class AIChatAPI {}) as Promise<ChatSessionRedoResult>;}- // Revert session changes- static async revertSession(sessionId: string): Promise<{ success: boolean }> {- return apiFetchJSON(`${this.baseUrl}/sessions/${encodeURIComponent(sessionId)}/revert`, {- method: 'POST',- }) as Promise<{ success: boolean }>;- }-- // Unrevert session changes (redo)- static async unrevertSession(sessionId: string): Promise<{ success: boolean }> {- return apiFetchJSON(`${this.baseUrl}/sessions/${encodeURIComponent(sessionId)}/unrevert`, {- method: 'POST',- }) as Promise<{ success: boolean }>;- }-// Stream chat - the main chat interfacestatic async chat(prompt: string,diff --git a/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx b/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsxindex c5218a539e..5418b2152a 100644--- a/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx+++ b/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx@@ -57,8 +57,8 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps><Show when={state.showChatMaintenance()}><div class="px-3 py-3 bg-surface border-t border-border space-y-3"><p class="text-xs text-muted">- Summarize, inspect, or revert a specific Pulse Assistant session. It does not change- Patrol settings or your shared provider and model defaults.+ Summarize a specific Pulse Assistant session without changing Patrol settings or your+ shared provider and model defaults.</p><div class="flex items-center justify-between"><label class="text-xs font-medium text-muted">Session</label>@@ -122,25 +122,9 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps>? 'Summarizing...': 'Summarize session'}</button>- <button- type="button"- onClick={state.handleSessionDiff}- disabled={!state.selectedSessionId() || state.sessionActionLoading() !== null}- class="w-full sm:w-auto min-h-10 sm:min-h-9 px-3 py-2 text-sm font-medium rounded border border-border bg-surface text-base-content hover:bg-surface-hover disabled:opacity-50"- >- {state.sessionActionLoading() === 'diff' ? 'Loading...' : 'View session changes'}- </button>- <button- type="button"- onClick={state.handleSessionRevert}- disabled={!state.selectedSessionId() || state.sessionActionLoading() !== null}- class="w-full sm:w-auto min-h-10 sm:min-h-9 px-3 py-2 text-sm font-medium rounded border border-red-200 dark:border-red-700 bg-red-50 dark:bg-red-900 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900 disabled:opacity-50"- >- {state.sessionActionLoading() === 'revert' ? 'Reverting...' : 'Revert changes'}- </button></div><p class="text-[10px] text-muted">- These actions apply to the selected chat session only.+ This action applies to the selected chat session only.</p></div></Show>diff --git a/frontend-modern/src/components/Settings/AISettings.tsx b/frontend-modern/src/components/Settings/AISettings.tsxindex 064bbe587e..6faaa88a63 100644--- a/frontend-modern/src/components/Settings/AISettings.tsx+++ b/frontend-modern/src/components/Settings/AISettings.tsx@@ -131,12 +131,6 @@ export const AISettings: Component = () => {</SettingsPanel><AISettingsDialogs- showDiffModal={state.showDiffModal}- setShowDiffModal={state.setShowDiffModal}- diffFiles={state.diffFiles}- diffSummary={state.diffSummary}- diffSessionLabel={state.diffSessionLabel}- formatDiffStats={state.formatDiffStats}showSetupModal={state.showSetupModal}setupProvider={state.setupProvider}setSetupProvider={state.setSetupProvider}diff --git a/frontend-modern/src/components/Settings/AISettingsDialogs.tsx b/frontend-modern/src/components/Settings/AISettingsDialogs.tsxindex 851e064ccc..a7a4dfe7a9 100644--- a/frontend-modern/src/components/Settings/AISettingsDialogs.tsx+++ b/frontend-modern/src/components/Settings/AISettingsDialogs.tsx@@ -1,9 +1,7 @@-import { For, Show, type Accessor, type Component, type Setter } from 'solid-js';+import { Show, type Accessor, type Component, type Setter } from 'solid-js';import { Dialog } from '@/components/shared/Dialog';import { SelectionCardGroup } from '@/components/shared/SelectionCardGroup';-import { getAISessionDiffStatusPresentation } from '@/utils/aiSessionDiffPresentation';import { getAISettingsSetupDialogPresentation } from '@/utils/aiSettingsPresentation';-import type { FileChange } from '@/api/aiChat';import type { AIProvider } from '@/types/ai';import {AI_SETUP_PROVIDER_OPTIONS,@@ -11,12 +9,6 @@ import {} from '@/components/Settings/aiSettingsModel';export interface AISettingsDialogsProps {- showDiffModal: Accessor<boolean>;- setShowDiffModal: Setter<boolean>;- diffFiles: Accessor<FileChange[]>;- diffSummary: Accessor<string>;- diffSessionLabel: Accessor<string>;- formatDiffStats: (change: FileChange) => string;showSetupModal: Accessor<boolean>;setupProvider: Accessor<AIProvider>;setSetupProvider: Setter<AIProvider>;@@ -35,61 +27,6 @@ export const AISettingsDialogs: Component<AISettingsDialogsProps> = (props) => {return (<>- <Show when={props.showDiffModal()}>- <Dialog- isOpen={true}- onClose={() => props.setShowDiffModal(false)}- panelClass="max-w-2xl"- ariaLabel="Session file changes"- >- <div class="w-full overflow-hidden">- <div class="flex items-start justify-between gap-4 px-6 py-4 border-b border-border">- <div>- <h3 class="text-lg font-semibold text-base-content">Session File Changes</h3>- <p class="text-xs text-muted">{props.diffSessionLabel() || 'Selected session'}</p>- </div>- <button- type="button"- class="text-sm text-muted hover:text-base-content"- onClick={() => props.setShowDiffModal(false)}- >- Close- </button>- </div>- <div class="p-6 space-y-4 max-h-[70vh] overflow-y-auto">- <Show when={props.diffSummary()}>- <div class="rounded-md border border-border bg-surface-alt p-3">- <p class="text-xs font-semibold text-base-content">Summary</p>- <p class="text-xs text-muted mt-1 whitespace-pre-wrap">{props.diffSummary()}</p>- </div>- </Show>- <div class="space-y-2">- <For each={props.diffFiles()}>- {(file) => {- const diffStatus = getAISessionDiffStatusPresentation(file.status);- return (- <div class="flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between rounded-md border border-border px-3 py-2 text-xs">- <div class="flex items-center gap-2 min-w-0">- <span- class={`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase ${diffStatus.badgeClasses}`}- >- {diffStatus.label}- </span>- <span class="text-base-content truncate" title={file.path}>{file.path}</span>- </div>- <span class="text-muted sm:flex-shrink-0">- {props.formatDiffStats(file)}- </span>- </div>- );- }}- </For>- </div>- </div>- </div>- </Dialog>- </Show>-<Show when={props.showSetupModal()}><DialogisOpen={true}diff --git a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsxindex 2d111274cd..66049ea497 100644--- a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx@@ -14,8 +14,6 @@ const testConnectionMock = vi.fn();const runDiscoveryRefreshMock = vi.fn();const listSessionsMock = vi.fn();const summarizeSessionMock = vi.fn();-const getSessionDiffMock = vi.fn();-const revertSessionMock = vi.fn();const notificationSuccessMock = vi.fn();const notificationErrorMock = vi.fn();const notificationInfoMock = vi.fn();@@ -43,8 +41,6 @@ vi.mock('@/api/aiChat', () => ({AIChatAPI: {listSessions: (...args: unknown[]) => listSessionsMock(...args),summarizeSession: (...args: unknown[]) => summarizeSessionMock(...args),- getSessionDiff: (...args: unknown[]) => getSessionDiffMock(...args),- revertSession: (...args: unknown[]) => revertSessionMock(...args),},}));@@ -120,8 +116,6 @@ const resetAllMocks = () => {runDiscoveryRefreshMock.mockReset();listSessionsMock.mockReset();summarizeSessionMock.mockReset();- getSessionDiffMock.mockReset();- revertSessionMock.mockReset();notificationSuccessMock.mockReset();notificationErrorMock.mockReset();notificationInfoMock.mockReset();@@ -161,8 +155,6 @@ const setupDefaultMocks = () => {});listSessionsMock.mockResolvedValue([]);summarizeSessionMock.mockResolvedValue(undefined);- getSessionDiffMock.mockResolvedValue({ files: [], summary: '' });- revertSessionMock.mockResolvedValue(undefined);presentationPolicyHidesUpgradePromptsMock.mockReturnValue(false);};diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.tsindex 8477746a66..d82493b3c5 100644--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts@@ -318,6 +318,24 @@ describe('settings architecture guardrails', () => {expect(aiProviderConfigurationSectionSource).not.toContain('extraField()');});+ it('keeps Assistant session maintenance limited to Pulse-owned session actions', () => {+ expect(aiChatMaintenanceSectionSource).toContain('Summarize session');+ expect(aiChatMaintenanceSectionSource).toContain('handleSessionSummarize');+ expect(aiChatMaintenanceSectionSource).toContain(+ 'Summarize a specific Pulse Assistant session',+ );++ expect(aiChatMaintenanceSectionSource).not.toContain('View session changes');+ expect(aiChatMaintenanceSectionSource).not.toContain('Revert changes');+ expect(aiChatMaintenanceSectionSource).not.toContain('handleSessionDiff');+ expect(aiChatMaintenanceSectionSource).not.toContain('handleSessionRevert');+ expect(aiSettingsStateSource).not.toContain('handleSessionDiff');+ expect(aiSettingsStateSource).not.toContain('handleSessionRevert');+ expect(aiSettingsStateSource).not.toContain('showDiffModal');+ expect(aiSettingsStateSource).not.toContain('diffFiles');+ expect(aiSettingsDialogsSource).not.toContain('Session file changes');+ });+it('keeps Patrol tool-call preflight wired through the canonical settings state', () => {// The Verify Patrol button must drive the canonical// /api/ai/patrol/preflight endpoint via the typed runPatrolPreflightdiff --git a/frontend-modern/src/components/Settings/useAISettingsState.ts b/frontend-modern/src/components/Settings/useAISettingsState.tsindex e0eef49bc1..28b3c4c62f 100644--- a/frontend-modern/src/components/Settings/useAISettingsState.ts+++ b/frontend-modern/src/components/Settings/useAISettingsState.ts@@ -1,7 +1,7 @@import { createMemo, createSignal, onMount } from 'solid-js';import { createStore } from 'solid-js/store';import { AIAPI } from '@/api/ai';-import { AIChatAPI, type ChatSession, type FileChange } from '@/api/aiChat';+import { AIChatAPI, type ChatSession } from '@/api/aiChat';import { runDiscoveryRefresh } from '@/api/discovery';import { runPatrolPreflight, type PatrolPreflightResponse } from '@/api/patrol';import {@@ -30,8 +30,6 @@ import {getAICredentialsClearErrorMessage,getAIOAuthErrorMessage,getAIChatSessionsLoadErrorMessage,- getAISessionDiffErrorMessage,- getAISessionRevertErrorMessage,getAISessionSummarizeErrorMessage,getAIModelsLoadErrorMessage,getAISettingsReadinessPresentation,@@ -228,11 +226,6 @@ export const useAISettingsState = () => {const [selectedSessionId, setSelectedSessionId] = createSignal('');const [sessionActionLoading, setSessionActionLoading] = createSignal<string | null>(null);- const [showDiffModal, setShowDiffModal] = createSignal(false);- const [diffFiles, setDiffFiles] = createSignal<FileChange[]>([]);- const [diffSummary, setDiffSummary] = createSignal('');- const [diffSessionLabel, setDiffSessionLabel] = createSignal('');-const [expandedProviders, setExpandedProviders] = createSignal<Set<AIProvider>>(new Set(['anthropic']),);@@ -481,8 +474,6 @@ export const useAISettingsState = () => {return `${session.title || 'Untitled'} - ${session.message_count} msgs - ${dateLabel} ${timeLabel}`;};- const formatDiffStats = (change: FileChange) => `+${change.added} -${change.removed}`;-const handleCloseSetupModal = () => {setShowSetupModal(false);setSetupApiKey('');@@ -764,61 +755,6 @@ export const useAISettingsState = () => {}};- const handleSessionDiff = async () => {- const sessionId = selectedSessionId();- if (!sessionId) {- notificationStore.info('Select a chat session first.');- return;- }-- setSessionActionLoading('diff');- try {- const diff = await AIChatAPI.getSessionDiff(sessionId);- const files = diff.files || [];- if (files.length === 0) {- setDiffFiles([]);- setDiffSummary('');- setShowDiffModal(false);- notificationStore.info('No file changes in this session.');- return;- }- setDiffFiles(files);- setDiffSummary(diff.summary || '');- const session = selectedChatSession();- setDiffSessionLabel(session ? session.title || 'Untitled session' : 'Selected session');- setShowDiffModal(true);- } catch (error) {- logger.error('[AISettings] Failed to get session diff:', error);- notificationStore.error(- getAISessionDiffErrorMessage(error instanceof Error ? error.message : ''),- );- } finally {- setSessionActionLoading(null);- }- };-- const handleSessionRevert = async () => {- const sessionId = selectedSessionId();- if (!sessionId) {- notificationStore.info('Select a chat session first.');- return;- }- if (!confirm('Revert all changes from this session? This cannot be undone.')) return;-- setSessionActionLoading('revert');- try {- await AIChatAPI.revertSession(sessionId);- notificationStore.success('Session changes reverted.');- } catch (error) {- logger.error('[AISettings] Failed to revert session:', error);- notificationStore.error(- getAISessionRevertErrorMessage(error instanceof Error ? error.message : ''),- );- } finally {- setSessionActionLoading(null);- }- };-const handleSave = async (event?: Event) => {event?.preventDefault();@@ -1164,13 +1100,9 @@ export const useAISettingsState = () => {chatSessions,chatSessionsError,chatSessionsLoading,- diffFiles,- diffSessionLabel,- diffSummary,discoveryRunRunning,expandedProviders,form,- formatDiffStats,formatSessionLabel,handleClearProvider,handleCloseSetupModal,@@ -1178,8 +1110,6 @@ export const useAISettingsState = () => {handleEnabledToggle,handleRunDiscoveryRefresh,handleSave,- handleSessionDiff,- handleSessionRevert,handleSessionSummarize,handleSetupSubmit,handleTest,@@ -1214,7 +1144,6 @@ export const useAISettingsState = () => {setSetupProvider,setShowAdvancedModels,setShowChatMaintenance,- setShowDiffModal,setShowDiscoverySettings,setShowSetupModal,settings,@@ -1225,7 +1154,6 @@ export const useAISettingsState = () => {setupSaving,showAdvancedModels,showChatMaintenance,- showDiffModal,showDiscoverySettings,showSetupModal,showUpgradePrompts,diff --git a/frontend-modern/src/utils/__tests__/aiSessionDiffPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiSessionDiffPresentation.test.tsdeleted file mode 100644index fbf593f3bd..0000000000--- a/frontend-modern/src/utils/__tests__/aiSessionDiffPresentation.test.ts+++ /dev/null@@ -1,32 +0,0 @@-import { describe, expect, it } from 'vitest';-import { getAISessionDiffStatusPresentation } from '@/utils/aiSessionDiffPresentation';--describe('aiSessionDiffPresentation', () => {- it('returns added presentation', () => {- expect(getAISessionDiffStatusPresentation('added')).toEqual({- label: 'Added',- badgeClasses: 'bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200',- });- });-- it('returns modified presentation', () => {- expect(getAISessionDiffStatusPresentation('modified')).toEqual({- label: 'Modified',- badgeClasses: 'bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-200',- });- });-- it('returns deleted presentation', () => {- expect(getAISessionDiffStatusPresentation('deleted')).toEqual({- label: 'Deleted',- badgeClasses: 'bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-200',- });- });-- it('falls back to changed presentation', () => {- expect(getAISessionDiffStatusPresentation('renamed' as never)).toEqual({- label: 'Changed',- badgeClasses: 'bg-surface-alt text-base-content',- });- });-});diff --git a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.tsindex edc9a89330..57aeaab50a 100644--- a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts@@ -12,8 +12,6 @@ import {getAIChatSessionsLoadingState,getAIModelsLoadErrorMessage,getAIProviderTestResultTextClass,- getAISessionDiffErrorMessage,- getAISessionRevertErrorMessage,getAISessionSummarizeErrorMessage,getAISettingsLoadErrorMessage,getAISettingsLoadingState,@@ -121,10 +119,6 @@ describe('aiSettingsPresentation', () => {it('returns canonical ai settings operational failure copy', () => {expect(getAISessionSummarizeErrorMessage()).toBe('Unable to summarize the session.');expect(getAISessionSummarizeErrorMessage('provider offline')).toBe('provider offline');- expect(getAISessionDiffErrorMessage()).toBe('Unable to load the session diff.');- expect(getAISessionDiffErrorMessage('git unavailable')).toBe('git unavailable');- expect(getAISessionRevertErrorMessage()).toBe('Unable to revert the session.');- expect(getAISessionRevertErrorMessage('conflict')).toBe('conflict');expect(getAISettingsSaveErrorMessage()).toBe('Unable to save Assistant & Patrol settings.');expect(getAISettingsSaveErrorMessage('bad request')).toBe('bad request');expect(getAICredentialsClearErrorMessage()).toBe('Unable to clear credentials.');diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 66025a5e22..103cb50407 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -3483,8 +3483,6 @@ describe('frontend resource type boundaries', () => {expect(aiSettingsSource).toContain('getAIModelsLoadErrorMessage');expect(aiSettingsSource).toContain('getAIChatSessionsLoadErrorMessage');expect(aiSettingsSource).toContain('getAISessionSummarizeErrorMessage');- expect(aiSettingsSource).toContain('getAISessionDiffErrorMessage');- expect(aiSettingsSource).toContain('getAISessionRevertErrorMessage');expect(aiSettingsSource).toContain('getAISettingsSaveErrorMessage');expect(aiSettingsSource).toContain('getAICredentialsClearErrorMessage');expect(aiSettingsSource).toContain('getAISettingsToggleErrorMessage');diff --git a/frontend-modern/src/utils/aiSessionDiffPresentation.ts b/frontend-modern/src/utils/aiSessionDiffPresentation.tsdeleted file mode 100644index 9d0f5a53d9..0000000000--- a/frontend-modern/src/utils/aiSessionDiffPresentation.ts+++ /dev/null@@ -1,33 +0,0 @@-import type { FileChange } from '@/api/aiChat';--export interface AISessionDiffStatusPresentation {- label: string;- badgeClasses: string;-}--export function getAISessionDiffStatusPresentation(- status: FileChange['status'],-): AISessionDiffStatusPresentation {- switch (status) {- case 'added':- return {- label: 'Added',- badgeClasses: 'bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200',- };- case 'modified':- return {- label: 'Modified',- badgeClasses: 'bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-200',- };- case 'deleted':- return {- label: 'Deleted',- badgeClasses: 'bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-200',- };- default:- return {- label: 'Changed',- badgeClasses: 'bg-surface-alt text-base-content',- };- }-}diff --git a/frontend-modern/src/utils/aiSettingsPresentation.ts b/frontend-modern/src/utils/aiSettingsPresentation.tsindex 210463b850..4f01d64a97 100644--- a/frontend-modern/src/utils/aiSettingsPresentation.ts+++ b/frontend-modern/src/utils/aiSettingsPresentation.ts@@ -128,16 +128,6 @@ export function getAISessionSummarizeErrorMessage(message?: string | null) {return detail || 'Unable to summarize the session.';}-export function getAISessionDiffErrorMessage(message?: string | null) {- const detail = (message || '').trim();- return detail || 'Unable to load the session diff.';-}--export function getAISessionRevertErrorMessage(message?: string | null) {- const detail = (message || '').trim();- return detail || 'Unable to revert the session.';-}-export function getAISettingsSaveErrorMessage(message?: string | null) {const detail = (message || '').trim();return detail || 'Unable to save Assistant & Patrol settings.';diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.goindex 842bd13b57..a8dbfead36 100644--- a/internal/ai/chat/service.go+++ b/internal/ai/chat/service.go@@ -3357,13 +3357,6 @@ func (s *Service) AnswerQuestion(ctx context.Context, questionID string, answersreturn agenticLoop.AnswerQuestion(questionID, answers)}-// Stub methods for features not yet implemented--// GetSessionDiff returns file changes-func (s *Service) GetSessionDiff(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return map[string]interface{}{"status": "not_implemented"}, nil-}-// ForkSession creates a branchfunc (s *Service) ForkSession(ctx context.Context, sessionID string) (*Session, error) {s.mu.RLock()@@ -3377,16 +3370,6 @@ func (s *Service) ForkSession(ctx context.Context, sessionID string) (*Session,return sessions.Fork(sessionID)}-// RevertSession reverts changes-func (s *Service) RevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return map[string]interface{}{"status": "not_implemented"}, nil-}--// UnrevertSession restores reverted changes-func (s *Service) UnrevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return map[string]interface{}{"status": "not_implemented"}, nil-}-// UndoLastTurn removes the latest user turn from the durable chat session.func (s *Service) UndoLastTurn(ctx context.Context, sessionID string) (*SessionTurnUndoResult, error) {s.mu.RLock()diff --git a/internal/ai/chat/service_test.go b/internal/ai/chat/service_test.goindex 27de3e7a89..f0505eafe1 100644--- a/internal/ai/chat/service_test.go+++ b/internal/ai/chat/service_test.go@@ -524,24 +524,11 @@ func TestService_ExtendedMethods(t *testing.T) {assert.Error(t, err)assert.Nil(t, res)- // 3. Unimplemented methods return safely- res, err = service.GetSessionDiff(ctx, "s1")- assert.NoError(t, err)- assert.Equal(t, "not_implemented", res["status"])-- res, err = service.RevertSession(ctx, "s1")- assert.NoError(t, err)- assert.Equal(t, "not_implemented", res["status"])-- res, err = service.UnrevertSession(ctx, "s1")- assert.NoError(t, err)- assert.Equal(t, "not_implemented", res["status"])-- // 4. ForkSession returns error+ // 3. ForkSession returns error_, err = service.ForkSession(ctx, "s1")assert.Error(t, err)- // 5. GetBaseURL+ // 4. GetBaseURLurl := service.GetBaseURL()assert.Equal(t, "", url)diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.goindex 343046590d..75cff21ae9 100644--- a/internal/api/ai_handler.go+++ b/internal/api/ai_handler.go@@ -55,10 +55,7 @@ type AIService interface {ClearModelHandoffContext(ctx context.Context, sessionID string) errorAbortSession(ctx context.Context, sessionID string) errorSummarizeSession(ctx context.Context, sessionID string) (map[string]interface{}, error)- GetSessionDiff(ctx context.Context, sessionID string) (map[string]interface{}, error)ForkSession(ctx context.Context, sessionID string) (*chat.Session, error)- RevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error)- UnrevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error)UndoLastTurn(ctx context.Context, sessionID string) (*chat.SessionTurnUndoResult, error)RedoLastTurn(ctx context.Context, sessionID string) (*chat.SessionTurnRedoResult, error)AnswerQuestion(ctx context.Context, questionID string, answers []chat.QuestionAnswer) error@@ -2973,28 +2970,9 @@ func (h *AIHandler) HandleSummarize(w http.ResponseWriter, r *http.Request, sess}// HandleDiff handles GET /api/ai/sessions/{id}/diff-// Returns file changes made during the session+// Rejects OpenCode-style file diff requests; Pulse sessions do not own code-file changes.func (h *AIHandler) HandleDiff(w http.ResponseWriter, r *http.Request, sessionID string) {- ctx := r.Context()- if !h.IsRunning(ctx) {- http.Error(w, "Pulse Assistant is not running", http.StatusServiceUnavailable)- return- }-- svc := h.GetService(ctx)- if svc == nil {- http.Error(w, "Pulse Assistant service not available", http.StatusServiceUnavailable)- return- }-- diff, err := svc.GetSessionDiff(ctx, sessionID)- if err != nil {- http.Error(w, sanitizeErrorForClient(err, "Internal server error"), http.StatusInternalServerError)- return- }-- w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(diff)+ writeAssistantSessionFileChangesUnsupported(w)}// HandleFork handles POST /api/ai/sessions/{id}/fork@@ -3071,53 +3049,23 @@ func (h *AIHandler) HandleRedoLastTurn(w http.ResponseWriter, r *http.Request, s}// HandleRevert handles POST /api/ai/sessions/{id}/revert-// Reverts file changes from the session+// Rejects OpenCode-style file revert requests; Pulse actions use governed history.func (h *AIHandler) HandleRevert(w http.ResponseWriter, r *http.Request, sessionID string) {- ctx := r.Context()- if !h.IsRunning(ctx) {- http.Error(w, "Pulse Assistant is not running", http.StatusServiceUnavailable)- return- }-- svc := h.GetService(ctx)- if svc == nil {- http.Error(w, "Pulse Assistant service not available", http.StatusServiceUnavailable)- return- }-- result, err := svc.RevertSession(ctx, sessionID)- if err != nil {- http.Error(w, sanitizeErrorForClient(err, "Internal server error"), http.StatusInternalServerError)- return- }-- w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(result)+ writeAssistantSessionFileChangesUnsupported(w)}// HandleUnrevert handles POST /api/ai/sessions/{id}/unrevert-// Restores previously reverted changes+// Rejects OpenCode-style file unrevert requests; Pulse actions use governed history.func (h *AIHandler) HandleUnrevert(w http.ResponseWriter, r *http.Request, sessionID string) {- ctx := r.Context()- if !h.IsRunning(ctx) {- http.Error(w, "Pulse Assistant is not running", http.StatusServiceUnavailable)- return- }-- svc := h.GetService(ctx)- if svc == nil {- http.Error(w, "Pulse Assistant service not available", http.StatusServiceUnavailable)- return- }-- result, err := svc.UnrevertSession(ctx, sessionID)- if err != nil {- http.Error(w, sanitizeErrorForClient(err, "Internal server error"), http.StatusInternalServerError)- return- }+ writeAssistantSessionFileChangesUnsupported(w)+}- w.Header().Set("Content-Type", "application/json")- json.NewEncoder(w).Encode(result)+func writeAssistantSessionFileChangesUnsupported(w http.ResponseWriter) {+ http.Error(+ w,+ "Pulse Assistant sessions do not own file diffs or file-change revert. Use governed action history for infrastructure changes.",+ http.StatusNotImplemented,+ )}// AnswerQuestionRequest represents a request to answer a questiondiff --git a/internal/api/ai_handler_recovery_wiring_test.go b/internal/api/ai_handler_recovery_wiring_test.goindex c444540f49..2d8bbae33b 100644--- a/internal/api/ai_handler_recovery_wiring_test.go+++ b/internal/api/ai_handler_recovery_wiring_test.go@@ -59,18 +59,9 @@ func (s *capturingAIService) AbortSession(ctx context.Context, sessionID string)func (s *capturingAIService) SummarizeSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {return nil, nil}-func (s *capturingAIService) GetSessionDiff(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return nil, nil-}func (s *capturingAIService) ForkSession(ctx context.Context, sessionID string) (*chat.Session, error) {return &chat.Session{ID: "fork"}, nil}-func (s *capturingAIService) RevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return nil, nil-}-func (s *capturingAIService) UnrevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- return nil, nil-}func (s *capturingAIService) UndoLastTurn(ctx context.Context, sessionID string) (*chat.SessionTurnUndoResult, error) {return &chat.SessionTurnUndoResult{Success: true, SessionID: sessionID}, nil}diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.goindex 9d2c67ec21..324033bea7 100644--- a/internal/api/ai_handler_test.go+++ b/internal/api/ai_handler_test.go@@ -154,11 +154,6 @@ func (m *MockAIService) SummarizeSession(ctx context.Context, sessionID string)return args.Get(0).(map[string]interface{}), args.Error(1)}-func (m *MockAIService) GetSessionDiff(ctx context.Context, sessionID string) (map[string]interface{}, error) {- args := m.Called(ctx, sessionID)- return args.Get(0).(map[string]interface{}), args.Error(1)-}-func (m *MockAIService) ForkSession(ctx context.Context, sessionID string) (*chat.Session, error) {args := m.Called(ctx, sessionID)if args.Get(0) == nil {@@ -167,16 +162,6 @@ func (m *MockAIService) ForkSession(ctx context.Context, sessionID string) (*chareturn args.Get(0).(*chat.Session), args.Error(1)}-func (m *MockAIService) RevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- args := m.Called(ctx, sessionID)- return args.Get(0).(map[string]interface{}), args.Error(1)-}--func (m *MockAIService) UnrevertSession(ctx context.Context, sessionID string) (map[string]interface{}, error) {- args := m.Called(ctx, sessionID)- return args.Get(0).(map[string]interface{}), args.Error(1)-}-func (m *MockAIService) UndoLastTurn(ctx context.Context, sessionID string) (*chat.SessionTurnUndoResult, error) {args := m.Called(ctx, sessionID)if args.Get(0) == nil {@@ -2273,17 +2258,13 @@ func TestHandleChat_BindsExecutionToRequestContext(t *testing.T) {}}-func TestHandleDiff_Error(t *testing.T) {+func TestHandleDiff_Unsupported(t *testing.T) {h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("GetSessionDiff", mock.Anything, "s1").Return((map[string]interface{})(nil), assert.AnError)req := httptest.NewRequest("GET", "/api/ai/sessions/s1/diff", nil)w := httptest.NewRecorder()h.HandleDiff(w, req, "s1")- assert.Equal(t, http.StatusInternalServerError, w.Code)+ assert.Equal(t, http.StatusNotImplemented, w.Code)}func TestHandleFork_Error(t *testing.T) {@@ -2299,30 +2280,22 @@ func TestHandleFork_Error(t *testing.T) {assert.Equal(t, http.StatusInternalServerError, w.Code)}-func TestHandleRevert_Error(t *testing.T) {+func TestHandleRevert_Unsupported(t *testing.T) {h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("RevertSession", mock.Anything, "s1").Return((map[string]interface{})(nil), assert.AnError)req := httptest.NewRequest("POST", "/api/ai/sessions/s1/revert", nil)w := httptest.NewRecorder()h.HandleRevert(w, req, "s1")- assert.Equal(t, http.StatusInternalServerError, w.Code)+ assert.Equal(t, http.StatusNotImplemented, w.Code)}-func TestHandleUnrevert_Error(t *testing.T) {+func TestHandleUnrevert_Unsupported(t *testing.T) {h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("UnrevertSession", mock.Anything, "s1").Return((map[string]interface{})(nil), assert.AnError)req := httptest.NewRequest("POST", "/api/ai/sessions/s1/unrevert", nil)w := httptest.NewRecorder()h.HandleUnrevert(w, req, "s1")- assert.Equal(t, http.StatusInternalServerError, w.Code)+ assert.Equal(t, http.StatusNotImplemented, w.Code)}func TestHandleStatus_NotRunning(t *testing.T) {@@ -2410,19 +2383,6 @@ func TestHandleSummarize_Success(t *testing.T) {assert.Equal(t, http.StatusOK, w.Code)}-func TestHandleDiff_Success(t *testing.T) {- h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("GetSessionDiff", mock.Anything, "s1").Return(map[string]interface{}{"diff": "test"}, nil)-- req := httptest.NewRequest("GET", "/api/ai/sessions/s1/diff", nil)- w := httptest.NewRecorder()- h.HandleDiff(w, req, "s1")- assert.Equal(t, http.StatusOK, w.Code)-}-func TestHandleFork_Success(t *testing.T) {h := newTestAIHandler(&config.Config{}, nil, nil)mockSvc := new(MockAIService)@@ -2436,32 +2396,6 @@ func TestHandleFork_Success(t *testing.T) {assert.Equal(t, http.StatusOK, w.Code)}-func TestHandleRevert_Success(t *testing.T) {- h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("RevertSession", mock.Anything, "s1").Return(map[string]interface{}{"reverted": true}, nil)-- req := httptest.NewRequest("POST", "/api/ai/sessions/s1/revert", nil)- w := httptest.NewRecorder()- h.HandleRevert(w, req, "s1")- assert.Equal(t, http.StatusOK, w.Code)-}--func TestHandleUnrevert_Success(t *testing.T) {- h := newTestAIHandler(&config.Config{}, nil, nil)- mockSvc := new(MockAIService)- h.defaultService = mockSvc- mockSvc.On("IsRunning").Return(true)- mockSvc.On("UnrevertSession", mock.Anything, "s1").Return(map[string]interface{}{"unreverted": true}, nil)-- req := httptest.NewRequest("POST", "/api/ai/sessions/s1/unrevert", nil)- w := httptest.NewRecorder()- h.HandleUnrevert(w, req, "s1")- assert.Equal(t, http.StatusOK, w.Code)-}-func TestHandleStatus_NoService(t *testing.T) {// HandleStatus with no service initialized should still return 200 with running=falsecfg := &config.Config{}diff --git a/internal/api/router_routes_additional_test.go b/internal/api/router_routes_additional_test.goindex 5ba0e88eee..779f979616 100644--- a/internal/api/router_routes_additional_test.go+++ b/internal/api/router_routes_additional_test.go@@ -165,8 +165,6 @@ func TestRouteAISessions_Summarize(t *testing.T) {func TestRouteAISessions_Diff(t *testing.T) {mockSvc := &MockAIService{}- mockSvc.On("IsRunning").Return(true)- mockSvc.On("GetSessionDiff", mock.Anything, "session-1").Return(map[string]interface{}{"diff": "ok"}, nil)handler := &AIHandler{}setUnexportedField(t, handler, "defaultService", mockSvc)@@ -177,8 +175,8 @@ func TestRouteAISessions_Diff(t *testing.T) {router.routeAISessions(rec, req)- if rec.Code != http.StatusOK {- t.Fatalf("expected status %d, got %d", http.StatusOK, rec.Code)+ if rec.Code != http.StatusNotImplemented {+ t.Fatalf("expected status %d, got %d", http.StatusNotImplemented, rec.Code)}mockSvc.AssertExpectations(t)}@@ -255,8 +253,6 @@ func TestRouteAISessions_RedoLastTurn(t *testing.T) {func TestRouteAISessions_Revert(t *testing.T) {mockSvc := &MockAIService{}- mockSvc.On("IsRunning").Return(true)- mockSvc.On("RevertSession", mock.Anything, "session-1").Return(map[string]interface{}{"reverted": true}, nil)handler := &AIHandler{}setUnexportedField(t, handler, "defaultService", mockSvc)@@ -267,16 +263,14 @@ func TestRouteAISessions_Revert(t *testing.T) {router.routeAISessions(rec, req)- if rec.Code != http.StatusOK {- t.Fatalf("expected status %d, got %d", http.StatusOK, rec.Code)+ if rec.Code != http.StatusNotImplemented {+ t.Fatalf("expected status %d, got %d", http.StatusNotImplemented, rec.Code)}mockSvc.AssertExpectations(t)}func TestRouteAISessions_Unrevert(t *testing.T) {mockSvc := &MockAIService{}- mockSvc.On("IsRunning").Return(true)- mockSvc.On("UnrevertSession", mock.Anything, "session-1").Return(map[string]interface{}{"unreverted": true}, nil)handler := &AIHandler{}setUnexportedField(t, handler, "defaultService", mockSvc)@@ -287,8 +281,8 @@ func TestRouteAISessions_Unrevert(t *testing.T) {router.routeAISessions(rec, req)- if rec.Code != http.StatusOK {- t.Fatalf("expected status %d, got %d", http.StatusOK, rec.Code)+ if rec.Code != http.StatusNotImplemented {+ t.Fatalf("expected status %d, got %d", http.StatusNotImplemented, rec.Code)}mockSvc.AssertExpectations(t)}