Repository navigation
fix(controller): show an agent unavailable page on the agent host - #6548
Conversation
…rs with access A signed-in caller with access who follows the Agent UI's Reconnect in browser link on a stopped or unsupported Agent got the generic JSON 403. A document navigation refused for that reason, after access was established, now gets a 403 page that says the Agent is not running and links to the Agent in the console, built by the same branch as the Agent version changed page. Probes, API reads, WebSocket upgrades and every answer to a caller without access are unchanged.
The added sentences put the flow, reference and deploy guide pages over the 2500-word hard limit. Shorten them and tighten two nearby sentences without changing what they say.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR gives authorized visitors to an unavailable Agent’s host an HTML refusal page with a return link to the console. Example: After
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a recovery gap still present on main, and review found no introduced correctness defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe controller intercepts Agent-host requests, checks the browser session and exact Agent permissions, resolves availability, and either proxies the request or renders a refusal. flowchart TB
Browser[Agent browser tab] --> Admission[Native host admission]
Admission --> IAM[Session and exact Agent access]
IAM --> Availability[Agent availability]
Availability -->|Available| Gateway[Agent Gateway]
Availability -->|Unavailable page navigation| Refusal[HTML refusal page]
Refusal -->|Return link| Console[Agent console page]
Technical reviewBest possible solution: Use the existing authorized native-host refusal renderer and console recovery path while preserving probe responses and exact-Agent access checks. Do we have a high-confidence way to reproduce the issue? Current-main source shows authorized stopped-Agent navigation reaching the generic JSON 403; the supplied regression reports the corresponding base failure, but this review ran no target code. Is this the best way to solve the issue? The patch fixes presentation at its existing controller owner, preserves admission outcomes, and extends a relevant integration scenario without adding a parallel recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d6808607c5a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 19, 2026, 1:43 AM ET / 06:43 UTC (Revision 2). |
The page for a caller with access is also shown for an Agent being deleted and for a running Agent whose Configuration or Compute offers no browser UI, so "not running" was wrong there. Title it "Agent unavailable" with "This Agent is not available right now. Open it from the console." The deploy guide now says to open the Agent in the console for its status and to deploy a stopped Agent. Set the internal access mark only for the agent_unavailable reason; the other refusals from requireAvailable carry no mark, as before. The outsider comparison checks the JSON request ID again for JSON answers. The flow page again says an upgrading socket is closed without an HTTP response, and a long line is rewrapped.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Real-install check of the landed page on main ( The same production-shaped test install was upgraded in place from this PR's earlier head to main Result: PASS. Stopped Agent (
Callers without access
We collected them while the Agent was running and while it was stopped. The authorized caller's probe confirmed each state at the same moment (
Agent being deleted The page as rendered on that install: |

Problem
After
occ agent stop, an open Agent UI shows the panel "Reconnect to the Gateway. Your sign-in may have expired, or your access may have changed. Reconnect in browser". That link is a plain page load of/on the Agent host. For a signed-in user who has access to the Agent, the controller refuses it with admission reasonagent_unavailable.interceptNativeAdminHttphas HTML pages only forsession_invalid,revision_changedandauthorization_denied, so the browser shows the raw JSON403 FORBIDDEN("The exact platform operation was not authorized."). Nothing tells the user that the Agent is unavailable or where to go. Seen on a production-shaped test install; #6523 named it as a follow-up.Change
nativeAdminProxyContext: whenrequireAvailablerefuses an availability thatresolveNativeAdminAvailabilityhas already returned (stopped, deleting or unsupported) with reasonagent_unavailable, the denial carries an internalaccessEstablishedmark. Its other refusals (revision_changed,disabled, the host-mismatchauthorization_denied) carry no mark, as before. The reasons are unchanged. Theagent_unavailablereason alone does not prove access: some failures before or inside the authorization step map to it too, and those stay unmarked.interceptNativeAdminHttp: the Agent's console URL (/console/#native-agent=<key>) is built once, for eligible page loads, and is shared by the sign-in answers and the Agent pages. One branch now renders both the Agent version changed page and the new Agent unavailable page (403, the same headers, the sentence "This Agent is not available right now. Open it from the console." and a Return to console link). The wording is true for every sub-state: stopped, being deleted, or running without a browser UI in its Configuration or Compute./healthzand other API or probe requests (JSON403, so the Agent UI still shows its panel), WebSocket upgrades, theagent_transition503,revision_changed, a Compute owner mismatch (operator fault: JSON403), and every answer to a caller without access.No new setting, flag, header or response field. Deleted: the duplicate console URL construction and the separate
revision_changedbranch (folded into the shared one).The four points of an independent review were applied in a follow-up commit: wording that is true in every state, the mark only for
agent_unavailable, the JSON request-ID check restored in the test, and the flow page's "without an HTTP response" restored with a long line rewrapped.Verification
tests/integration/native-admin-access.test.mjs: the case fix(controller): answer a deployment in progress with 503 on the Agent host #6523 added now also covers the page. On a stopped Agent, the authorized page load of/gets403text/htmlwith the title Agent unavailable, the sentence, and<a href="<console>/console/#native-agent=<key>">Return to console</a>, without the Agent ID./healthz(plain, and sent as a page load) and a JSONGET /keep the JSON403. The outsider comparison covers a signed-out caller and a signed-in caller without Agent operate, each forGET /healthzand a user-activated page load ofGET /. It compares whole answers (status, headers, body; request ID and date aside) in the available, replacing and stopped states, and checks the JSON body's request ID againstx-request-idfor non-empty JSON answers (the empty302carries a JSON content type). Signed out gets403JSON and302to the console; no access gets403JSON and the Access denied page, identical in all three states.apps/controller/src/http/native-admin.tsfrom main (4c2da280f8): fails at the stopped page load,application/jsoninstead oftext/html. The outsider comparisons pass there too, as they should.checks-baseline-2(typecheck,native-admin-access): pass at92ab7ab2e0and at400b3b539a(after the review commit).postgres-auth(native-admin-session-postgres,native-browser-launch-postgres): pass at92ab7ab2e0. The stop lease close reasonagent_unavailableand the version-changed403(JSON and HTML) are unchanged. Not rerun after the review commit, which changes no reason, lease or JSON answer.static: failed at92ab7ab2e0on docs length (the three pages went over 2,500 words); passes at64f9b885daafter shortening them, and at400b3b539a.64f9b885da). The review commit after it changes the page's title and sentence and narrows the internal mark; it changes no status, header, link or condition for showing the page.occ agent stop) with the Agent UI open: the panel still appears. Reconnect in browser and an address-bar reload of the host root both load the page:403,text/html; charset=utf-8,cache-control: no-store,referrer-policy: no-referrer, 324 bytes, neither the Agent ID nor its name in the HTML. Return to console opens the Agent's console page ("Start this Agent before opening its browser UI"); Deploy new version there brought the Agent UI back 57 s later.GET /healthz(plain and sent as a page load) and a JSONGET /keep the JSON403.503withagent_transition; neither the panel nor the page appears.GET /healthzand a user-activated page load ofGET /, are byte-identical in four states (running, deploy of a running Agent, stopped, deploy from stopped). The authorized probe saw200,503,403,503at the same moments. Signed out:403JSON and302to the console. No access:403JSON and the Access denied page.Risks
authorizeAgentAccess, both before any lifecycle state is read. The page needs the mark that only an availability returned after that check can set. The test compares the whole answers (status, headers, body; request ID and date aside) of both callers forGET /andGET /healthzin the available, replacing and stopped states.