Skip to content

Console: 503 with why instead of a bare 502 - #73

Merged
antonrh merged 1 commit into
mainfrom
console-proxy-503
Nov 20, 2026
Merged

antonrh merged 1 commit into
mainfrom
console-proxy-503

Conversation

@antonrh

@antonrh antonrh commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Console.forward answered 502 "Tracepanel's agent doesn't answer." when the console at console.addr didn't answer after a restart, and a terse 503 when there was no console address. Now every such answer is a 503 with Retry-After: 2 that says what's wrong and what to do (Agent.noConsole(), same wording as the JS and Python SDKs):

  • the project's agent answers at agent.addr but serves no console (started without --serve; console.addr missing or left over) → stop it, the next request starts one with its console; names the store
  • TRACEPANEL_AGENT=off; a named agent or TRACEPANEL_CONSOLE_URL that doesn't answer
  • no agent binary (TRACEPANEL_AGENT_BIN naming nothing, or none found/downloaded)
  • an agent that didn't start → its agent.log

A browser navigation (Accept: text/html) gets a small self-contained page in the console's dark look that reloads itself every 2 s, so it turns into the console once it answers (also in the widget's panel iframe); everything else gets {"error": "..."}. Spring, Micronaut and Ktor pass the request's Accept header (new Console.forward overload; the old one stays).

Tests: ConsoleUnavailableTest (agent without console, with and without a stale console.addr; off; missing binary; agent that fails to start; page escaping and no external assets). ./gradlew check passes.

🤖 Generated with Claude Code

When the agent's console doesn't answer, Console.forward now says why and what
to do: an agent running without its console (started without --serve), the
agent off, a named agent or console URL that doesn't answer, no agent binary,
or an agent that didn't start (its agent.log). A browser gets a small page in
the console's look that reloads itself every 2 s; API calls and files get
{"error": ...}; both with Retry-After. Spring, Micronaut and Ktor pass the
Accept header.
@antonrh
antonrh merged commit d2c8f32 into main Nov 20, 2026
6 checks passed
@antonrh
antonrh deleted the console-proxy-503 branch November 20, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant