Skip to content

An open-source, faster Devin alternative

TypeScript

docs(done): record login-button removal + dev-edge setup

Igor Zalutskie20bf7cfd5c5
diff --git a/.agents/done/dev-env-setup.md b/.agents/done/dev-env-setup.md
new file mode 100644
index 00000000..d0df86a2
--- /dev/null
+++ b/.agents/done/dev-env-setup.md
@@ -0,0 +1,42 @@
+# Dev env — prod-mirror dashboard edge
+
+**Done.** Shipped on `feat/web-ui-dev` (PR #426).
+
+## What
+
+Stood up a personal **api-edge Worker** that mirrors prod's serving topology in
+front of Igor's GCP dev box, so the dashboard frontend runs the *real* edge path
+(SPA served from the Worker + WorkOS auth at the edge + `/api/dashboard` from D1)
+instead of the local Vite dev server. Useful for validating edge-specific
+behavior — e.g. the WorkOS hosted-logout flow, which the vite-local setup bypasses.
+
+## Resources
+
+- Worker `opencomputer-api-edge-igor-dev` in **Mo's CF account** (`b8f23cb8`),
+ URL `https://opencomputer-api-edge-igor-dev.mo-b8f.workers.dev`.
+- D1 `opencomputer-igor-dev` (schema = `cloudflare-workers/schema.sql`).
+- Backend: GCP dev box `34.181.232.88` (`deploy/gcp/deploy-qemu-dev.sh`).
+- Config: `cloudflare-workers/api-edge/wrangler.igor-dev.toml` (extended with
+ `[assets]` to serve the SPA).
+
+## Quirks discovered (the reason this is documented)
+
+- `~/.opensandbox-gcp-dev.env` uses `${VAR:-default}` references — must be
+ **sourced**, not `grep|cut`'d, or WorkOS rejects the literal `${...}` as
+ `invalid_client`.
+- `cloudflare-workers/api-edge/wrangler.toml` points at **prod** — always pass
+ `--config wrangler.igor-dev.toml` for personal-dev `wrangler` commands.
+- D1: apply only `schema.sql`; the `schema_phase*.sql` files are baked in and
+ error with `duplicate column` on a fresh DB.
+
+## Where it lives (living references — keep these current, not this record)
+
+- **Runbook:** `.agents/work/dev-edge-setup.md` (full setup/redeploy/box-as-cell).
+- **Discoverability:** `AGENTS.md` → "Local development" section.
+
+## Status / follow-up
+
+Login, dashboard shell, and edge logout work. **Box not yet wired as a cell**, so
+session/checkpoint lists are empty until it reports into the edge's D1 (steps in
+the runbook: shared `SESSION_JWT_SECRET` + a `cells` row). Commits: `02603ef`
+(setup + runbook), `d12b647` (env-sourcing gotcha), `24e0a7d` (AGENTS.md pointer).
diff --git a/.agents/done/login-button-removal.md b/.agents/done/login-button-removal.md
new file mode 100644
index 00000000..f0dcf782
--- /dev/null
+++ b/.agents/done/login-button-removal.md
@@ -0,0 +1,47 @@
+# Login button removal + real sign-out
+
+**Done.** Shipped on `feat/web-ui-dev` (evergreen UI PR #426).
+
+## What
+
+The dashboard no longer shows an in-app "Sign in" button screen. An
+unauthenticated visitor is sent **straight to the WorkOS hosted login**, and
+**Sign out now actually ends the WorkOS session** (not just our cookies).
+
+## Why
+
+- The interstitial login page was an extra click with no purpose — the gate can
+ redirect to the IdP directly.
+- With the button gone, the app gate always bounces to WorkOS. Logout previously
+ only cleared OC's cookies, so the WorkOS SSO session survived and the gate
+ silently re-authenticated the user (a "logout logs me back in" loop). Sign-out
+ had to end the WorkOS session too.
+
+## Changes
+
+Frontend (`web/`):
+- `components/ProtectedRoute.tsx` — unauthenticated → `window.location.replace('/auth/login')` (spinner during the bounce); no in-app login route.
+- `App.tsx` — dropped the `/login` route + import. `pages/Login.tsx` — deleted.
+- `api/client.ts` — `logout()` follows the hosted logout URL the backend returns.
+
+Backend — both serving paths, since dev (box Go server) and prod (CF edge) handle
+`/auth/logout` differently:
+- `internal/auth/oauth_handlers.go` — `HandleLogout` builds WorkOS's hosted
+ logout URL via the SDK (`GetLogoutURL`, sid from the access-token JWT).
+- `cloudflare-workers/api-edge/src/index.ts` — capture the WorkOS `sid` at
+ callback into the `oc_session` JWT (`wsid`), and return the hosted logout URL
+ from edge `/auth/logout`.
+
+## Required config (per WorkOS environment)
+
+A **default Sign-out redirect** must be set in the WorkOS dashboard (Redirects):
+staging `http://localhost:3000/` + the dev-edge URL; production
+`https://app.opencomputer.dev/`. Without it WorkOS returns
+`app-homepage-url-not-found`. We use WorkOS-managed redirects (no hard-coded
+`return_to`).
+
+## Outcome
+
+Verified through the prod-mirror dev edge: unauthenticated → WorkOS; sign-out →
+session ended → fresh WorkOS login (no auto-relogin, no error). Commits:
+`3b596e6` (gate + Go logout), `b162475` (edge logout + review fixups).