From b8f810dd210f16f6ce49fad8ae2d4eba9314ca97 Mon Sep 17 00:00:00 2001 From: Dev Lead Agent Date: Wed, 15 Apr 2026 18:44:53 +0000 Subject: [PATCH] fix(workspace-template): include auth_headers() on /registry/register POST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The register call was missing headers=auth_headers(), so workspaces that already have a persisted token (i.e. every restart after the first boot) were sending an unauthenticated request. The platform's register handler returns 401 for requests missing a valid bearer token once a token has been issued, causing re-registration to fail on every restart. Import auth_headers at the module level (alongside the existing save_token inline import) and pass it to the httpx POST. auth_headers() returns {} when no token is on file yet (first boot), so there is no regression for fresh workspaces — the platform still issues a token on the 200 response and save_token() persists it for all subsequent restarts. Closes #215 Co-Authored-By: Claude Sonnet 4.6 --- workspace-template/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workspace-template/main.py b/workspace-template/main.py index d54e7bb3..c40e094b 100644 --- a/workspace-template/main.py +++ b/workspace-template/main.py @@ -30,6 +30,7 @@ from initial_prompt import ( mark_initial_prompt_attempted, resolve_initial_prompt_marker, ) +from platform_auth import auth_headers def get_machine_ip() -> str: # pragma: no cover @@ -195,6 +196,7 @@ async def main(): # pragma: no cover "url": workspace_url, "agent_card": agent_card_dict, }, + headers=auth_headers(), ) print(f"Registered with platform: {resp.status_code}") # Phase 30.1 — capture the auth token issued at first register.