Repository navigation
[3867 by Claude Opus 5.5] Dashboard sign-in via GitHub device flow for relay-enrolled instances on any host - #3868
Conversation
Relay-only instances can now sign browsers in on any host using GitHub's device flow, with no OAuth App, tunnel or callback URL. All tests pass with GitHub mocked. Nothing has been tried live, because Device Flow isn't enabled on the `propr-dev` App yet; until it is, sign-in shows "Device sign-in isn't enabled for this GitHub App". How the mode is chosen - `resolveBrowserAuthMode` returns the new `device` mode where it used to return `disabled`. This applies to an instance using the hosted relay that has neither its own OAuth client nor a loopback Connect callback. - A relay other than the hosted one gets `device` only when `PROPR_GH_DEVICE_CLIENT_ID` is set. Without it, the shared App's client ID wouldn't match that relay's App, so it stays `disabled`. - `PROPR_WEB_AUTH_MODE=device` selects it explicitly. The other modes keep their order, and the ui.gitfix.dev-style `github` mode is unchanged. - The shared App's client ID (`Iv23liTCmmSNYyD0NtZA`) ships as a default next to `DEFAULT_PROPR_GH_RELAY_URL`. Sign-in flow - The API requests the code with the client ID only, and keeps the device code on the server. It also polls GitHub itself, waiting the `interval`, adding to it on `slow_down`, and stopping at `expires_in`. - The user code goes only to the browser that started the attempt: each attempt is tied to that browser's session cookie and gets its own code. - Starts are rate-limited per IP and per session (5 per 15 minutes). - After `GET /user`, the user must have access to the relay's installation via `GET /user/installations`. With `GH_INSTALLATION_ID` set, the IDs must match. Without it, the relay installation's account is read using a relay installation token, and anything that can't be determined is refused. Connect's own check isn't in this repo, so this is my best reading of "equivalent to Connect's"; please confirm it. - Then the whitelist applies and the normal session is created. - Errors have clear messages for `device_flow_disabled`, `access_denied`, expired codes, no installation access and not whitelisted. Tests check that tokens and device codes never appear in logs or responses. Tokens: one assumption to check. Device-flow tokens are stored exactly like Connect sign-ins, including encryption at rest. Renewal therefore goes through the relay's `/auth/instance-grants/refresh`, which holds the App's secret. This only works if the relay renews refresh tokens it didn't issue through Connect. If it doesn't, users will have to sign in again when the 8-hour GitHub App token expires. Login page: in device mode it shows the code with a Copy button, a link to `github.com/login/device`, a waiting state, Cancel, and errors with "Try again". The app has no dark theme, so I added `dark:` styles that follow the OS colour scheme to the login page and device panel. I captured preview screenshots of light, dark and two error states. `propr deploy fly`: a relay-only deploy is now accepted as device sign-in (`Sign-in: GitHub device sign-in at https://<app>.fly.dev …`). With an existing relay token, the deploy also pins `PROPR_GH_RELAY_URL`, because the API needs it. Not done: - The Fly dashboard wizard from #3852 isn't on this base branch, so per the issue #3852 should drop its OAuth App step and use device mode. - CLI relay enrollment doesn't use the device flow yet. A ready-to-use `runGitHubDeviceFlow` helper is in `@propr/shared` for that. - No live checks on Fly or a non-Fly host, pending Device Flow being enabled. Tests and docs: - New API tests cover every mode combination, each GitHub response, the installation check, session creation, the code staying with its browser, rate limits and route wiring. The Fly sign-in tests were rewritten for the device outcome, and there are new UI tests for the login page. - All new and touched test files pass, and typecheck and lint are clean. I didn't run the full API, CLI or UI suites. - I regenerated the OpenAPI spec and added the new tests to `test:unit`. - Docs: a new "Device sign-in" section in `github-auth.md` (when it's used, the flow, tokens, errors, and how to enable Device Flow on your own App). I also updated the Fly deploy and setup pages, the VPS tutorial, the config reference (the new variables and rate limits) and `web-ui-integration.md`. The main logic is in `packages/api/deviceAuth.ts`, `packages/api/connectAuth.ts` and `packages/shared/src/githubDeviceFlow.ts`. ProPR-Agent: claude/claude-opus-5-5
|
CI failed: Full Test Suite Shard 4/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 7bb9bf6 Summary of ChangesI fixed the Shard 4/4 failure. The date-format guard test failed because the new device sign-in panel was formatting a time itself instead of using the app's shared date formatter. Change: in Visible effect: the expiry time now matches the rest of the app. Hours no longer get a leading zero, so in English it reads "Expires at 10:15 AM" rather than "Expires at 09:15 AM"-style output. I didn't take new screenshots because the only difference is that time format. Checks:
Review digestRisk-tiered paths
Diff size: 1 file changed, +2/−1 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Shard 4/4 failure. The date-format guard test failed because the new device sign-in panel was formatting a time itself instead of using the app's shared date formatter. **Change:** in `propr-ui/src/pages/DeviceSignInPanel.tsx:162`, the "Expires at …" line now uses `formatTimeOfDay` from `utils/dateFormat` in place of its own `toLocaleTimeString(...)` call. **Visible effect:** the expiry time now matches the rest of the app. Hours no longer get a leading zero, so in English it reads "Expires at 10:15 AM" rather than "Expires at 09:15 AM"-style output. I didn't take new screenshots because the only difference is that time format. **Checks:** - The guard test and `LoginPage.deviceSignIn.test.tsx` both pass (7 tests). - ESLint with zero warnings and `tsc --noEmit` on `propr-ui` are both clean. - I didn't rerun the full UI test suite. PR: #3868 Comment by: @propr-dev[bot] (ID: 7231021289) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
CI failed: Full Test Suite Shard 1/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 6857ef1 Summary of ChangesI fixed the Shard 1/4 failure: it was an intermittent hang in one test, not a problem with the device sign-in code. What failed: 298 of 299 test runs passed. The failure was Cause: the logger's background log worker blocks process exit until it reports it is ready. Once it does, its handler waits for earlier log lines to finish writing, polling with Fix ( Verification:
The same hang can happen in any test that switches on the fake clock before the logger is ready. I only changed this test, and I saved the cause and fix to memory for the next time it appears. There's nothing visual in this change, so there are no preview images. Review digestRisk-tiered paths
Diff size: 1 file changed, +9/−1 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Shard 1/4 failure: it was an intermittent hang in one test, not a problem with the device sign-in code. **What failed:** 298 of 299 test runs passed. The failure was `test/spritesLeaseProvisioning.test.ts`, which this PR doesn't touch. All 4 of its subtests passed, but the process never exited and was killed at the 180s per-test timeout. Locally it hung about 1 run in 10. **Cause:** the logger's background log worker blocks process exit until it reports it is ready. Once it does, its handler waits for earlier log lines to finish writing, polling with `setTimeout`, before it lets the process exit. This test replaces `setTimeout` with a fake clock. If the worker starts slowly, as on a busy CI host, that polling lands on the fake clock and is dropped when the clock is reset. The worker then blocks exit forever. In a hung run, the worker's message channel and the stdio pipes were the only things left keeping the process alive. **Fix** (`test/spritesLeaseProvisioning.test.ts`): before switching on the fake clock, the test now waits for the log worker to be ready, on real timers. The same helper already opens the database on real timers for the same reason. **Verification:** - I made the race happen on purpose by holding the worker's ready message until the fake clock was on. The old test then hung in 2 of 3 runs, and the fixed one passed all 3. - In normal runs the fixed test passed 25 of 25, all 4 subtests each time. - I didn't lint or typecheck the change: ESLint skips this file, and root tests aren't typechecked. - I didn't rerun the full shard. The same hang can happen in any test that switches on the fake clock before the logger is ready. I only changed this test, and I saved the cause and fix to memory for the next time it appears. There's nothing visual in this change, so there are no preview images. PR: #3868 Comment by: @propr-dev[bot] (ID: 7231432157) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds device sign-in across the API, login page, deployment planning, and documentation. It needs changes before merge: cancellation does not invalidate in-flight work, and mixed own-App/relay deployments can be accepted despite having an unusable installation check. ✅ Credential containment — Device codes remain server-side, and successful poll responses contain only completion status. ✅ Protocol coverage — Tests cover pending authorization, slowdown, expiry, installation refusal, whitelist enforcement, and browser-session binding. ✅ Passing checks — The supplied current-head status reports 35 passed checks, with no failures or pending checks. This review is based on static tracing of the supplied code; no commands or tests were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Cancellation does not fence in-flight polls
F2: 🔴 Mixed App deployments select unusable device authentication
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Verify device-token renewal compatibilityThe implementation deliberately reuses the existing Connect refresh-token endpoint. The supplied code confirms that routing, but does not establish whether the external relay accepts device-issued refresh tokens. A contract or live integration test would resolve the explicitly documented uncertainty. This is a follow-up rather than a verified code blocker because no supplied evidence demonstrates relay rejection. ScoreThe implementation has substantial coverage and passing checks, but the attempt lifecycle and mixed-installation defects require correction before merge. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 2b52343
Summary of ChangesI fixed both findings. The new tests fail on the old code and pass now, and lint and tsc are clean on the files I touched. I only ran the device sign-in and Fly deploy suites, not the full API or CLI suites. Nothing changes on screen, so I made no previews. F1: Cancelling or replacing an attempt now stops its in-flight poll (
|
| Command | Description | Example |
|---|---|---|
/merge |
Merge target branch into this PR and resolve conflicts | /merge |
/review |
Request an AI code review | /review or /review claude-sonnet |
/fix |
Address review blockers, or blockers and suggestions with /fix all |
/fix, /fix all, or /fix F3 S5 |
/switch |
Change the AI model for this PR | /switch claude-opus |
/use |
Override the model for a single follow-up run | /use claude-sonnet |
/ultrafix |
Loop review→fix cycles until score goal is met | /ultrafix or /ultrafix goal=8 max=10 |
🤖 Generated by ProPR
I fixed both findings. The new tests fail on the old code and pass now, and lint and tsc are clean on the files I touched. I only ran the device sign-in and Fly deploy suites, not the full API or CLI suites. Nothing changes on screen, so I made no previews. ## F1: Cancelling or replacing an attempt now stops its in-flight poll (`packages/api/deviceAuth.ts`) - **Authority to act:** after every wait on GitHub, the poll re-reads the session from the store and checks a list of revoked attempts kept in the API process. It saves a result or signs in only if its attempt is still the active one and hasn't been revoked. There's no other wait between that check and the save or sign-in. - **Cancel** revokes the attempt before it saves, so a poll already waiting can't sign in or put the attempt back, even if the cancel's own save fails. - **Start again** revokes the old attempt and saves the session before asking GitHub for a new code. A poll of the old attempt that finishes meanwhile gets `device_login_missing` and leaves the new attempt alone. - **Authorized polls** check again after the profile and installation lookups, just before login, so a cancel during those lookups also wins. On the error paths, the attempt is removed only if it is still the active one. - **Remaining race:** a cancel that arrives after that final check is a real race with a sign-in that has already been decided. I didn't try to make that atomic. - **Tests:** a new suite, `packages/api/test/deviceAuthAttemptRaces.test.ts`, holds GitHub mid-request. It covers a pending answer, an authorized answer, and an authorized answer held during the installation check, each against Cancel and against a new start. The cases check that there's no session, the cancelled attempt stays gone, and the new attempt still completes. The shared test setup moved to `test/deviceAuthHarness.ts` to stay under the 400-line lint limit, and the new suite is added to `test:unit`. ## F2: Own App next to a relay token no longer gets device sign-in - **`propr deploy fly`** (`flyBrowserAuth.ts`) now refuses device sign-in when the Machine's `GH_INSTALLATION_ID` belongs to the stack's own App. It uses the same rule as the relay planning: an ID next to `GH_APP_ID` belongs to the own App unless relay mode is pinned or the run enrolls the relay App's installation. The error suggests `--relay`, the tunnel flags, or the own App's OAuth client. `--relay` and `GH_AUTH_MODE=relay` still give device sign-in. - **The API's own mode choice** (`connectAuth.ts`) made the same assumption for non-Fly hosts. It now chooses `disabled` instead of `device` when `GH_AUTH_MODE=app`. - **Tests and docs:** new cases in `flyBrowserAuth.test.ts` and `connectAuth.test.ts`, plus updates to `deploy-fly.md` and `github-auth.md`. ## Related issues I left alone - **Explicit device mode with an own App:** setting `PROPR_WEB_AUTH_MODE=device` together with `GH_AUTH_MODE=app` is still accepted. Sign-in then checks the own App's installation and refuses everyone; I treated the explicit setting as the operator's choice. - **More than one API process:** the revoked-attempt list exists only inside one API process. Across processes, re-reading the session covers almost every case, but a very small window between one process reading the session and saving it remains. PR: #3868 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds GitHub device sign-in across the API, login page, and Fly deployment flow. It needs changes before merge: device credentials omit the durable renewal marker, and overlapping start requests can overwrite newer attempts. ✅ Browser-bound attempts — Polling requires both the initiating session and its attempt identifier; responses exclude device codes and tokens. ✅ Protocol handling — The implementation handles pending authorization, slowdown, expiry, installation access, and whitelist refusal, with focused mocked tests. ✅ Poll cancellation coverage — Added tests explicitly cover cancellation and replacement while token polling or installation checks are pending. This is a static review of the supplied code; no commands or tests were run. The authoritative checks report 29 passed, five pending, and no failures. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F3: 🔴 Preserve durable relay renewal eligibility
F4: 🔴 Fence overlapping device starts
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Verify the external renewal contractThe implementation summary explicitly leaves relay acceptance of device-issued refresh tokens unverified. A live integration check covering initial authorization and subsequent refresh would resolve that dependency. This is a follow-up verification item rather than a demonstrated external-service defect. S3: 🟢 Document device endpoint schemasThe generated OpenAPI entries expose the new routes but leave their request and response bodies undocumented. Adding schemas for attempt identifiers, pending responses, and terminal errors would help API consumers; the supplied objective does not make that documentation a merge requirement. ScoreThe implementation has useful authorization checks and targeted coverage, but durable renewal metadata and overlapping-start handling require correction. Passing checks do not cover these demonstrated gaps. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 085485e
Summary of ChangesI fixed both findings. The new tests fail on the previous code and pass now. All 65 tests across the device-auth, Connect auth and grant-renewal suites pass, and typecheck and lint are clean for F3: device credentials are now marked for relay renewal
F4: an older start can no longer displace a newer one
Supporting changes
There are no visual changes, so I made no previews. Review digestRisk-tiered paths
Diff size: 6 files changed, +376/−80 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Shard 4 failed because one test file, `test/spritesLeaseProvisioning.test.ts`, hung after it had already passed. It ran all four of its subtests in under a second, then never exited, and the runner killed it at the 180s limit. This PR's code didn't cause it: the file is unchanged on this branch, and the hang is a known flake in how the test sets up its fake clock. **Cause:** the test swaps in a fake `setTimeout` clock. The logger's background thread sometimes finishes starting while that fake clock is active. A timer it sets during startup lands on the fake clock and is thrown away when the test cleans up. The thread then stays open and keeps the process alive. It's timing-dependent, so it happens more often on a busy CI host. **Fix:** the test now waits for the logger to finish starting before it turns on the fake clock. This is a copy of the fix in the still-open PR #3868, which hit the same flake. Because the change is byte-for-byte the same, the two branches will merge cleanly whichever lands first. Only `test/spritesLeaseProvisioning.test.ts` changed, with 9 lines added and 1 changed. **Verification:** the file passed 10 out of 10 times through `scripts/run-test-suite.mjs`, with all 10 running in parallel to add load. I can't fully confirm the fix locally, because before the change the file also passed when run alone, so the real test is the next CI run. There's no visual change, so I didn't make any previews. PR: #3865 Comment by: @propr-dev[bot] (ID: 7235221214) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
I fixed both findings. The new tests fail on the previous code and pass now. All 65 tests across the device-auth, Connect auth and grant-renewal suites pass, and typecheck and lint are clean for `packages/api`. I didn't run the full API suite. **F3: device credentials are now marked for relay renewal** - `deviceSignInUser` now sets `connectRenewal: 'relay'` whenever GitHub returns a refresh token. Grant capture then stores `renewal: 'relay'`, which is what desktop, MCP and agent-run renewal look for. - A token without a refresh token never expires and has nothing to renew, so it stays `renewal: null`. - New test `packages/api/test/deviceAuthGrantCapture.test.ts` runs a device sign-in through the real grant capture into an in-memory SQLite database. It checks that the grant is stored as renewable, that replacing an existing renewable Connect grant keeps it renewable, and that a non-expiring token isn't marked. - Whether the relay actually accepts these refresh tokens is still unchecked, as noted in the PR description. **F4: an older start can no longer displace a newer one** - Each start now stores a start ID in the session and saves it before asking GitHub for a code. - When GitHub answers, the handler reloads the session. It then saves the code or the error only if that start ID is still the latest. If not, the older request answers `device_login_missing` and leaves the session alone, so express-session doesn't save it either. - A replaced or cancelled start is also recorded in the same in-process revocation list that polls already use. - The start ID becomes the attempt ID once the code is saved. - Cancel had the same problem: a start answered after Cancel would put an attempt back. Cancel now revokes and clears a start that is still waiting for its code. - New test `packages/api/test/deviceAuthStartRaces.test.ts` uses two tabs sharing one session cookie, with GitHub holding the first code request. It covers both a code and an error arriving late, after a newer start and after Cancel. It also checks that the newer attempt still completes using its own device code, and that a normal failed start still reports the GitHub error and can be retried. **Supporting changes** - The attempt state and the fencing helpers moved from `deviceAuth.ts` into a new `packages/api/deviceAuthAttempts.ts`, to keep `deviceAuth.ts` under the 400-line lint limit. `deviceAuth.ts` re-exports the types. - The test harness (`deviceAuthHarness.ts`) can now hold and vary each code request, take a grant-capture callback, and open a second tab on the same session. - I added both new test files to `test:unit` in `package.json`. There are no visual changes, so I made no previews. PR: #3868 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds device-based browser sign-in across the API, UI, and Fly deployment flow. It needs changes before merge because newly issued credentials are routed into a renewal protocol that cannot renew them. ✅ Browser-bound attempts — Start responses keep device codes server-side, and polls require the attempt stored in the requesting browser’s session. ✅ Authorization checks — Successful GitHub authorization is followed by installation-access and whitelist checks before session creation. ✅ Race regression coverage — Added tests exercise cancellation and replacement while GitHub code requests and token polls are pending. The supplied current-head status has 29 passed checks, five pending, and no failures. This review uses static tracing of the supplied code; no commands or tests were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Device credentials use an incompatible renewal protocol
SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Record live authentication validationOnce Device Flow is enabled, record a complete sign-in on a deployed instance and a subsequent credential renewal. Mocked coverage verifies substantial local behavior, but cannot establish the shared App’s configuration or external relay compatibility. This is useful release evidence beyond correcting the concrete protocol defect above. ScoreThe implementation has useful authorization checks and focused regression coverage, but its durable credential lifecycle is incomplete. Passing checks do not cover the incompatible renewal handoff. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit b35e833
Summary of ChangesI fixed F5. Device sign-in grants now renew by sending their own refresh token to the relay's Root cause. Every grant consumer (desktop metadata, MCP, agent-run grants) goes through
The previous F3 fix marked device grants Changes
Other places with the same assumption. I found none to fix. The session-level fallback ( Verification
Still unverified: nothing has been tested against a live relay. This fix relies on the hosted relay's There are no visual changes, so I made no previews. Review digestRisk-tiered paths
Diff size: 3 files changed, +110/−29 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F5. Device sign-in grants now renew by sending their own refresh token to the relay's `/auth/instance-grants/refresh`. They no longer go through relay-held renewal (`/instance-auth/renew`), which only sends the user id for a refresh token the relay never received.
**Root cause.** Every grant consumer (desktop metadata, MCP, agent-run grants) goes through `GitHubUserGrantService.resolve`, which picks one of two renewal paths:
- **Relay-held renewal:** used when a grant is stored with `renewal: 'relay'`. The instance sends only `{ github_user_id }` to `/instance-auth/renew`. This only works for credentials the relay issued and still holds.
- **Refresh-token renewal:** used for any other `connect` grant. The instance sends `{ refresh_token }` to `/auth/instance-grants/refresh`, and the relay refreshes it with the App's secret.
The previous F3 fix marked device grants `connectRenewal: 'relay'`, which put them on the first path even though the relay has never seen their refresh token. Before that marker, they already used the second path.
**Changes**
- **`packages/api/deviceAuth.ts`, `deviceSignInUser`:** device grants are no longer marked for relay-held renewal. Grant capture stores `renewal: null` and keeps the encrypted refresh token, so `resolve` uses the refresh-token path. If a device sign-in replaces an older relay-held Connect grant, the renewal field is cleared, so the new refresh token is the one used.
- **`packages/api/test/deviceAuthGrantCapture.test.ts`:** rewritten around actual renewal. It runs device sign-in through real grant capture into SQLite, with a fake relay that refreshes presented refresh tokens and answers `renewal_unavailable` on `/instance-auth/renew`. It covers:
- A device-only user with no prior Connect grant whose token is due for renewal: one call to `/auth/instance-grants/refresh` with `Bearer <relay token>` and `{ refresh_token: <device refresh token> }`, no call to `/instance-auth/renew`. The renewed credential is stored, and the next renewal sends the rotated refresh token.
- Replacing an existing relay-held Connect grant: it switches to refresh-token renewal and sends the device refresh token.
- The captured grant: `renewal` is null and the refresh token is stored.
- A non-expiring token without a refresh token: no renewal call.
- **`docs/docs/operations/github-auth.md`:** the "Tokens" paragraph now states the actual contract: endpoint, auth header, request body, response fields, when renewal happens (within five minutes of expiry or when GitHub rejects the token), and which errors require signing in again (`bad_refresh_token` / `invalid_grant`). It also says device grants never use `/instance-auth/renew`. The "own App" note now points to that contract.
**Other places with the same assumption.** I found none to fix. The session-level fallback (`authGithubTokens.ts`) and the shared visual-preview grant service in core already send the refresh token to `/auth/instance-grants/refresh` for `connect` credentials, which matches the fixed behaviour. Nothing else reads `connectRenewal`.
**Verification**
- The new renewal tests fail on the previous `deviceAuth.ts` (3 of 4) and pass now.
- All 71 tests across the device-auth, Connect auth, grant-renewal and grant-rotation suites pass.
- `packages/api` lint and typecheck are clean. That tsconfig doesn't cover test files; I ran the test file with tsx but didn't typecheck it separately.
- I didn't run the full API suite.
**Still unverified:** nothing has been tested against a live relay. This fix relies on the hosted relay's `/auth/instance-grants/refresh` refreshing a refresh token for the same App that it didn't issue through Connect. GitHub should accept that, because refresh only needs the App's client ID and secret, but it should be confirmed once Device Flow is enabled on the App.
There are no visual changes, so I made no previews.
PR: #3868
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
Fixed the `Validate Changes` lint failure for PR #3868. The JSX formatting change brings [SocketProvider.tsx](/home/node/workspace/propr-ui/src/contexts/SocketProvider.tsx:452) under ESLint’s 400-line limit and preserves rendering and socket behavior. UI lint passed with zero warnings. UI typecheck, the production build, and all 24 socket provider tests passed locally. The change has no visual effect. PR: #3868 Comment by: @github-actions[bot] (ID: 7254727887) Comment by: @propr-dev[bot] (ID: 7254727936) Model: GPT-6.2 Sol ProPR-Agent: codex/gpt-6.2-sol
|
CI failed: Full Test Suite Shard 3/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 7e5707d Summary of ChangesFixed the five device sign-in renewal tests that failed in Shard 3/4. They now verify that a temporary relay failure preserves the session, suppresses retries for 30 seconds, and allows renewal once the backoff expires. The fix is test-only. All 53 tests across five related suites passed on Node 24.22.3, the CI runner’s version. ESLint passed for the changed file. The full shard still awaits CI verification. Review digestRisk-tiered paths
Diff size: 1 file changed, +11/−4 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Live verification at f364e24: passedTested on a Fly instance (
Cosmetic, optional: the renewal log line has a stray space before the reason, This ran at f364e24, before the epic merge in ddbeaac (which brought in #3880). I'll re-run a short sign-in and renewal check on the merged head once CI is green. |
Fixed the five device sign-in renewal tests that failed in Shard 3/4. They now verify that a temporary relay failure preserves the session, suppresses retries for 30 seconds, and allows renewal once the backoff expires. The fix is test-only. All 53 tests across five related suites passed on Node 24.22.3, the CI runner’s version. ESLint passed for the changed file. The full shard still awaits CI verification. PR: #3868 Comment by: @propr-dev[bot] (ID: 7255052954) Model: GPT-6.2 Sol ProPR-Agent: codex/gpt-6.2-sol
|
✅ Applied the requested follow-up changes in commit 7c0e6f7 Summary of ChangesRemoved the stray space from the device sign-in renewal warning. It now logs All 25 targeted renewal and re-authentication tests passed. The change only affects server logs. Live Fly verification was outside this follow-up. Review digestRisk-tiered paths
Diff size: 1 file changed, +4/−2 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Removed the stray space from the device sign-in renewal warning. It now logs `(bad_refresh_token)`. All 25 targeted renewal and re-authentication tests passed. The change only affects server logs. Live Fly verification was outside this follow-up. PR: #3868 Comment by: @integry (ID: 7255086062) Model: GPT-6.2 Sol ProPR-Agent: codex/gpt-6.2-sol
Live retest on the merged head 7c0e6f7 (with #3880): the "sign-in expired" message is lostSame Fly instance and steps as my earlier comment. That run passed at f364e24; this one is on 7c0e6f7.
Likely cause: a race between concurrent first requests.
Please fix (both parts):
|
|
✅ Applied the requested follow-up changes in commit 7d08e67 Summary of ChangesFixed the expired GitHub sign-in notice for PR #3868. The server now keeps the re-authentication reason in Redis for five minutes after clearing the session. Requests still carrying that session ID receive Local tests confirmed that all five concurrent requests received the reason after a single renewal attempt. Chromium passed three runs covering both a bare and a reason-bearing first Review digestRisk-tiered paths
Diff size: 9 files changed, +224/−43 lines Visual previewExpired GitHub sign-in after reloadThe login card shows the expired GitHub sign-in message after reloading the dashboard and landing on plain /login. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Fixed the expired GitHub sign-in notice for PR #3868. The server now keeps the re-authentication reason in Redis for five minutes after clearing the session. Requests still carrying that session ID receive `401` with `GITHUB_REAUTH_REQUIRED` and `device_sign_in_expired`. Plain `/login` also reads the browser’s remembered reason and displays “Your GitHub sign-in expired. Sign in again with a new code.” Local tests confirmed that all five concurrent requests received the reason after a single renewal attempt. Chromium passed three runs covering both a bare and a reason-bearing first `401`, and I captured the login notice preview. Live Fly verification remains pending. PR: #3868 Comment by: @integry (ID: 7258661444) Model: GPT-6.2 Sol ProPR-Agent: codex/gpt-6.2-sol
Live retest at 7d08e67: passesSame Fly instance (
Code review of the follow-up: the destroyed-session record is keyed by the signed session ID and holds only an allowlisted reason, and |
|
ℹ️ Analyzed the follow-up request by @integry Analysis SummaryPR #3868 is already at All 8 focused regression tests passed locally, including the test that verifies concurrent dashboard requests preserve No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationReady to merge within the reviewed scope. The PR implements device sign-in and the authorized follow-up for reliable expiry messages. The supplied current-head status reports 35 passed checks and no failures or pending checks. This review used static analysis only; no commands were run. ✅ Session-bound sign-in — Device codes remain server-side, polls must identify the session’s attempt, and completion checks installation access and the whitelist. ✅ Expiry reason propagation — HTTP and socket errors carry the device-expired reason. An allowlisted cookie and short-lived session-store record preserve it after session destruction. ✅ Focused regression coverage — Added tests cover cancellation and replacement during GitHub requests, renewal classification, subsequent unauthenticated requests, and competing login navigations. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S12: 🟢 Anchor helper expiry before presentationIn ScoreThe changed browser flow has substantial targeted coverage, coherent authorization checks, and passing current-head validation. No merge-blocking defect was established from the supplied code. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
… paste credentials + interactive login on the remote runtime (#3865) * feat: add pasted agent credentials and remote-runtime login I've implemented all three parts of #3863, but none of the live acceptance runs on a Fly-launched instance have happened, so there are no run links for the PR yet. The new tests pass: 311 server-side tests across the touched suites and 12 UI tests. Typecheck, lint (zero warnings) and the OpenAPI check are clean. 1. Pasted credentials (works on every runtime, including Docker) - The agent dialog has a third setup option, Paste a key or token. Editing a saved agent shows the same section. - Claude: an Anthropic API key or a `claude setup-token` token. Either goes into `settings.json` under `env` as `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`. Saving one removes the other, and other settings are kept. - Codex: an OpenAI API key, written to `auth.json` the way `codex login --with-api-key` does it, or a pasted `auth.json`. - OpenCode: a pasted `auth.json`, stored in its data directory. - Each option links to where the key or token comes from. - Values are write-only. The dialog and the new `GET/PUT/DELETE /api/agents/:id/credentials` endpoints only report "set" plus the last 4 characters. Remove deletes a value. - Files are written atomically with mode 0600, under the same store lock the runs use. - I added redaction patterns for these key formats and for secrets inside the JSON files, with a case in `test/redactSecrets.test.ts`. - Vibe keeps its existing Mistral key field, which the API already redacts. I didn't touch the stores #3853 changes. 2. Interactive login on the remote runtime - This applies when the agent runs on Sprites or Fly Machines and there's no local Docker. "No Docker" means neither `DOCKER_HOST` nor `/var/run/docker.sock` is present. - Sprites: the login takes a Sprite from the normal pool, so it counts against `PROPR_SPRITES_MAX`. It runs the login CLI with a TTY, and the Sprite is always deleted afterwards, never returned to the pool. - Fly Machines: the login starts a short-lived `propr-login-*` Machine from `PROPR_FLY_IMAGE`, holding a `PROPR_FLY_MACHINES_MAX` slot. Fly's API has no interactive console, so output and keystrokes go through its exec API, polled about once a second. If ProPR crashes, the Machine ends the CLI and destroys itself. - On success, the login files the provider manifest declares are copied into the agent's credential store, then the Sprite or Machine is destroyed. - If no slot frees up within 30 seconds, or Fly's organization machine limit is hit, the login fails with a message naming the cap. - Provisioning a new Sprite takes a few minutes. The dialog streams progress meanwhile. 3. Health check by runtime - For agents on Sprites or Fly Machines, the check no longer touches a local Docker image or starts a test run. It checks three things: the runtime token is accepted, the CLI version (Sprites) or agent image (Fly) resolves, and the agent has a stored credential. - Failures now show Agent runtime unavailable or an auth error, never "Agent image preparation failed". - Docker instances behave as before. Things to know - The API process needs `PROPR_SPRITES_TOKEN` or the `PROPR_FLY_*` variables. They're already shared on a `propr deploy fly` instance, since the API and worker run in the same container. - Interactive login on Sprites covers the agents Sprites runs today (Claude, Codex, Antigravity). OpenCode becomes available there once #3853 adds it. - To stay under the file-length limit, I moved the terminal-output sanitizer, the Docker helpers and the login routes into separate files. The OpenAPI spec was regenerated. Docs: `setup-fly.md` has a new "Agent credentials" section. `agents-and-models.md` describes pasting credentials and interactive login without Docker. Still needed before merge: the live runs on a Fly-launched instance — (a) an `AI` issue to a PR with a pasted key on both Sprites and Fly Machines, (b) the interactive Claude login on Sprites followed by a run, and (c) a healthy agent card. Previews of the dialog and agent cards were taken against a mocked API. ProPR-Agent: claude/claude-opus-5-5 * chore: move Docker process helpers out of agentLoginDocker I fixed the Shard 2/4 failure; it was caused by this PR's code, not by flakiness. The failing test file now passes. **Cause:** `test/agentRoutesOpenCodeDiscovery.test.ts` replaces `child_process` with a mock that only provides `execFile`. This PR gave `agentRoutes` a new import chain: `agentCredentialStore` → `agentLoginDocker.ts`. When I moved the Docker helpers into `agentLoginDocker.ts`, that file started importing `spawn` from `node:child_process`. Under the mock, `spawn` doesn't exist, so the test file failed to load: ``` SyntaxError: The requested module 'node:child_process' does not provide an export named 'spawn' ``` **Fix:** I changed the source rather than adding `spawn` to the test's mock. - `defaultRunDocker`, `defaultSpawnDocker` and `DockerCommandResult` now live in a new file, `packages/api/services/agentLoginDockerProcess.ts`. - `agentLoginDocker.ts` no longer imports `child_process`. It keeps only the path and image resolution, which is all the credential store needs. - `agentLoginSessionManager.ts` imports the Docker helpers from the new file. Its exports are unchanged. **Checks run:** - `agentRoutesOpenCodeDiscovery`, `remoteAgentLogin` and `agentRemoteCredentials`: all pass. - The six other suites that touch agent login: all pass, including `agentLoginRoutes`, `routeAuthorization` and `agentDefaultConfigPaths`. - `tsc` for `packages/api` and zero-warning ESLint on the three changed files: clean. I didn't rerun the full shard locally. There's no visual change, so I didn't make previews. PR: #3865 Comment by: @propr-dev[bot] (ID: 7230494503) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: harden agent credential writes and runtime readiness checks I fixed all four findings (F1–F4) and added a regression test for each. I put the HEAD versions of the API services back temporarily, and the new F1, F2 and F3 tests failed against them. With the fixes, the touched suites pass: 17 core tests and 61 API tests. Typecheck and lint pass with zero warnings. **F1: credential edits now read and merge inside the lock** - `writeCredentialStoreFiles` (`credentialStoreWriter.ts`) now also accepts a function that computes the files to write. It runs while holding the store lock, and the symlink and size checks run there too. - `rewrite` in `agentCredentialStore.ts` now reads `settings.json` and merges into it inside that function, so a PUT and a DELETE that overlap each build on the other's result. - `storeReturnedLoginFiles` writes whole login files and doesn't merge, so it didn't have this bug. - **Tests:** a core test runs two overlapping merges. An API test makes a real PUT (swap the API key for an OAuth token) and DELETE (remove the API key) wait on a busy lock at the same time. The result keeps the new token, removes the key, and keeps an unrelated `model` setting. **F2: a cancelled login can no longer save credentials** - The writer takes an optional cancellation signal. It checks it before waiting for the lock, and again inside the lock just before writing. - That signal is the one cancel and timeout already abort. It now reaches the writer through the session manager, `collectRemoteLoginFiles` and `storeReturnedLoginFiles`. Collection also checks it between file reads. - For OpenCode, which writes to two stores, the check runs under each store's lock. - After collection, `runRemoteLoginSession` checks whether the session has already ended. If so, it reports neither "Saved…" nor "Could not save…" and leaves the cancelled or timed-out status as it is. - **Tests:** - A login is cancelled while its collection waits on a busy lock: nothing is written, the status stays cancelled, and the runtime is closed once. - Collection with an already-aborted signal stores nothing. - A write aborted while waiting for the lock publishes nothing. **F3: Antigravity's stored login is now checked** - `remoteCredentialProblem` no longer depends on whether a provider supports pasted credentials. It checks the provider's login files from the credential manifest, plus pasted credentials where those are supported. - An Antigravity agent without `antigravity-cli/antigravity-oauth-token` now reports `auth_required`, with a login-only message, since it has no paste option. - **Test:** the missing-login case, then the ready case once the file is stored. **F4: Fly readiness now resolves the image** - New `fly/imageResolution.ts`. Images on `registry.fly.io` are resolved with the Fly token (through the existing `FlyRegistry`), down to the linux/amd64 manifest. - Images on other registries are resolved anonymously, the same way Fly would pull them without credentials. The Fly token is never sent outside `registry.fly.io`. - `flyReadiness` calls this after the Machines list succeeds. A failure returns not-ready, which shows on the card as `runtime_unavailable`. A 404 says the image doesn't resolve, and a 401 or 403 says access was refused. - **Tests:** - Image resolution is required before Ready. - A 404 or 403 makes the agent not ready. - Image references parse correctly. - A fake registry checks the Fly-token path and the anonymous path, including that the Fly token never reaches another registry. **Not fixed: unavoidable timing gaps.** - A cancel that arrives after the in-lock check has passed can't stop a write that is already happening. - For OpenCode's two stores, a cancel between the two writes can leave the first store written. These come down to the filesystem having no atomic cross-store write, not stale state. There's no visual change, so I didn't capture previews. PR: #3865 Comment by: @integry (ID: 7232932164) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * fix: protect settings.json on read failure; clear key on login I fixed F5 and F6. All 19 tests in `packages/api/test/agentRemoteCredentials.test.ts` pass, including 3 new ones, and so do the 17 in `test/remoteAgentLogin.test.ts`. Core and API typecheck clean and lint shows zero warnings. All 3 new tests fail when run against the previous `agentCredentialStore.ts`. **F5: a failed read no longer wipes existing settings** - Saving or removing a pasted credential now uses a strict reader (`strictRead` in `packages/api/services/agentCredentialStore.ts`), still under the store lock. A missing file still counts as empty. Any other read failure, such as an oversized `settings.json`, now stops the request with a 400: "The existing settings.json could not be read, so it was left unchanged". Before, the failure was treated as an empty file and the settings were overwritten. - The tolerant reader is now used only for status reporting (`readAgentCredentialStatus` and `remoteCredentialProblem`). - New test: with an oversized `settings.json`, both a save and a remove are refused, the file is byte-for-byte unchanged, and the status still reads. **F6: interactive login now replaces a pasted key or token** - A new core helper, `withoutPastedClaudeAuthentication` in `pastedCredentials.ts` (exported from `@propr/core`), takes `ANTHROPIC_API_KEY` and `CLAUDE_CODE_OAUTH_TOKEN` out of `settings.json` and keeps everything else. - When `storeReturnedLoginFiles` saves a Claude login, it rewrites `settings.json` in the same locked write as `.credentials.json`. The new login and the removal of the old key land together, and the existing cancellation check before publishing still covers both. - If `settings.json` can't be read, nothing is saved and the login reports "Could not save the login". Otherwise the old key could still override the new login. - New tests: - Switching from a pasted key to an interactive login removes the key and keeps the other settings (`model`, other env vars). The status then shows no pasted credential, only the stored login. - When `settings.json` can't be read, the login stores no `.credentials.json` and leaves `settings.json` unchanged. Codex and OpenCode don't have this problem, because their login file (`auth.json`) is the same file the pasted credential lives in, so a login replaces it. **Not fixed: the same F6 conflict exists for Docker logins.** On a Docker instance, the CLI writes `.credentials.json` straight into the bound config directory, and the session is marked successful when the container exits. Nothing removes a previously pasted key from `settings.json`, so it can still override the new login. That code path wasn't part of the requested fix. Fixing it would mean adding a locked settings cleanup to the Docker success handler in `agentLoginSessionManager.ts`. I made no previews because nothing in the UI changes. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * test: wait for logger startup before faking timers in sprites test Shard 4 failed because one test file, `test/spritesLeaseProvisioning.test.ts`, hung after it had already passed. It ran all four of its subtests in under a second, then never exited, and the runner killed it at the 180s limit. This PR's code didn't cause it: the file is unchanged on this branch, and the hang is a known flake in how the test sets up its fake clock. **Cause:** the test swaps in a fake `setTimeout` clock. The logger's background thread sometimes finishes starting while that fake clock is active. A timer it sets during startup lands on the fake clock and is thrown away when the test cleans up. The thread then stays open and keeps the process alive. It's timing-dependent, so it happens more often on a busy CI host. **Fix:** the test now waits for the logger to finish starting before it turns on the fake clock. This is a copy of the fix in the still-open PR #3868, which hit the same flake. Because the change is byte-for-byte the same, the two branches will merge cleanly whichever lands first. Only `test/spritesLeaseProvisioning.test.ts` changed, with 9 lines added and 1 changed. **Verification:** the file passed 10 out of 10 times through `scripts/run-test-suite.mjs`, with all 10 running in parallel to add load. I can't fully confirm the fix locally, because before the change the file also passed when run alone, so the real test is the next CI run. There's no visual change, so I didn't make any previews. PR: #3865 Comment by: @propr-dev[bot] (ID: 7235221214) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: keep other Codex credential on remove; wait for Fly capacity I fixed F7 and F8 and added regression tests for both. I couldn't do F9: it needs live runs on a Fly-launched instance, which this container can't reach. Both touched test suites pass (20/20 each), and typecheck and zero-warning lint are clean for the changed core files. ### F7 — Removing one Codex kind no longer deletes the other In `packages/core/src/agents/credentials/pastedCredentials.ts`, both Codex kinds still go through `removePastedCredential`. That runs on the current `auth.json`, read under the store lock. It now checks which kind the file actually holds: - **Kind not in the file** (a newer save replaced it): nothing changes, so a stale Remove keeps the replacement. - **Only that kind in the file:** the file is deleted, as before. - **File holds both** (key and ChatGPT tokens): only the removed one goes. This also protects a ChatGPT `auth.json` written by an interactive Codex login, which lands in the same file. Claude kinds already removed only their own variable, and OpenCode has a single kind, so neither had this bug. **Tests:** a unit test in `test/remoteAgentLogin.test.ts` covers both directions, a missing file and the file holding both. An API-level test in `packages/api/test/agentRemoteCredentials.test.ts` saves a key, replaces it with a ChatGPT `auth.json`, removes the old key, and checks the login survives and the agent still counts as having credentials. ### F8 — Fly login now waits for real capacity In `packages/core/src/agents/runtime/fly/flyLogin.ts`, the one-shot check that failed immediately is replaced by a wait: - It rechecks Fly's live Machine count every 2 seconds. - It shares one 30-second deadline with the in-process slot wait, so the total wait still can't exceed 30 seconds. - The terminal shows "All N Fly Machines are in use; waiting up to 30s…". - When the deadline passes, the error names `PROPR_FLY_MACHINES_MAX` and the wait time. - If the user cancels during the wait, the login is cancelled rather than reported as a capacity error. The Sprites login already retries against its pool inventory until the same 30-second limit, so it needed no change. **Tests:** the old "full capacity" test expected an immediate failure; it now checks that the login waits the full period and rechecks. Two new tests cover a Machine freed by another process during the wait (the login then starts) and cancelling during the wait. There is still a short window between a capacity check showing a free Machine and the create call, where another process can take it. That race between separate processes and Fly's API can't be closed. When Fly refuses the create at its organisation limit, the login still fails with the existing capacity message. ### F9 — Live acceptance runs: still to do These runs still have to happen before merge, on a Fly-launched instance running this branch: - An `AI` issue taken to a PR with a pasted key, on both Sprites and Fly Machines. - An interactive Claude login on Sprites, followed by a run. - An agent card showing healthy. No run links or healthy-card evidence exist yet, and the existing tests run against mocked Fly and Sprites APIs, so they don't stand in for these runs. No visual previews were captured, since neither fix changes what's on screen. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: merge Slot type export to fit spritesProvisioning line limit I fixed the Validate Changes failure. The only problem was the Core Package Lint file-length limit: the merge from #3853 left `packages/core/src/agents/runtime/sprites/spritesProvisioning.ts` at 401 code lines, one over the 400 maximum. **Fix:** I moved the separate `export type { Slot };` line into the existing export, which is now `export { startupStep, SpritePoolCapacityError, type Slot };`. No behaviour changes. **Checks:** `npm run lint` in `packages/core` now passes with no warnings, and `tsc --noEmit` for core is clean. **Separate failure on this commit:** the full test suite comment also reports `test/spritesLeaseProvisioning.test.ts` hitting the 180s timeout in shard 4. You didn't ask me to fix that and I made no change for it. When I ran that file on its own here, all 4 tests passed in about 2s, so it doesn't fail on its own in this container. If it shows up again in CI, it should be looked at separately. PR: #3865 Comment by: @propr-dev[bot] (ID: 7236051545) Comment by: @github-actions[bot] (ID: 7236051747) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: accept OpenCode and Vibe in Sprites and Fly health checks I fixed F10: the Sprites health check now accepts OpenCode and Vibe agents. It no longer reports "Agent runtime unavailable" for providers Sprites actually runs. **What was wrong:** the health check kept its own list of the providers Sprites runs (Claude, Codex, Antigravity). `SpritesRuntime` uses a longer list that also has Vibe and OpenCode. Because the check rejected those two before looking at the token or the CLI version, a valid setup could never pass. **The fix:** - **One shared list:** the Sprites provider list now lives in one exported constant, `SPRITES_AGENT_TYPES` in `packages/core/src/agents/runtime/sprites/spritesCliVersions.ts`. Runs, interactive logins and the health check all use it, so they can't drift apart again. OpenCode and Vibe now go through the same pinned CLI version check as the others. - **Same bug on Fly Machines:** while checking related code I found the Fly Machines health check had the same problem. It hardcoded Claude and Codex, but the Fly runtime also runs Vibe and OpenCode. It now uses the same rule the Fly runtime uses (`isRemoteAgentType`), so Vibe and OpenCode agents there no longer show as unavailable either. **New tests** in `test/remoteAgentLogin.test.ts`: - **OpenCode and Vibe on Sprites:** each is ready on its pinned CLI version and reports that version. A missing token or a non-pinned CLI version is still refused. - **Matching the runtimes:** for every provider, Sprites and Fly Machines readiness must agree with what each runtime itself accepts. Antigravity is still refused on Fly. **Verification:** - The new tests failed on the old code and pass now (22 of 22 in the file). - `test/spritesRuntime.test.ts` and `test/spritesPool.test.ts` still pass (77 of 77). - The core typecheck and zero-warning lint on the changed files are clean. There's no visible UI change, so I didn't make previews. **Found but not changed (outside F10):** the interactive login on Fly Machines still only accepts Claude and Codex (`flyMachinesRuntime.ts:62`). That limit matches the PR description, so I left it alone. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: recognize Vibe and OpenCode credentials in remote health check F11 is fixed. The remote health check now recognizes the credentials Vibe and OpenCode runs actually use, so an agent set up that way shows **Ready** instead of `auth_required`. The new and updated tests pass, typecheck and lint (zero warnings) are clean, and none of this was run on a live Sprites or Fly instance. **What the check now counts as a credential** - **Vibe:** - A `.env` file in its config directory with a non-empty `MISTRAL_API_KEY`. This is read through the provider manifest, the same way the broker extracts it for a run. - `MISTRAL_API_KEY` in the agent's env vars, in ProPR's own environment, or in the Mistral key setting. If settings can't be read, they add no key, as at run time. - The config directory is found the way a Vibe run finds it: `VIBE_CONFIG_PATH` first, then the saved path. Paths the login resolver refuses, such as a custom `~/…` path, no longer cause a false failure. - **OpenCode:** - A provider with a non-empty `options.apiKey` in `opencode.json`, `opencode.jsonc` (comments and trailing commas allowed) or `config.json`. - A provider key variable (`*_API_KEY` or `*_TOKEN`) among the agent env vars that ProPR passes to the run. GitHub tokens are not counted. **One addition beyond the two named sources:** an OpenCode agent that offers one of the built-in free models now passes the check with no credential at all. The docs say these models need no login, and the Docker health check already reports such an agent as ready. Without this, the remote check would still have reported it as `auth_required`. **Code changes** - The file checks are in a new core module, `packages/core/src/agents/credentials/configuredCredentials.ts`. - `remoteCredentialProblem` in `packages/api/services/agentCredentialStore.ts` is now async, because it may read settings. `agentHealthCheck.ts` awaits it. - The health-check sentence in `docs/docs/features/agents-and-models.md` now lists these sources. **Tests:** I added `packages/api/test/agentRemoteCredentialSources.test.ts` with 8 cases. They cover each source above, blank keys still failing, `VIBE_CONFIG_PATH`, the refused `~/…` path, and a full health check returning **Ready** for Vibe with only `.env` and OpenCode with only its config-file key. All 8 fail when run against the previous code. These tests, the existing credential and health-check suites, the OpenCode discovery route test and the redaction test all pass: 132 tests in total. There are no visual changes, so I made no previews. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: keep operator credential changes from active runs on write-back I fixed both findings, and each new regression test fails without its fix and passes with it. **F12: active runs can restore removed credentials** - Every write through the store writer (paste, Remove, and the files from an interactive login) now records which paths it changed, under the store lock and before the files are published. The record is a small file in the store, `.propr-operator-mutations.json` (new `packages/core/src/agents/credentials/operatorMutations.ts`). It is published the same way as the credentials, so a writer whose lock was taken over can't roll it back. - The broker reads that record before it copies the store for a run. At write-back, under the lock, a path changed since the run was staged gets the new outcome `kept-operator-change`. The run's copy then can't overwrite a replacement, even with a later refresh time, and can't recreate a removed file. - What stays the same: - A run whose copy still matches the current file writes back as before (`written`). - Between runs racing each other, the most recent refresh still wins. - A change to a different file in the store doesn't block the run. - If the record can't be read, every path counts as changed, so the check fails closed. The next change replaces the bad record. - The Docker, Sprites and Fly runs all go through this broker, so all three are covered. - Tests: - `test/agentCredentialBroker.test.ts` covers: Codex remove, Codex account replacement with a later refresh time, OpenCode remove, runs staged after a change, the unchanged-copy case, and an unreadable record. - `packages/api/test/agentCredentialOperatorMutations.test.ts` runs the real paste and Remove functions against a run staged earlier. **F13: Fly rejects supported OpenCode logins** - `FlyMachinesRuntime.startLogin` now uses `flyLoginSupported`: an agent type Fly Machines runs that also has an interactive login. That gives Claude, Codex and OpenCode, and replaces the hard-coded `['claude', 'codex']` list. - Antigravity is still refused before any Machine is created. - Tests: - `test/remoteAgentLogin.test.ts` checks that the Machine runs `opencode auth login` and creates both the config and data directories. - The new API test runs a full login session through a real `FlyMachinesRuntime` with a fake Machines API. It checks that the session succeeds, the Machine is destroyed, and OpenCode's `auth.json` ends up in the agent's data store. **Docs:** one sentence in `agents-and-models.md` saying Remove, replace and a new login also hold for runs already in progress. **Checks run:** - The root credential, Fly, Sprites, redaction and remote-login suites pass. - The API agent login, credential and health-check suites pass: 78 pass, 0 fail, after rebuilding shared and core. - Core and API typecheck are clean, and lint shows zero warnings on the changed files. **Not covered (separate, existing behaviour):** runs that mount the store directly rather than through the broker write to the real file themselves, so this check can't stop them. That happens with `PROPR_AGENT_CREDENTIAL_BROKER=legacy`, or by default when the worker can't write the store. I left that alone. The change has nothing visible in the UI, so I made no previews. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: fence stale runs and clear pasted Claude key on Docker login I fixed both findings. Each new regression test fails on the old code and passes now. Lint (zero warnings), the core and API typechecks, the 187 tests in the credential and login suites, and 87 Sprites/Fly runtime tests all pass. **F14: run staged during an operator change overwrites the replacement** - **Change:** the mutation record is now published in two steps, both under the store lock. The new tokens go out with the paths marked "pending" before any file is published. The mark is cleared once the writer stops publishing, whether it succeeded or failed. A run that stages while a path is pending always counts as staged before that change. So if its copy no longer matches the store, its refreshed token is kept out rather than winning on recency. Runs stay lock-free and synchronous, so a read-only store still stages. The changes are in `operatorMutations.ts`, `credentialStoreWriter.ts` and a comment in `broker.ts`. - **Crash case:** if a writer dies mid-publication, its mark stays. Runs on that path then lose the recency rule until its next operator change completes. That keeps the operator's change, at the cost of the old run-vs-run behaviour for that path. - **Tests:** two new cases in `test/agentCredentialBroker.test.ts`: - A run is staged in the exact window from the finding: new record, old `auth.json`. The replacement is kept, and a run staged afterwards writes back normally. - A mark left by a dead writer keeps fencing until the path's next change clears it, and then recency between runs works again. - **Old code:** run with only a test hook added, it returns `written-newer`, meaning the old account overwrote the replacement. **F15: pasted Claude key survives a Docker login** - **Change:** when a Docker login container exits 0 for Claude, the session runs the same locked `settings.json` cleanup as the remote login before reporting success. Other settings are kept. - A failed login leaves the pasted key in place. - So does a login cancelled or timed out while the cleanup waits for the lock. - If the cleanup fails, the login is reported as failed ("Could not save the login: …"). - Other agent types still finish immediately, as before. - **Tests:** three cases in `packages/api/test/agentCredentialOperatorMutations.test.ts`: success, failure, and cancel while waiting for the lock. On the old code, the pasted key survived the successful login. - **Line limit:** `agentLoginSessionManager.ts` was already at 397 of the 400-line limit. I moved two Docker helpers (image pull and orphan sweep) unchanged into `agentLoginDocker.ts`. - **Docs:** I added one sentence to `agents-and-models.md`: a successful Claude login removes a pasted key or token on every runtime, and a failed or cancelled login leaves it. One race can't be avoided: a cancel that arrives just after the cleanup published reports "cancelled" even though the key was removed. The remote login has the same race. **Two related problems I found but didn't fix (outside F14/F15):** 1. **A Docker login isn't recorded as an operator change.** The container writes the login files straight into the store, and no mutation token is recorded for them. A run staged before a Docker login can still overwrite the new login with its newer refresh. After this fix only `settings.json` gets a token. Remote logins go through the writer and are covered. 2. **Removal isn't fenced by the lock.** When the writer deletes a file, it calls `fs.rmSync` directly instead of going through the lock's publication directory. A writer whose lock was taken over as stale can therefore still delete a file afterwards, including the next writer's replacement. File contents and the mutation record are fenced; removals are not. The changes are server-side only, so there are no visual previews. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: redact OpenCode secrets and lease credential removals I fixed both findings, F16 and F17, and added a regression test for each. Each new test fails against the branch's previous code and passes now. **F16: OpenCode secrets are now redacted** (`packages/core/src/utils/secretRedaction.ts`) - I added two patterns that redact the values of `key`, `refresh`, `access` and `token` inside an OpenCode `auth.json` entry. `token` holds the second secret in OpenCode's `wellknown` entries, so I included it as part of the same defect. - They only fire inside an object that also has a `"type"` field, whether `type` comes before or after the secret. Pasted documents keep the operator's field order, so both have to work. Limiting them this way stops a plain `"key"` or `"access"` field elsewhere in a log from being redacted. - **Test** (`test/redactSecrets.test.ts`): uses opaque values for `oauth`, `api` and `wellknown` entries, both compact and in the stored two-space layout. It also checks that an unrelated `key`/`access` document passes through unchanged. **F17: a removal can no longer delete a successor's credential** (`packages/core/src/agents/credentials/credentialStoreWriter.ts`) - Removal now goes through the lease, the same way replacements do. The writer creates a directory inside its publication directory, moves the file into it, then deletes it there. - After a stale takeover, that publication directory has been moved away, so the move fails with `CredentialStoreLeaseRevokedError` and the successor's file stays. A file that is already missing still counts as removed. - Removals are refused for directories, the same as the old direct delete. - **Test** (`test/agentCredentialStoreLockMultiprocess.test.ts`, new fixture `test/fixtures/credentialStoreWriterContender.ts`): a removal process records its pending mutation and is then suspended. A second process takes over the stale lock and publishes a replacement, then the first resumes. The test checks that: - the replacement survives. - the removal fails as taken over. - the pending mark is cleared. - no publication or removal directory is left behind. Against the old code, the successor's `auth.json` was deleted. - **Other deletions checked:** this was the only deletion of a canonical store file in the PR. The broker's write-back never deletes, and the other deletions in the credential staging code only remove per-run copies. - **Remaining race:** a removal that completes before the takeover revokes its lease simply happens before the successor's write, which is the correct order. There's no avoidable gap left. **Verification:** I ran the credential lock, broker, remote-login, redaction and tool-policy suites, plus the API `agentRemoteCredentials` suite after rebuilding the core package. All tests passed. Core typecheck and lint on the changed files are clean with zero warnings. No visual previews: nothing here changes what users see. **Found separately, not changed:** - If the lease is revoked between preparing a replacement file and renaming it into place, the writer's replacement path throws a raw `ENOENT` rather than `CredentialStoreLeaseRevokedError`. Nothing in the store changes; only the error type is inconsistent with the broker, which converts it. - When a log entry is redacted as an object rather than as text, only the string values are checked, so no rule that relies on field names applies, including the existing Claude/Codex one. This predates the PR. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * fix: fix lint limits in agent config modal and login session manager I fixed both lint failures that broke Validate Changes. `eslint . --max-warnings 0` now passes in both `propr-ui` and `packages/api`. **UI: complexity 22, limit 20 (`AgentConfigModal.tsx`)** - I moved two conditions out of the component into helpers in `agentCredentialSetupUtils.ts`: - `showsPastedCredentials(type, isEditing, credentialSetup)` decides when the "Paste a key or token" section shows. The form section and the submit path now both use it. - `storedCredentialAgentId(agent, type)` returns the saved agent's id only while its type hasn't changed. - Defining the helpers inside the modal file pushed it to 403 lines, over the 400-line limit, which is why they're in the utils file. **API: 404 lines, limit 400 (`agentLoginSessionManager.ts`)** - In `write()`, the remote and local branches each repeated the same input check, timestamp update and timeout reset. I merged them into one path that writes to the remote runtime or to the container's stdin. - Behaviour is unchanged: the same errors are thrown in the same order for both kinds of login. **Checks** - The UI typecheck is clean. - The 44 SettingsPage UI test files pass (425 tests). - The 4 API test files that exercise the login session manager all pass: `agentLoginRoutes`, `agentLoginPi`, `agentRemoteCredentials` and `agentCredentialOperatorMutations`. I ran them through the repo's test runner after rebuilding `shared` and `core`. This is a code-only change with nothing visible, so there are no previews. PR: #3865 Comment by: @propr-dev[bot] (ID: 7246900062) Comment by: @github-actions[bot] (ID: 7246900152) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * test: cover Pi as Docker-only agent in starts-as-root test I fixed the shard 4 failure, and the test now passes locally (10/10 subtests). **Cause:** in run 46198702192 the only failing file was `test/agentRunSpecStartsAsRoot.test.ts`. That test was added in #3853 and has to cover every agent type. The `pi` agent type, added in #3847, landed on this branch through the epic merges, and nobody added a `pi` case to the test. So two subtests failed: - "every agent type has a task spec case" failed because the list had no `pi`. - "pi: the task spec starts as root…" crashed because the `pi` case didn't exist. **Fix (test only, in `test/agentRunSpecStartsAsRoot.test.ts`):** Pi doesn't build a run spec at all. It starts its own `docker run --user 0:0`, so it can't run on Fly Machines or Sprites and the remote-runtime "starts as root" check doesn't apply to it. I split Pi out as a Docker-only agent type: - The existing run-spec checks now cover every type except `pi`. - Pi gets its own case that builds its real task Docker arguments and checks that they start as root. - The coverage check still requires every agent type to appear in one list or the other, so a new agent type fails until someone adds a case for it. The earlier comment about `test/spritesLeaseProvisioning.test.ts` timing out at 180s came from an older run. In this run it didn't fail, and it passes locally in about 4s. I made no change for it; if it shows up again, it's most likely runner contention rather than code. This is a test-only change with nothing to see on screen, so there are no previews. PR: #3865 Comment by: @propr-dev[bot] (ID: 7247259883) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: reject OpenCode auth.json pastes without a credential F18 is fixed: an OpenCode `auth.json` with no actual credential in it is now refused, the working file stays in place, and the agent is no longer reported as having credentials or shown as Ready. **What changed** (`packages/core/src/agents/credentials/pastedCredentials.ts`) - **Validation before replacing the file:** each provider entry must be one of the three types `opencode auth login` writes, and must hold a non-empty credential: - `api` needs `key`. - `oauth` needs `refresh` or `access`. - `wellknown` needs `key` or `token`. - Any other type is refused, and so is an entry whose credential fields are missing or only spaces. If one entry is bad, the whole document is refused. The error goes back to the operator as a 400, so `rewrite` never replaces the existing `auth.json`. - **Status reporting:** the status check now uses the same per-entry test. A file with provider entries but no usable credential reports "not set", where before it reported "set". Because the health check reads that status, `remoteCredentialProblem` now returns "No credentials are stored…" instead of Ready. **Sibling paths checked** - The Codex `auth.json` check already required a key or login tokens. - The OpenCode login-file check skips the pasted `auth.json`, so the status fix covers it. - An OpenCode `auth.json` collected after an interactive remote login is still stored without this check. It now reports "not set" if it has no credential. One test fixture for that path stored `{"a":{"type":"api"}}`, so I added a key to it. **Regressions added** - `packages/api/test/agentRemoteCredentials.test.ts`: saves a working OpenCode login, then tries six credential-free or unsupported pastes. Each is refused, and the file is byte-for-byte unchanged afterwards, still with no credential problem. A credential-free file written straight into the store reports "not set" and fails the health check. - `test/remoteAgentLogin.test.ts`: checks the refusal messages for each type, and that valid `api`, `oauth` and `wellknown` documents are kept as-is. **Verification:** 61 tests pass across the touched credential suites, plus the related broker, operator-mutation and credential-source suites. The broker suite has to go through `scripts/run-test-suite.mjs` because it needs module mocks. The `tsc` typecheck is clean for core and api, and lint shows zero warnings on the changed files. I made no visual previews because nothing on screen changed. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: recheck agent health after removing a stored credential F19 is fixed: removing a stored credential in the agent dialog now reruns that agent's health check. A card that showed **Ready** updates to the new result instead of keeping the old cached one. **What changed** - `AgentPastedCredentials.tsx`: a new optional `onStoredCredentialRemoved(agentId)` callback is called after `clearAgentCredential` succeeds. If the delete fails, the error shows as before and no recheck is requested. - `AgentConfigModal.tsx`: passes that callback through. I put the props destructuring on fewer lines because the file had gone over the 400-line lint limit. - `AgentsListSection.tsx`: connects the callback to the existing `recheck`, the same path used after saving a pasted credential and after closing the login dialog. **Regression test** in `AgentsListSection.test.tsx`: a Codex agent whose only credential is a stored OpenAI key starts as **Ready**. The test opens Edit, clicks **Remove** and closes the dialog with Cancel. It then checks for a fresh health request with the force flag, the "No credential stored" alert, and that **Ready** is gone. With the connection removed, the test fails. **Other places checked** - `AgentPastedCredentials` is the only place in the UI that deletes a credential. - `AgentsListSection` is the only place that renders `AgentConfigModal`. - Saving a credential and closing the login dialog already rechecked health. Removing a credential and then saving the agent rechecks once on removal. If the save changes the agent's configuration, the existing revision logic can start one more check. **Verification:** all 426 tests in `propr-ui/src/pages/SettingsPage/` pass. `tsc --noEmit` and ESLint with zero warnings allowed are clean for that directory. I didn't make a visual preview: the card just shows the existing health-error state, with no new UI. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * refactor: extract Mistral API key field from AgentConfigModal I fixed the UI lint failure that broke Validate Changes. `AgentConfigModal.tsx` was at 410 code lines, over the 400-line limit. I moved the Vibe agent's Mistral API key field, including its show/hide toggle and the "Get your API key from Mistral AI" link, into its own component, `propr-ui/src/pages/SettingsPage/MistralApiKeyField.tsx`. The markup is the same as before. The modal now just renders that component when the agent type is `vibe`, and the file is well under the limit. The full `propr-ui` lint (`eslint . --max-warnings 0`) and the typecheck now pass. The three agent dialog test files also pass (26 tests). I didn't take previews, since nothing on screen changes. PR: #3865 Comment by: @github-actions[bot] (ID: 7248908297) Comment by: @propr-dev[bot] (ID: 7248908799) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: request full Claude sign-in link in agent login terminal The URL was not being mangled by ProPR. The Claude CLI itself prints that short link, and the login now asks it for the full one. The live end-to-end Sprites login (item 3) is still not done: I have no access to a Fly instance from here, so it needs to be repeated on a Docker-less instance. **Cause.** I recorded `claude auth login` (Claude Code 2.1.330) in a 120×40 PTY with the same environment the remote logins use. The CLI prints `https://claude.ai/oauth/authorize?z-…` with 45 characters after the `?`, both in the visible text and in the OSC 8 link target. Piped with no TTY it prints the same thing, and there are no redraws. Since 2.1 the CLI compacts the sign-in link on purpose: the 45 characters are 2 scope characters plus the 43-character `code_challenge`, and `client_id`, `redirect_uri` and `state` are dropped. An environment variable in the CLI, `CLAUDE_CODE_FULL_SIGN_IN_LINK`, turns this off. I couldn't check whether claude.ai accepts the compact link, because curl gets a Cloudflare 403. **Fixes** - **Full link:** the Claude login now sets `CLAUDE_CODE_FULL_SIGN_IN_LINK=1`. In the recording, the CLI then prints the full `https://claude.com/cai/oauth/authorize?code=true&client_id=…&redirect_uri=…&code_challenge=…&state=…` on one line. The setting reaches Sprites, Fly Machines and local Docker (Docker passes it with `-e`, and the entrypoint keeps it). Local Docker logins were getting the compact link too, since that container is also started with `-t`. - **Wider terminal:** the login terminal is now 1000 columns on both remote runtimes. Sprites spawns with `cols: 1000`. On Fly, `script` can't take a size from its input pipe, so it runs `stty cols 1000 rows 40` before starting the CLI. I didn't use `TERM=dumb` or `NO_COLOR`: neither was needed, and they could change how the CLIs' paste prompts behave. - **OSC 8 links in `sanitizeTerminalChunk`:** it now keeps the target of an OSC 8 hyperlink. If the visible label doesn't match the target (ignoring line breaks and spaces), the target is written out as plain text after it. Other control strings stay hidden. Targets that aren't a single scheme-and-text URI are dropped, and anything over 8 KB isn't tracked. - **"Not signed in" badge:** an `auth_required` error whose message says no credentials are stored (or "not logged in / not signed in") now shows **Not signed in**. An expired login still shows **Authentication expired**. **Tests.** The new `packages/api/test/agentLoginTerminal.test.ts` uses the recorded transcripts, saved in `packages/api/test/fixtures/agentLoginTranscripts/`. It feeds them in at several chunk sizes so escape sequences fall across chunk boundaries. - The Claude transcript keeps the full URL with `client_id`, `redirect_uri`, `code_challenge` and `state`, and no control characters are left. - The real recording has no redraws, so one test builds them from it: the label is wrapped at 120 columns, cleared and rewritten with cursor moves, and partly overwritten. The full URL still comes through from the link target. That test and the label-differs-from-target test fail with the old sanitizer. - The Codex device-login transcript keeps `https://auth.openai.com/codex/device` and the one-time code. - The compact-link transcript is kept as a test, showing the short URL comes from the CLI and not the sanitizer. - The existing Sprites and Fly login tests now also check the 1000-column terminal. The touched server suites (70 tests), the agent default-path tests and the UI card tests (19, including a new "Not signed in" case) all pass. Typecheck and zero-warning lint are clean. I captured a preview of the badge with a mocked API: one card that was never signed in next to one whose login expired. PR: #3865 Comment by: @integry (ID: 7258599907) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: agent credentials on Docker-less instances: paste credentials +… I fixed F20: when a login CLI wraps a hyperlink's label across rows, the browser now gets the complete sign-in URL as one unbroken piece of text. **The fix** (`packages/api/services/agentLoginTerminal.ts`): the old check stripped all whitespace from the label and compared it to the link's target. A label wrapped across rows passed that check, so the full URL was never written out and the dialog only made the first row clickable. A new helper, `labelShowsTarget`, now skips writing the URL out only when the label contains it unbroken and followed by whitespace or the end of the label. That boundary check matches how `AgentLoginModal` finds URLs, so a label like `https://…/a.` also gets the clean URL written after it. **Tests** (`packages/api/test/agentLoginTerminal.test.ts`), two new cases: - **Wrapped label:** uses the recorded Claude authorize URL with its label split into 120-column rows and nothing else changed. Fed in chunks of 1, 2, 7, 119, 120, 121 and 4096 characters, the output shows the wrapped label and then the full URL in one piece, with every OAuth parameter checked. - **URL plus trailing text:** a label where the URL runs into trailing punctuation gets the URL written out again. A label that shows the URL followed by a space does not. All 8 sanitizer tests pass. Both new tests fail when run against the previous version of the file. ESLint reports zero warnings on both files, and `tsc` reports no errors in them. The existing check that an unwrapped label isn't repeated still passes. No other code changed in this PR does the same comparison: the sanitizer has a single caller, and the only other OSC 8 matches are the test transcripts. I didn't make a visual preview because the change only affects the text sent to the login dialog. PR: #3865 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 --------- Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>

AI Implementation Summary
Closes #3867
Branch:
3867/claude-opus-5-5-dashboard-sign-in-via-git-20261127-2345-km7Commits: ✅ Changes committed (c785e48)
AI Processing Completed
Execution Details:
Summary:
Relay-only instances can now sign browsers in on any host using GitHub's device flow, with no OAuth App, tunnel or callback URL. All tests pass with GitHub mocked. Nothing has been tried live, because Device Flow isn't enabled on the
propr-devApp yet; until it is, sign-in shows "Device sign-in isn't enabled for this GitHub App".How the mode is chosen
resolveBrowserAuthModereturns the newdevicemode where it used to returndisabled. This applies to an instance using the hosted relay that has neither its own OAuth client nor a loopback Connect callback.deviceonly whenPROPR_GH_DEVICE_CLIENT_IDis set. Without it, the shared App's client ID wouldn't match that relay's App, so it staysdisabled.PROPR_WEB_AUTH_MODE=deviceselects it explicitly. The other modes keep their order, and the ui.gitfix.dev-stylegithubmode is unchanged.Iv23liTCmmSNYyD0NtZA) ships as a default next toDEFAULT_PROPR_GH_RELAY_URL.Sign-in flow
interval, adding to it onslow_down, and stopping atexpires_in.GET /user, the user must have access to the relay's installation viaGET /user/installations. WithGH_INSTALLATION_IDset, the IDs must match. Without it, the relay installation's account is read using a relay installation token, and anything that can't be determined is refused. Connect's own check isn't in this repo, so this is my best reading of "equivalent to Connect's"; please confirm it.device_flow_disabled,access_denied, expired codes, no installation access and not whitelisted. Tests check that tokens and device codes never appear in logs or responses.Tokens: one assumption to check. Device-flow tokens are stored exactly like Connect sign-ins, including encryption at rest. Renewal therefore goes through the relay's
/auth/instance-grants/refresh, which holds the App's secret. This only works if the relay renews refresh tokens it didn't issue through Connect. If it doesn't, users will have to sign in again when the 8-hour GitHub App token expires.Login page: in device mode it shows the code with a Copy button, a link to
github.com/login/device, a waiting state, Cancel, and errors with "Try again". The app has no dark theme, so I addeddark:styles that follow the OS colour scheme to the login page and device panel. I captured preview screenshots of light, dark and two error states.propr deploy fly: a relay-only deploy is now accepted as device sign-in (Sign-in: GitHub device sign-in at https://<app>.fly.dev …). With an existing relay token, the deploy also pinsPROPR_GH_RELAY_URL, because the API needs it.Not done:
runGitHubDeviceFlowhelper is in@propr/sharedfor that.Tests and docs:
test:unit.github-auth.md(when it's used, the flow, tokens, errors, and how to enable Device Flow on your own App). I also updated the Fly deploy and setup pages, the VPS tutorial, the config reference (the new variables and rate limits) andweb-ui-integration.md.The main logic is in
packages/api/deviceAuth.ts,packages/api/connectAuth.tsandpackages/shared/src/githubDeviceFlow.ts.Review digest
Risk-tiered paths
package.json(+1/−1): dependency manifestpackages/api/auth.ts(+76/−3): auth-looking pathpackages/api/connectAuth.ts(+31/−3): auth-looking pathpackages/api/deviceAuth.ts(added, +427/−0): auth-looking pathpackages/cli/src/commands/deploy/flyBrowserAuth.ts(+58/−12): auth-looking pathpropr-ui/src/pages/LoginPage.tsx(+22/−13): auth-looking pathpackages/api/openapi/directRoutes.ts(+4/−0)packages/api/requestRateLimits.ts(+14/−0)packages/cli/src/commands/deploy/flyRelay.ts(+6/−3)packages/cli/src/commands/deployFly.ts(+16/−4)packages/local-setup/src/engine.ts(+1/−0)packages/shared/src/githubDeviceFlow.ts(added, +208/−0)packages/shared/src/index.ts(+3/−0)packages/shared/src/proprServiceUrls.ts(+10/−0)propr-ui/src/api/deviceSignInApi.ts(added, +82/−0)propr-ui/src/pages/DeviceSignInPanel.tsx(added, +205/−0)propr-ui/src/pages/useDeviceSignIn.ts(added, +25/−0)docs/docs/operations/configuration-reference.md(+3/−1)docs/docs/operations/deploy-fly.md(+4/−2)docs/docs/operations/github-auth.md(+86/−0)docs/docs/operations/web-ui-integration.md(+1/−1)docs/docs/tutorials/setup-fly.md(+1/−0)docs/docs/tutorials/setup-vps.md(+7/−0)docs/static/openapi/propr-api.yaml(+66/−2)packages/api/test/connectAuth.test.ts(+40/−1)packages/api/test/deviceAuth.test.ts(added, +437/−0)packages/api/test/deviceAuthSetup.test.ts(added, +80/−0)packages/api/test/githubDeviceFlow.test.ts(added, +61/−0)packages/cli/src/commands/deploy/flyBrowserAuth.test.ts(+40/−11)propr-ui/src/pages/LoginPage.deviceSignIn.test.tsx(added, +134/−0)Diff size: 30 files changed, +2,149/−57 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3867.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
Device sign-in code (dark)
The same waiting state with the OS dark color scheme
Full-size original
Device sign-in code (light)
Login page in device mode after Sign in with GitHub: the user code with Copy, the link to github.com/login/device, and the waiting state
Full-size original
No installation access (dark, mobile)
Poll ended with installation_access_denied at 390px width in dark mode
Full-size original
Device Flow disabled error
GitHub answered device_flow_disabled: the login page explains that device sign-in isn't enabled for this GitHub App and offers Try again
Full-size original