Skip to content

fix(workspace-template): send auth_headers() on register - #222

Closed
airenostars wants to merge 1 commit into
mainfrom
fix/register-auth-header
Closed

fix(workspace-template): send auth_headers() on register#222
airenostars wants to merge 1 commit into
mainfrom
fix/register-auth-header

Conversation

@airenostars

Copy link
Copy Markdown
Collaborator

Summary

  • workspace-template/main.py was posting to /registry/register without an Authorization header. First-ever register works (bootstrap path), but every re-register (container restart, crash recovery, redeploy) hits C18 hijack-prevention and 401s.
  • Symptom: workspace status stuck at provisioning even though the agent is healthy — heartbeat.py already uses auth_headers() so heartbeats succeed, but status never transitions back to online.
  • Fix: import auth_headers in main.py and attach it to the register call. Unchanged bootstrap behavior (first boot returns {}), authenticated on every subsequent register.

Closes #215

Test plan

  • Reproduced locally: restart an online workspace → register returns 401, status stuck at provisioning.
  • With patch applied: restart → register returns 200, status transitions provisioningonline.
  • python3 -c "import ast; ast.parse(open('workspace-template/main.py').read())" passes.
  • CI: python-lint + e2e-api should pass unchanged (no route behavior changed, only client-side header addition).

🤖 Generated with Claude Code

main.py posts to /registry/register without an Authorization header.
That works on first-ever boot (bootstrap path when no live tokens exist),
but every subsequent register — container restart, crash recovery,
redeploy — hits C18 hijack-prevention (requireWorkspaceToken) and 401s.

Symptom: workspace status stuck at 'provisioning' forever even though
the agent is healthy and heartbeats succeed (heartbeat.py already uses
auth_headers()).

Fix: import auth_headers in main.py and attach it to the register call.
On first boot the token file doesn't exist yet, so auth_headers()
returns {} — unchanged bootstrap behavior. On every restart thereafter
the on-disk token is attached and C18 passes.

Closes #215
@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Duplicate of #225 (same 1-line fix, identical diff). Closing in favor of #225 which is branched from newer main.

@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the fix/register-auth-header branch April 16, 2026 12:33
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.

workspace-template main.py register call missing auth_headers() — subsequent registers 401

2 participants