Repository navigation
[PIR #1914] Dashboard: Open Codev IDE link over Codev Cloud - #1931
Conversation
…ide; validate tower_name
…unnel without the mint
…nnel no-authority fail-closed state once
Architect integration review (high tier: 3-way)Verdicts. Codex: REQUEST_CHANGES. Gemini: skipped (lane unauthenticated, non-blocking). Claude: COMMENT (architectural fit strong; security posture verified; no rename finding). Codex's finding, verified against the branch.
What does break after a rename is the Ruling: REQUEST_CHANGES, one bounded fix in this PR. For a tunnel-borne request, derive the public prefix from the relay-stamped inbound On the Playwright gap. The e2e suite covers the dashboard's open path, not the forward under Review-file correction. "Manual: the owner verified the running build" is inaccurate. The owner approved dev-approval on the architect's local-path verification against a throwaway Tower; the cloud path has not been exercised against a live cloud tower. Please correct that line. Integration notes agreed with both reviewers. The Claude's points. Its two code items (the e2e test must not default to port 4100; a WARN when a tunnel-borne request has no usable public authority) are already in Windows dispatch. Not required: the diff touches proxy headers, a status field, a loopback connect probe and the dashboard template, none of the platform surfaces that trigger the on-demand run. Head reviewed: product diff as of |
…yed /t/<slug>/ide, not a stale stored tower_name
…l-verification line
PIR Review: Open Codev IDE link over Codev Cloud
Fixes #1914
Summary
The dashboard's Open IDE link only appeared on a locally opened dashboard: its availability poll (
GET /api/ide) and its cookie mint (POST /api/ide/session) are local-only and tunnel-blocked by design, so over Codev Cloud the link never rendered. The IDE signal now ridesGET /api/status(which the tunnel relays) aside: { available, viaTunnel }, andopenIde()skips the mint when the page came through the tunnel and navigates straight to./ide/?folder=…. For tunnel-borne responses the forward also scopes the IDE server'svscode-tkncookie toPath=/t/<tower-name>/ide, so towers on the shared cloud origin cannot overwrite each other's cookie. Theapi/idefamily stays blocked over the tunnel and the local path is unchanged.Files Changed
packages/codev/src/agent-farm/servers/ide-server.ts(+17 / -0):ideAvailability(viaTunnel)packages/codev/src/agent-farm/servers/tower-routes.ts(+13 / -5):/api/statuscarrieside: { available, viaTunnel }packages/codev/src/agent-farm/servers/ide-forward.ts(+82 / -18):TokenCookiePolicy(strip | scope) shared by the HTTP and WebSocket-101 relays;scopeConnectionTokenSetCookie;tower_namevalidation ingetPublicAuthoritypackages/codev/templates/tower.html(+31 / -37):refreshIdeStatus()and its./api/idepoll removed;refresh()readsdata.ide;ideTargetUrl(); tunnel-awareopenIde()packages/codev/src/agent-farm/__tests__/pir-1914-ide-cloud-availability.test.ts(+218 / -0): newpackages/codev/src/agent-farm/__tests__/e2e/pir-1914-ide-link-cloud.test.ts(+80 / -0): new Playwright suitepackages/codev/src/agent-farm/__tests__/ide-forward.test.ts(+53 / -11)packages/codev/src/agent-farm/__tests__/ide-forward-integration.test.ts(+30 / -6)packages/codev/src/agent-farm/__tests__/tower-routes.test.ts(+38 / -1)codev/resources/arch.md,codev/resources/lessons-learned.md: see belowcodev/plans/1914-dashboard-open-codev-ide-link-.md,codev/state/pir-1914_thread.md, porchstatus.yamlCommits
69c16a421[PIR dashboard: Open Codev IDE link is hidden over Codev Cloud (availability poll and cookie mint are local-only) #1914] Dashboard: IDE link from the status poll; open over the tunnel without the mint3bd697c04[PIR dashboard: Open Codev IDE link is hidden over Codev Cloud (availability poll and cookie mint are local-only) #1914] Scope the tunnel-relayed vscode-tkn cookie to /t//ide; validate tower_namea6f1d9eba[PIR dashboard: Open Codev IDE link is hidden over Codev Cloud (availability poll and cookie mint are local-only) #1914] /api/status carries the IDE signal (available, viaTunnel)3bea1820bMerge origin/main into builder/pir-1914 (brings bugfix tests: full suite on native Windows stops the live Tower and fails on main (launchers.windows port 4100, EPERM temp cleanup) #1922's test-harness env fix)d6cdec389,c23f3bdd7,e199fdca6plan draft and revisions; thread and porch commitsTest Results
npm run build: ✓ passnpm test: ✓ pass at thedev-approvalcheck (porch) and in a post-merge run: 8182 passed, 108 skipped. 24 new or changed unit/integration tests (12 in the newpir-1914file, 5 cookie-scoping + tower-name tests inide-forward.test.ts, 3 tunnel/local integration cases, 3/api/statusroute tests, plus updates for the new policy signature).tsc --noEmit: ✓ cleane2e/pir-1914-ide-link-cloud.test.ts, run against a throwaway Tower on port 14114 with its ownCODEV_AGENT_FARM_DIR/SHELLPER_SOCKET_DIR): 3/3. Local: link visible, click mints then opens/ide/?folder=…. Tunnel: link visible, click opens/ide/?folder=…with no mint request. No IDE: no link.dev-approvalon the architect's local-path verification against a throwaway Tower. The cloud path has not been exercised against a live cloud-registered Tower; it is covered by the unit, integration and Playwright tests above, and a live-cloud check remains the owner's call.Architecture Updates
Cold tier only (
codev/resources/arch.md, "IDE prefix forward"): the tunnel-path cookie sentence now says the relayedvscode-tknis scoped toPath=/t/<tower-name>/ide(stripped with no usable authority, and Path is not an isolation boundary), and a new bullet records the dashboard's availability signal on/api/status, the local-vs-tunnel availability rule, the two open paths, and thetower_namecharacter check. No hot-tier change: this is reference detail for one subsystem, not a cross-cutting rule.Lessons Learned Updates
Cold tier (
codev/resources/lessons-learned.md, Testing):@cluesmith:registryin the machine's npm config makesprotocol-drift-audit.test.tsfail deterministically, and an env override of the scope does not survive porch'snpm testbecause pnpm's script runner re-exports the user npm config; an emptynpm_config_userconfigfor the run gets through without touching the owner's config.**/ide/**) also caught a sibling (/api/ide/session); match exact pathnames when asserting a request was or was not made.No hot-tier lesson: both are narrow testing recipes.
Things to Look At During PR Review
api/ideandapi/ide/sessionstay tunnel-blocked (BLOCKED_PATH_SEGMENTuntouched) and the mint still 403s tunnel-borne requests. The/ideforward's authorization is unchanged: a request carrying the tunnel marker with no key and no forward cookie is refused (pinned inpir-1914-ide-cloud-availability.test.ts). The forward was already reachable over the tunnel with the cloud session; this change makes it discoverable, not newly reachable.viaTunnelis a hint, not a credential. It only selects the open path and the cookie policy. A local process forging the marker still needs the key to read/api/statusor reach/ide.391155114): the storedtower_namegoes stale after a rename (TunnelClientkeeps onlytowerIdfromauth_ok), and Tower's forward used to overwrite the relay's correctx-forwarded-prefixwith it, breaking the workbench's asset paths; the new cookie Path inherited the same stale source. For a tunnel-borne request,getPublicAuthority(req.headers)now takes the prefix from the relay-stamped inboundx-forwarded-prefixwhen it matches^/t/[A-Za-z0-9._-]+/ide$, falling back to the storedtower_name; that one prefix feeds both the stamp and the cookie Path. The inbound header is trusted only on a tunnel-borne request (Tower's own marker) and only after the pattern check; a local request never consults it. Unit tests cover a renamed slug (stamp and Path follow it), malformed or array values (fallback), a local request (ignored), and no cloud config (null); an integration test drives the real forward. Persisting the slug fromauth_okstays with Tower persists the typed tower name instead of the cloud's canonical slug; add rename, deregistration and name-takeover handling (Tower half of codev-cloud#17) #1871.tower_namecheck (^[A-Za-z0-9._-]+$) also hardens the pre-existingx-forwarded-prefixstamp (small adjacent fix).afx tower connectprompts for the name without validating it; normalized names pass. A non-conforming name loses Tower's prefix stamp (the cloud relay stamps its own) and thevscode-tkncookie is stripped. Upstream auth is unaffected (Tower injects the token on every forwarded request), but over the tunnel that cookie is the browser workbench's token source (config injection is local-only), so the cloud workbench may not work for such a tower. It fails closed, and Tower now logs a WARN once per process when a tunnel-borne/iderequest has no usable public authority (CMAP, Claude).lsofprobe on load.3f96f723b): the new e2e test refuses to default to port 4100 (same rule asissue-1482-held-popover-detail.test.ts), and the fail-closed no-authority state is logged instead of silent. Consultation: codex APPROVE, claude COMMENT (these two items plus "confirm CI green"), gemini skipped (agy exited 3).How to Test Locally
afx dev pir-1914http://localhost:4100/with an IDE server recorded (afx ide status/afx ide start): Open IDE shows; click →POST api/ide/sessionthen the workbench opens.https://cloud.codevos.ai/t/<tower>/on a cloud-registered Tower running this build:api/statusreturns"ide":{"available":true,"viaTunnel":true}; the link shows; click opens…/t/<tower>/ide/?folder=…with noapi/ide/sessionrequest; the IDE tab'svscode-tkncookie has Path/t/<tower>/ide;afx ide stophides the link within one poll.…/t/<tower>/api/ideis still refused over the cloud.Flaky Tests
None of these files is in this diff; all were left running, none skipped or edited.
packages/codev/src/__tests__/protocol-drift-audit.test.ts"the REAL default lookup is offline-tolerant AND bounded when the registry is unreachable" (:178) fails on a machine whose npm config has a scoped@cluesmith:registry: the scoped registry overrides the test'snpm_config_registry=http://127.0.0.1:1, sonpm viewreturns3.3.7instead of null. An env override of the scope alone is not enough under porch, because pnpm's script runner re-exports the user npm config. Per the architect's ruling, porch runs here used a one-run emptynpm_config_userconfig; the hermetic test fix is on the architect's filing list.packages/codev/src/agent-farm/__tests__/pir-1233-session-launch-loop.test.ts"recover-path entry uses the provided initial command; a crash then resumes the discovered id with the nudge": 5000ms timeout in a full run at load ~22; passed in isolation (recorded intermittent on main).packages/codev/src/agent-farm/__tests__/bugfix-1267-launch-loop.test.ts:114"keeps resuming across a CRASH": 5000ms timeout in full runs (including post-merge at load 20 to 35); passes in isolation.packages/codev/src/agent-farm/__tests__/ide-command.test.ts"ideInstall (Scenario 24) reports the installed server version on success" andspec-1365-serializer-convergence.test.ts"the drainer keeps delivering to OTHER agents while one terminal is held": 5000ms timeouts at load ~22; 63/63 in isolation.packages/codev/src/commands/consult/__tests__/agy-auth-cache.test.ts"spawns agy at most once across a 5-wide burst when unauthenticated":expected 5 to be 1under load (lock losers fail open after the 6s wait when the fake prober is slowed); 27/27 in isolation.bugfix-1455-pr-create-concept.test.ts(gitea),doctor.test.ts"should return 0 when all dependencies are installed",claude-cli-lane.test.ts(2),tripwire-wiring.test.ts"fires when the lane creates a file".vitest-setup.tschange (merged in3bea1820b) drops them, and the post-merge full run had 1 timeout where the pre-merge run had 7.