Repository navigation
Conversation
EhabY
force-pushed
the
fix/cli-open-app-session-token
branch
from
October 26, 2026 13:22
b8d044c to
c4ecd41
Compare
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coder open appnow fills in$SESSION_TOKENusing the same link rules as the dashboard (#31208): a known Coder handler, aurlthat is the deployment the CLI is logged in to, andtoken=$SESSION_TOKENas the only placeholder. Previously it filled in the token for any template app URL.External app URLs that still contain the placeholder are printed with a warning instead of opened. Sub-agent apps still never get the token. Apps without the placeholder open as before.
The allowed handlers now live in one place in
codersdk, as VS Code-family schemes (VSCodeSessionTokenScheme),VSCodeCoderExtensionID,VSCodeSessionTokenPathandJetBrainsSessionTokenHandler. The dashboard gets them throughtypesGenerated.ts, and hard-codedcoder.coder-remotelink builders now useVSCodeCoderExtensionID.Breaking changes
For template apps that use
$SESSION_TOKEN,coder open appnow prints the URL with the placeholder and exits 0 instead of opening it when:https://...,http://...or another custom scheme.urlisn't the deployment the CLI is logged in to. This includes templates that overrideprovider "coder" { url = ... }, CLIs logged in through a different hostname than the one in the link, andurlvalues with a path, userinfo or an explicit default port.token=entry, duplicate or percent-encoded param names, or a JetBrains Gateway link that doesn't start with#type=coder&.Inside a workspace (
CODER=true), these URLs are printed with the placeholder instead of the token.Decision log
client.URL: the CLI has no browser origin. Scheme and host are compared exactly, so the CLI may be slightly stricter than the dashboard.codersdkenums used by the CLI and generated for the dashboard, instead of two hand-kept copies. VS Code-family links are rebuilt from scheme, extension ID and path; the 3 JetBrains prefixes don't share that shape, so they stay whole. Both callers split every prefix with the same rule: scheme and authority end at the first/,?or#after://. The tracked app sessions registry wasn't reused: it lists apps for usage tracking, not links trusted with a token.<scheme>://coder.coder-remotelink: the scheme decides which program opens the link, and only VS Code forks treatcoder.coder-remoteas the Coder extension.&or=in decoded values, since registry modules put folders and download links in unencoded.