mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-28 04:41:52 +01:00
feat(login): use the login pseudo-terminal for Codex device login and de-Claude the shared channel (#12020)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agent adapters use provider-specific login flows > - Codex device login needs a live pseudo-terminal (PTY), while the shared channel still uses Claude-specific names > - The old streamed-exec path does not provide the prompt transport that Codex needs > - This pull request moves Codex device login to the shared login PTY and removes the dead streamed-exec path > - The benefit is one controlled login transport with fail-closed capability checks and safer credential reads ## Linked Issues or Issue Description **Problem or motivation** Codex device login used a streamed-exec path that did not provide the required prompt transport. The shared login channel also exposed Claude-specific names outside Claude code. **Expected behavior** The host selects a fixed login command from trusted adapter data. Codex login uses the provider login PTY. Providers without that capability fail closed. **Proposed solution** Use a server-controlled session home, create and validate it as a fresh 0700 directory, read credentials from one validated descriptor, and rename shared channel names to the neutral login PTY family. **Alternatives considered** Keep the shared login PTY as the single transport. Do not keep the removed streamed-exec path because it cannot provide the required prompt transport. **Roadmap alignment** This change supports the planned login transport work. It does not add a separate roadmap item. ## What Changed - Route Codex device login through the shared login PTY transport. - Select the login command from a closed internal command key. - Carry a server-controlled session home through the launch contract. - Create and validate the session home as a fresh 0700 directory owned by the login user. - Read the credential file with descriptor-relative, no-follow path walking and final descriptor checks. - Gate the login route and run lease on the provider login PTY capability. - Rename shared channel names to the neutral login PTY family. - Remove the streamed-exec transport value, selector field, driver branch, and related tests. - Hide Codex login in the user interface when the provider lacks the login PTY capability. ## Verification - Server unit suites pass: 89/89. - Adapter-utils suites pass: 262/262. - Codex-local suites pass: 326/326. - Credential-read reader suite passes: 20/20. - Daytona login PTY suite passes: 30/30. - Device-login suites pass: 56/56. - TypeScript checks pass for server, adapter-utils, and UI. - GitHub Actions must pass after pull request creation. - Greptile review must reach 5/5 with no open P2 findings, recommendations, or follow-ups. ## Risks - Providers without a login PTY capability lose Codex login support by design. - The credential read rejects invalid ownership, mode, type, path, and size. - The launch-time sandbox directory race remains outside the threat model because the login runs inside the sandbox and a hostile sandbox already controls its credential. ## Model Used OpenAI Codex, GPT-5, tool use and code review assistance. The exact context window and reasoning mode are not exposed by the runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
16b59c9315
commit
63df7ad2b3
52 files changed
+3500
-1033
No files matched your search
@@ -18,7 +18,6 @@ function makeModule(loginCapability?: unknown) {
|
||||
|
||||
const validLoginCapability: AdapterLoginCapability = {
|
||||
panelMode: "displayed_code",
|
||||
sandboxTransport: "streamed_exec",
|
||||
timeoutPolicy: "caller_bounded",
|
||||
getCommand: () => "vendor login",
|
||||
parsePrompt: () => null,
|
||||
|
||||
@@ -13,7 +13,6 @@ describe("built-in adapter login capabilities", () => {
|
||||
expect(capability).toBeDefined();
|
||||
if (!capability) return;
|
||||
expect(capability.panelMode).toBe("displayed_code");
|
||||
expect(capability.sandboxTransport).toBe("streamed_exec");
|
||||
expect(capability.timeoutPolicy).toBe("caller_bounded");
|
||||
expect(capability.completionClaim).toBeUndefined();
|
||||
expect(typeof capability.getCommand).toBe("function");
|
||||
@@ -26,7 +25,6 @@ describe("built-in adapter login capabilities", () => {
|
||||
expect(capability).toBeDefined();
|
||||
if (!capability) return;
|
||||
expect(capability.panelMode).toBe("submitted_browser_code");
|
||||
expect(capability.sandboxTransport).toBe("pseudo_terminal");
|
||||
expect(capability.timeoutPolicy).toBe("fixed");
|
||||
expect(capability.completionClaim).toBe("storedSessionId");
|
||||
expect(typeof capability.getCommand).toBe("function");
|
||||
|
||||
@@ -205,7 +205,6 @@ Paperclip keeps this tombstone registered so stale acpx_local rows fail clearly
|
||||
// values only.
|
||||
const claudeLoginCapability: AdapterLoginCapability = {
|
||||
panelMode: "submitted_browser_code",
|
||||
sandboxTransport: "pseudo_terminal",
|
||||
timeoutPolicy: "fixed",
|
||||
getCommand: () => CLAUDE_SETUP_TOKEN_COMMAND,
|
||||
parsePrompt: (output) => {
|
||||
@@ -220,13 +219,13 @@ const claudeLoginCapability: AdapterLoginCapability = {
|
||||
};
|
||||
|
||||
// The Codex interactive login capability. Codex runs `codex login --device-auth`
|
||||
// over the streamed exec channel. The flow shows a one-time code that the user
|
||||
// enters in the browser. The caller sets the host-side timeout. The device-login
|
||||
// flow writes its credential inside the sandbox, so the capability declares no
|
||||
// terminal credential capture and no completion claim.
|
||||
// on a real pseudo-terminal, because a pipe emits no login prompt. The flow shows
|
||||
// a one-time code that the user enters in the browser. The caller sets the
|
||||
// host-side timeout. The device-login flow writes its credential inside the
|
||||
// sandbox, so the capability declares no terminal credential capture and no
|
||||
// completion claim.
|
||||
const codexLoginCapability: AdapterLoginCapability = {
|
||||
panelMode: "displayed_code",
|
||||
sandboxTransport: "streamed_exec",
|
||||
timeoutPolicy: "caller_bounded",
|
||||
getCommand: () => CODEX_DEVICE_LOGIN_COMMAND,
|
||||
parsePrompt: (output) => {
|
||||
|
||||
Reference in new issue
Block a user