Summary
Several admin panel and observability gaps that make debugging towns harder than it needs to be. Grouping these together since they're all about improving admin/ops experience.
1. Cloudflare dashboard links are broken or disabled
File: apps/web/src/app/admin/gastown/towns/[townId]/ContainerTab.tsx (lines 22-55, 108-143)
Backend: apps/web/src/routers/admin/gastown-router.ts (lines 446-497)
| Link |
Status |
Problem |
| Worker Logs |
Clickable but wrong URL |
Points to .../production/logs/live (generic live tail). Should point to .../production/observability/events filtered by tags.townId |
| Container Instance |
Disabled |
Shows "Container not running or instance ID unavailable" |
| TownDO Logs |
Disabled |
Shows "Namespace ID not configured" |
| TownContainerDO Logs |
Disabled |
Shows "Namespace ID not configured or container not running" |
Worker Logs fix: The correct URL format is:
https://dash.cloudflare.com/e115e769bcdd4c3d66af59d3332cb394/workers/services/view/gastown/production/observability/events?filterCombination=%22and%22&calculations=%5B%7B%22operator%22%3A%22count%22%7D%5D&orderBy=%7B%22value%22%3A%22count%22%2C%22limit%22%3A10%2C%22order%22%3A%22desc%22%7D&timeframe=1h&conditions=%7B%7D&conditionCombination=%22and%22&alertTiming=%7B%22interval%22%3A300%2C%22window%22%3A900%2C%22timeBeforeFiring%22%3A600%2C%22timeBeforeResolved%22%3A600%7D&filters=%5B%7B%22key%22%3A%22tags.townId%22%2C%22operation%22%3A%22eq%22%2C%22type%22%3A%22string%22%2C%22value%22%3A%22{townId}%22%7D%5D
Disabled links fix: The 3 disabled links need the env vars CLOUDFLARE_TOWN_DO_NAMESPACE_ID and CLOUDFLARE_CONTAINER_DO_NAMESPACE_ID set (defined in apps/web/src/lib/config.server.ts lines 189-194). Investigate whether these are deployed or just missing from env config.
2. No town owner info or link to user admin
File: apps/web/src/app/admin/gastown/towns/[townId]/TownInspectorDashboard.tsx (lines 47-106)
The admin town page shows Town ID, "View Town UI", and "Audit Log" — but no owner user ID, email, or link to user admin page.
The data is available:
getTownConfig returns owner_user_id
- Town tables have
owner_user_id (personal) and created_by_user_id + owner_org_id (org)
- User admin page exists at
/admin/users/{userId} (already linked from the town list page at admin/gastown/page.tsx:462)
Fix: Display owner_user_id (or owner_org_id for org towns) in the town inspector header, linked to /admin/users/{userId} or /admin/organizations/{orgId}.
3. No town creation date displayed
File: Same TownInspectorDashboard.tsx
created_at exists in both user-towns and org-towns tables but is not exposed on the admin town inspector page.
Fix: Fetch and display created_at alongside the town ID in the inspector header.
4. Massive worker logging gaps — most logs missing townId tag
File: services/gastown/src/util/log.util.ts (tagged logger wrapper)
The tagged logger supports townId, rigId, agentId, beadId, convoyId etc. — but the vast majority of gastown code uses raw console.* instead.
| Metric |
Count |
Raw console.* calls in services/gastown/src/ |
~225 |
Tagged logger.* calls |
~48 |
Files with raw console.* |
28 files |
| Files using tagged logger |
4 files |
The worst offenders (all zero tagged logger usage):
dos/town/*.ts modules (reconciler, scheduling, actions, review-queue, container-dispatch, town-scm) — ~88 raw calls across core business logic
handlers/*.ts — ~72 raw calls (these already run in the HTTP ALS context where tags are auto-set by middleware — converting is low-effort, high-impact)
trpc/router.ts — 13 raw calls
Impact: The Worker Logs link fix (item 1) depends on logs having tags.townId set. Without it, the filtered observability view will miss most log output.
Fix: Migrate console.* → logger.* across all gastown source files. Handler files are the easiest win since they already run in the ALS context with tags auto-set by the wildcard middleware (gastown.worker.ts:180-196). DO sub-modules run in the alarm() ALS context where townId is set at Town.do.ts:3445.
Acceptance Criteria
Summary
Several admin panel and observability gaps that make debugging towns harder than it needs to be. Grouping these together since they're all about improving admin/ops experience.
1. Cloudflare dashboard links are broken or disabled
File:
apps/web/src/app/admin/gastown/towns/[townId]/ContainerTab.tsx(lines 22-55, 108-143)Backend:
apps/web/src/routers/admin/gastown-router.ts(lines 446-497).../production/logs/live(generic live tail). Should point to.../production/observability/eventsfiltered bytags.townIdWorker Logs fix: The correct URL format is:
Disabled links fix: The 3 disabled links need the env vars
CLOUDFLARE_TOWN_DO_NAMESPACE_IDandCLOUDFLARE_CONTAINER_DO_NAMESPACE_IDset (defined inapps/web/src/lib/config.server.tslines 189-194). Investigate whether these are deployed or just missing from env config.2. No town owner info or link to user admin
File:
apps/web/src/app/admin/gastown/towns/[townId]/TownInspectorDashboard.tsx(lines 47-106)The admin town page shows Town ID, "View Town UI", and "Audit Log" — but no owner user ID, email, or link to user admin page.
The data is available:
getTownConfigreturnsowner_user_idowner_user_id(personal) andcreated_by_user_id+owner_org_id(org)/admin/users/{userId}(already linked from the town list page atadmin/gastown/page.tsx:462)Fix: Display
owner_user_id(orowner_org_idfor org towns) in the town inspector header, linked to/admin/users/{userId}or/admin/organizations/{orgId}.3. No town creation date displayed
File: Same
TownInspectorDashboard.tsxcreated_atexists in bothuser-townsandorg-townstables but is not exposed on the admin town inspector page.Fix: Fetch and display
created_atalongside the town ID in the inspector header.4. Massive worker logging gaps — most logs missing
townIdtagFile:
services/gastown/src/util/log.util.ts(tagged logger wrapper)The tagged logger supports
townId,rigId,agentId,beadId,convoyIdetc. — but the vast majority of gastown code uses rawconsole.*instead.console.*calls inservices/gastown/src/logger.*callsconsole.*The worst offenders (all zero tagged logger usage):
dos/town/*.tsmodules (reconciler, scheduling, actions, review-queue, container-dispatch, town-scm) — ~88 raw calls across core business logichandlers/*.ts— ~72 raw calls (these already run in the HTTP ALS context where tags are auto-set by middleware — converting is low-effort, high-impact)trpc/router.ts— 13 raw callsImpact: The Worker Logs link fix (item 1) depends on logs having
tags.townIdset. Without it, the filtered observability view will miss most log output.Fix: Migrate
console.*→logger.*across all gastown source files. Handler files are the easiest win since they already run in the ALS context with tags auto-set by the wildcard middleware (gastown.worker.ts:180-196). DO sub-modules run in thealarm()ALS context wheretownIdis set atTown.do.ts:3445.Acceptance Criteria
tags.townIdcreated_atdateconsole.*calls inservices/gastown/src/migrated to taggedlogger.*townIdtag