@@ -57,9 +57,24 @@ interface SideItem {
5757}
5858
5959export function SidebarContent ( { onNavigate } : { onNavigate ?: ( ) => void } ) {
60+ // Agent config drives whether the Agent zone is usable. Shares the
61+ // ["agent-config"] cache key with TopBar/NowPage — one fetch, zero extra
62+ // load. enable===false means the agent is deliberately off.
63+ const configQ = useQuery ( {
64+ queryKey : [ "agent-config" ] ,
65+ queryFn : api . getAgentConfig ,
66+ staleTime : 60_000 ,
67+ retry : 1 ,
68+ } ) ;
69+ const agentOff = configQ . data ?. enable === false ;
70+
71+ // The agent status route (/api/agent/status) is only mounted when the agent
72+ // is enabled, so skip the poll when it's off — otherwise it 404s and the
73+ // runbooks hint flickers. Disabled query → data undefined → runbooks off.
6074 const statusQ = useQuery ( {
6175 queryKey : [ "status" ] ,
6276 queryFn : api . status ,
77+ enabled : ! agentOff ,
6378 staleTime : 30_000 ,
6479 retry : 1 ,
6580 } ) ;
@@ -149,6 +164,22 @@ export function SidebarContent({ onNavigate }: { onNavigate?: () => void }) {
149164 { to : "/settings" , label : "Settings" , icon : Settings } ,
150165 ] ;
151166
167+ // When the agent is disabled (agent.enable=false) every Agent view and the
168+ // agent-backed Runbooks tool are non-functional. Dim + lock them with a
169+ // clear hint (visible-with-hint, audit I4) so they read as disabled instead
170+ // of navigating to empty/erroring pages.
171+ const AGENT_OFF_HINT =
172+ "AI agent is disabled — set agent.enable to use these views" ;
173+ const applyAgentOff = ( items : SideItem [ ] ) : SideItem [ ] =>
174+ agentOff
175+ ? items . map ( ( it ) => ( {
176+ ...it ,
177+ dim : true ,
178+ locked : true ,
179+ dimTitle : AGENT_OFF_HINT ,
180+ } ) )
181+ : items ;
182+
152183 return (
153184 // force-dark: the rail keeps its dark identity in BOTH themes — the
154185 // CSS variables are re-pinned on this subtree (see index.css).
@@ -157,8 +188,8 @@ export function SidebarContent({ onNavigate }: { onNavigate?: () => void }) {
157188
158189 < nav aria-label = "Primary" className = "dark-scroll flex-1 overflow-y-auto px-2 py-2" >
159190 < Zone title = "Respond" items = { respond } onNavigate = { onNavigate } />
160- < Zone title = "Agent" items = { agent } onNavigate = { onNavigate } />
161- < Zone title = "Tools" items = { tools } onNavigate = { onNavigate } />
191+ < Zone title = "Agent" items = { applyAgentOff ( agent ) } onNavigate = { onNavigate } />
192+ < Zone title = "Tools" items = { applyAgentOff ( tools ) } onNavigate = { onNavigate } />
162193 < Zone title = "Manage" items = { manage } onNavigate = { onNavigate } />
163194 </ nav >
164195 </ div >
0 commit comments