Repository navigation
feat(cli): sign in to styal Link with an emailed code in the terminal - #905
Open
incognitojam wants to merge 1 commit into
Open
incognitojam wants to merge 1 commit into
incognitojam wants to merge 1 commit into
Conversation
incognitojam
added this pull request to stack #906
October 18, 2026 17:31
Upstream divergenceBoth sides are compared with upstream at the in-order tip
Upstream files that start to differ (7)
Upstream files whose difference changes (11)
|
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
2 times, most recently
from
October 18, 2026 17:42
b49b198 to
aeff160
Compare
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 18, 2026 17:53
aeff160 to
49e2247
Compare
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 19, 2026 13:53
49e2247 to
01c6e29
Compare
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
2 times, most recently
from
October 19, 2026 17:00
013cd34 to
0b9ccd8
Compare
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
2 times, most recently
from
October 20, 2026 10:42
c8010ea to
8a337b5
Compare
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 20, 2026 11:00
8a337b5 to
20c66df
Compare
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 20, 2026 15:29
20c66df to
a8fff54
Compare
incognitojam
marked this pull request as ready for review
October 20, 2026 15:55
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 21, 2026 15:57
a8fff54 to
1a88ba6
Compare
`styal link` now asks for an email and the eight-digit code from it in the terminal, so signing in works the same locally and over SSH. The loopback browser flow and Clerk's device grant are gone. The CLI keeps its own P-256 DPoP key and relay session in the server's secret store, and signs link, unlink and tunnel-release requests with DPoP. The key is published atomically, so a CLI and background server starting together agree on one key. A background server moves a stored Clerk credential to a relay session on startup without a prompt, retrying when Clerk or the relay is unavailable, under a lock shared by every process using the same home. The Clerk credential is kept for older processes and deleted only when Clerk or the relay rejects it. `status` shows the account email and `logout` ends the session at the relay. The browser and CLI share a DPoP proof signer in @t3tools/shared/dpopProof. Docs, the agent test skill and the fork differences overview describe email sign-in and the order to roll it out in.
incognitojam
force-pushed
the
styal/link-cli-email-sign-in
branch
from
October 22, 2026 00:29
1a88ba6 to
eea6285
Compare
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
styal linksigns in through Clerk, either a loopback browser flow or Clerk's device grant, so CLI and background-server sessions also end on Clerk's schedule, and signing in over SSH needs a browser on the remote side.Change
styal linkasks for an email address and the eight-digit code from it in the terminal, so sign-in works the same locally and over SSH. The loopback browser flow and Clerk's device grant are removed.The CLI keeps its own P-256 DPoP key and relay session in the server's secret store and signs link, unlink and tunnel-release requests with DPoP. Secrets are published with a hard link so a CLI and a background server starting together agree on one key, with an exclusive-create fallback on filesystems without hard links. Credential changes run under a cross-process file lock shared by every process using the same home; the Codex ChatGPT session lock now uses the same implementation.
On startup a background server exchanges a stored Clerk credential for a relay session without prompting. It retries while Clerk or the relay is unavailable and stops after errors that cannot succeed. The Clerk credential is kept for older processes and deleted only when Clerk or the relay rejects it. Network calls made under the lock time out after 15 seconds, and contention reports "Another styal process is updating the styal Link sign-in; try again."
statusshows the account email, andlogoutends the session at the relay.styal link loginoffers email sign-in whenever the stored sign-in cannot be used for a lasting reason (Clerk refuses the refresh, the relay refuses the exchange, the stored Clerk token cannot be read), and fails with a clear message only for temporary problems such as an unreachable relay or another process holding the lock. A failed verify or resend over a flaky connection prints the error and asks again instead of ending the sign-in. A session stored for a different relay than the configured one counts as signed out, and authorization headers are only produced for requests to the session's relay. Passing--emailfor a different address than the signed-in account warns and points tostyal link logout.The CLI signs proofs with the DPoP helpers in
@t3tools/shared/dpopProof. User and operations docs, the agent test skill, the fork differences overview and the fork feature ledger describe email sign-in and its rollout order.Scope and approval
Maintainer-directed replacement of Clerk for styal Link identity.
Verification
styal link login --email …in a pseudo-terminal against the local relay: a wrong code printed "That code is not correct", the right code printed "Signed in as agent+cli-e2e@styal.build", and the relay held onet3-clisession.styal link statusshowed the account email;styal link logoutprinted "Signed out of styal Link." and the session row was gone. The secrets directory and files were mode 0700/0600.EPERM,EXDEV,ENOSYSand others), stale temp cleanup, startup retry policy against permanent and transient errors, stalled requests timing out and releasing the lock, lock contention, and a separate-process lease.styal link loginfrom source in a pseudo-terminal signed in with the fixed test code, a wrong code for another address was rejected and asked for again,statusshowed the account, andlogoutrefreshed the token, deleted the environment link, called/v1/auth/sign-outand left the CLI signed out.t3-cli) and auth mode, and session rows carry the client id.Written by an agent (Claude Code, claude-opus-5-5).