Blame
|
1 | --- |
||||||
| 2 | category: dev |
|||||||
| 3 | tags: [bugfix, auth, deployment, beta] |
|||||||
| 4 | last_updated: 2026-03-16 |
|||||||
| 5 | confidence: high |
|||||||
| 6 | --- |
|||||||
| 7 | ||||||||
| 8 | # 2026-03-16: Beta User TLS Fix |
|||||||
| 9 | ||||||||
| 10 | ## Symptom |
|||||||
| 11 | ||||||||
| 12 | Beta users (gruen, igor) reported TLS certificate errors when visiting their `{slug}.robot.wtf` wikis. Caddy's on-demand TLS couldn't provision certs because `/api/internal/check-slug` returned 404 for their slugs. |
|||||||
| 13 | ||||||||
| 14 | ## Root cause |
|||||||
| 15 | ||||||||
| 16 | The signup flow (`POST /auth/signup`) created user records but redirected to `https://robot.wtf/` — the static marketing landing page. The landing page had no link to the dashboard (`/app/`) or wiki creation form (`/app/create`). Users had no way to discover wiki creation. Without a wiki record in the `wikis` table, `check-slug` returns 404, Caddy refuses TLS, browser shows cert error. |
|||||||
| 17 | ||||||||
| 18 | The wiki creation machinery at `/app/create` was fully implemented and tested. The gap was purely in the redirect wiring. |
|||||||
| 19 | ||||||||
| 20 | ## Fixes deployed |
|||||||
| 21 | ||||||||
| 22 | ### 1. Post-signup/login redirect (`e6c5bba`) |
|||||||
| 23 | - `auth_server.py`: Both OAuth callback and signup now redirect to `/app/` instead of `/` |
|||||||
| 24 | - `api_server.py`: Landing page (`/`) checks JWT cookie and redirects authenticated users to `/app/` |
|||||||
| 25 | - Tests added for redirect targets and `return_to` precedence (MCP consent flow) |
|||||||
| 26 | ||||||||
| 27 | ### 2. Private wiki auth redirect (`13f4762`) |
|||||||
| 28 | - `resolver.py`: Unauthenticated browser visitors to private wiki subdomains get a 302 to `https://robot.wtf/auth/login` instead of a JSON 403 |
|||||||
| 29 | - API/MCP clients still get JSON 403 (checks `Accept: text/html`) |
|||||||
| 30 | - Redirect only on 403 (access denied), not 401 (bad credentials) |
|||||||
| 31 | ||||||||
| 32 | ### 3. Manual wiki creation for stranded users |
|||||||
| 33 | - Created wiki records, ACLs, git repos, and MCP tokens for gruen and igor directly in the DB |
|||||||
| 34 | - Users can regenerate tokens from the dashboard (`/app/wiki/{slug}/mcp/regenerate`) |
|||||||
| 35 | ||||||||
| 36 | ## Process lessons |
|||||||
| 37 | ||||||||
| 38 | - Implementation Workflow updated with Step 0: read memories and create task list before dispatching any agents |
|||||||
| 39 | - Worktree agents must be launched from the git repo directory, not the parent (`/Users/sderle/code/otterwiki/` is not a git repo) |
|||||||
| 40 | - Both of these were already in memory but were not consulted at session start |
|||||||