docs(cli): device login (--device) for sandboxed agents - #118
Conversation
…-url) Companion to InsForge/CLI#198. In sandboxes like the ChatGPT app the browser cannot reach the CLI's loopback callback, so browser login hangs; the new two-step flow prints the auth URL, the user pastes back the redirect URL, and the CLI redeems it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GcszudKMZBSm5RMP14h7fu
WalkthroughThe CLI documentation now describes ChangesDevice login documentation
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Replaces the paste-back (--no-browser/--callback-url) guidance per Tony's call — device flow only: agent runs `login --device`, relays the pre-filled link + code, user clicks Authorize, CLI polls to completion; rerun resumes the same pending code after sandbox timeouts. Retrieval-tested: an agent given only this doc chose the right command, relayed the link, handled the killed-process resume, and knew no paste-back is needed. Companion to InsForge/CLI#199 + insforge-cloud-backend#733; requires the CLI release that ships --device. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GcszudKMZBSm5RMP14h7fu
jwfing
left a comment
There was a problem hiding this comment.
Summary
Docs-only change (+27/−1) adding a --device (RFC 8628) sandbox login section to references/login.md and pointing SKILL.md auth guidance at it; the documented behavior is technically accurate against the real CLI implementation, but the PR's traceability metadata points at the wrong companion PR.
Requirements context
No /docs/superpowers/ (or docs/specs/) directory exists in insforge-skills — this repo is a skills/reference-docs collection with no spec/plan files. No matching spec/plan found; I assessed against the PR description, the repo's CONTRIBUTING.md doc conventions, and — critically for a docs PR — the actual CLI implementation this documents. I cross-checked every documented fact against the companion CLI PRs (InsForge/CLI#198 and #199) at their current head commits.
Verification result — the documented facts are correct. Every concrete claim in the new section matches the real implementation in InsForge/CLI#199 (feat(login): --device login via RFC 8628 device flow):
--deviceflag →src/commands/login.ts.option('--device', …)✓- Verification URL
https://insforge.dev/auth/device?user_code=BCDF-GHJK→ matchesverification_uri_completeinauth.device.test.ts✓ - Printed prompt text ("To sign in, ask the user to open: … and confirm the code …") → matches the
process.stderr.writestring inauth.ts✓ ~/.insforge/pending-device.json→config.tsPENDING_DEVICE_FILE✓- "Codes expire after 15 minutes" →
expires_in: 900in the device-authorization fixtures ✓ - Resume-same-code on rerun with same
$HOME→getResumableDeviceLogin/auth.device.resume.test.ts✓
No hallucinated or stale API usage in the doc body. Nicely done.
Findings
Critical
(none)
Suggestion
- Functionality / traceability — wrong companion PR referenced. The description says "Companion to InsForge/CLI#198", but
#198implements the--no-browser/--callback-urlpaste-back flow (pending-login.json, 10-min TTL) — a different feature. The--deviceflow this PR documents is implemented inInsForge/CLI#199(whose body even states it is "independent of #198 (paste-back)"). Please repoint the companion reference to#199, otherwise a releaser could merge these docs when#198ships and leave the skill describing a--devicecommand the released CLI doesn't have. (PR description) - Functionality — release gating is broader than the doc implies.
references/login.md:34gates on@insforge/cli ≥ 0.2only, but#199is a draft that "depends on"InsForge/insforge-cloud-backend#733(device grant + endpoints, "merge first") andInsForge/insforge-cloud#590(dashboard approve page). Until the backend/oauth/v1/device_authorizationendpoint is deployed and the approve page exists,--devicefails fast (the CLI throws "Device login is not enabled for this OAuth client"). Suggest holding merge until#199is released, and consider adjusting the≥ 0.2placeholder (the author already flags this) to the real version. (skills/insforge-cli/references/login.md:34)
Information
- Stale auto-generated summaries in the PR body. The "Summary by cubic" and Macroscope
NOTEblock describe the older--no-browser/--callback-urltwo-step flow ("Replaces the previous paste-back flow…"), contradicting the current--devicediff. These are bot-generated and will refresh, but they make the PR confusing to a human reviewer right now. - Software engineering. Follows
CONTRIBUTING.mddoc conventions (options table row, fenced examples, section heading style); thereferences/login.mdrelative link inSKILL.md:52resolves. No lingering--no-browser/--callback-urlreferences remain in the skill. No tests apply to a docs-only change in this repo. - Security. No security-relevant changes: no secrets or PII introduced; the example
user_code(BCDF-GHJK) is a placeholder matching the CLI's test fixtures; the doc correctly notes the device_code is a bearer secret persisted at0600. - Performance. Not applicable — documentation only.
Verdict
approved (informational — no Critical findings; a human still gives the explicit GitHub approval via the approve flow). The documented behavior is accurate and well-written. The Suggestions (fix the #198→#199 companion reference; gate merge on #199 + its backend/dashboard deps) are worth resolving before this leaves draft, but none block on doc correctness. This PR is currently a draft and correctly marked "don't merge before the CLI release."
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
jwfing
left a comment
There was a problem hiding this comment.
Summary
Documents the new --device (RFC 8628) sandbox login flow in skills/insforge-cli — accurate against the shipped CLI implementation, well-scoped, and safe to merge.
Requirements context
No matching spec/plan found — insforge-skills has no docs/superpowers/ (or docs/) directory, so this was assessed against the PR intent plus the companion CLI/backend/dashboard PRs. I verified every documented claim against the merged implementation:
- CLI
InsForge/CLI#199—feat(login): --device login via RFC 8628 device flow— merged, released as@insforge/cli@0.2.0(confirmedlateston npm). - Backend
insforge-cloud-backend#733— device grant +/api/oauth/v1/device_authorization— merged. - Dashboard
insforge-cloud#590—/auth/deviceapproval page — merged.
Claim-by-claim, the doc matches the code:
--deviceflag and RFC 8628 device grant — matchessrc/lib/auth.ts(requestDeviceAuthorization/pollForDeviceTokens/performDeviceLogin).~/.insforge/pending-device.jsonresume behavior — matchessrc/lib/config.ts(PENDING_DEVICE_FILE) andgetResumableDeviceLogininauth.ts; the "resumes the SAME code, completes immediately if already approved" wording is exactly right.- "Codes expire after 15 minutes" — matches the CLI's documented 15-minute device-code lifetime (
auth.ts). - Verification URL
https://insforge.dev/auth/device?user_code=…and--jsonsuccess object — match. - "requires
@insforge/cli≥ 0.2" — satisfied;0.2.0is published aslatest.
Findings
Critical
(none) — the entire dependency stack (CLI #199, backend #733, dashboard #590) is merged and 0.2.0 is live on npm, so the PR's "don't merge before the CLI release" caveat is now resolved.
Suggestion
- Software engineering / traceability —
skills/insforge-cli/references/login.md:52: the resume note is correct, but it's the one claim most likely to drift from the CLI (the 15-minute lifetime andpending-device.jsonname are both CLI-internal). Consider phrasing it as "resumes an in-progress code (server-controlled lifetime, currently ~15 min)" so the doc doesn't need a follow-up edit if the backend tunes the TTL. Non-blocking.
Information
- Functionality / stale PR description — The PR body says "Companion to InsForge/CLI#198" and describes the two-step
--no-browser/--callback-urlpaste-back flow persisting topending-login.json. That is a different, superseded approach (CLI#198 is still open and was explicitly branched-away-from by #199). The actual diff correctly documents--devicefrom CLI#199. The doc content is right; only the PR description and its linked companion PR are stale. Worth updating the PR body to point at #199 for future traceability — no change needed to the committed docs. - Security — no security-relevant changes: no new secrets logged, no user input reaching SQL/shell, no auth checks weakened. The
--user-api-key "$INSFORGE_USER_API_KEY"example is pre-existing and unchanged. - Performance — not applicable (documentation-only change).
skills/insforge-cli/SKILL.md:52and thereferences/login.mdsections are internally consistent — the SKILL.md one-liner correctly points agents at the two-step relay ("relay the printed link + code … CLI completes by itself") and defers detail toreferences/login.md. No leftover references to the old paste-back flow anywhere in the diff.
Verdict
approved (informational — a human still gives the explicit GitHub approval via the approve flow). Zero Critical findings; the documentation is accurate against the shipped 0.2.0 CLI and the full backend/dashboard stack is deployed. The one Suggestion and the stale-body note are optional cleanups.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/insforge-cli/references/login.md`:
- Around line 42-48: Add the `text` language tag to the fenced output block in
the sign-in instructions, preserving the existing example content and
formatting.
- Line 34: Update the OAuth guidance in the sandboxed-environment section to
state that the default callback flow waits until its callback timeout, rather
than claiming it hangs forever. Preserve the recommendation to use the device
flow and its existing behavior details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5b9ca007-9191-40d3-8dc5-eb716cb1b596
📒 Files selected for processing (2)
skills/insforge-cli/SKILL.mdskills/insforge-cli/references/login.md
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…1.3.0 Live ChatGPT-app testing revealed two gaps: - Harnesses that only return output on process exit (and kill at ~45s) never show a single blocking `login --device` run's link. Teach the two-step pattern: timeout-bounded first run to capture the link, relay, rerun to resume the same pending code and complete. - Workspaces with a network-domain allowlist need api.insforge.dev added; teach agents to relay that instruction. Also addresses review comments: --json on the SKILL.md inline command, 'hangs forever' -> waits until callback timeout, language tag on the output fence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GcszudKMZBSm5RMP14h7fu
Live ChatGPT session scaffolded an app with placeholder credentials instead of logging in and creating a project first. Make the order explicit: login -> create/link -> build with real values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GcszudKMZBSm5RMP14h7fu
jwfing
left a comment
There was a problem hiding this comment.
Review — docs(cli): device login (--device) for sandboxed agents
Summary: Docs-only change adding a --device (RFC 8628 device-login) section to references/login.md and a two-step sandbox-auth pointer in SKILL.md; the documented behavior is accurate and well-crafted, verified against the merged CLI implementation.
Requirements context
No /docs/superpowers/ (or docs/specs/) directory exists in this repo — it is a skills/docs repo with no spec/plan or test suite, so this is assessed against the PR description, SKILL.md, and the actual companion CLI implementation. The PR body links InsForge/CLI#198, but that PR implements a different flow (--no-browser / --callback-url, gcloud-style paste-back). The behavior these docs describe (--device, RFC 8628, short-code + polling, "nothing to paste") is implemented by InsForge/CLI#199, which merged to main on 2026-07-16 (merge commit de015a4). I verified every documented claim against that merged code (src/commands/login.ts, src/lib/auth.ts, src/lib/config.ts).
Findings
Critical
(none) — all documented commands, flags, file paths, and behavior match the merged CLI code.
Suggestion
- Functionality — companion-PR link is stale/incorrect (
PR description). The body says "Companion to InsForge/CLI#198", but #198 is the paste-back--no-browser/--callback-urlflow, not the--devicedevice-code flow these docs describe. The docs actually match CLI#199 (merged). Please re-point the description/changelog to #199 so the linkage and any release notes are correct. (Doc content is unaffected — only the reference.) - Functionality — merge gate is already satisfied; consider updating the note (
references/login.md:34, PR body). The doc requires@insforge/cli≥ 0.2 and the body says "don't merge before the CLI release that ships the flags."v0.2.0is tagged andpackage.jsononmainis0.2.0, and #199 is merged — so the release gate is cleared. The "≥ 0.2" line is accurate; the blocking caveat in the description is now moot.
Information
- Functionality — resume is conditional, doc slightly simplifies (
references/login.md:36,60). The doc says the rerun "resumes the SAME pending code." In the implementation (auth.tsgetResumableDeviceLogin) resume only happens when the pending code has > 60s of its lifetime left and the platform/client match; a denied/expired code is cleared and the rerun mints a fresh code. The 15-minute lifetime makes the happy path dominant, so this is a fair simplification — just noting the edge case. - Software engineering — illustrative output omits a line (
references/login.md:45-51). The real non-interactive message also includes "If they already approved, this completes immediately." before "Waiting for approval…". The example is prefixed "e.g." so this is fine; optionally mirror the exact wording. - Software engineering —
plugin.jsonlost its trailing newline (.codex-plugin/plugin.json). The version bump (1.2.0 → 1.3.0) also dropped the final newline (\ No newline at end of filein the diff). Harmless, but re-adding the newline keeps the file POSIX-clean and avoids a noisy diff next time.
Security — no concerns
Verified that relaying step-1 output is safe: the verification link + user code are written to stderr (hence the doc's correct 2>&1 capture), and the only stdout in --json mode is { success: true, user } on completion — no access/refresh tokens or API keys are printed, so relaying the captured output to the user leaks no secrets. The --device flow also avoids the paste-back of a callback URL entirely. SKILL.md continues to correctly warn that InsForge keys are full-access admin keys.
Performance — not applicable
Documentation-only change.
Verdict
approved (informational — no Critical findings). Posted as a COMMENT; explicit GitHub approval remains a separate human action. Suggest addressing the companion-link fix before merge for changelog accuracy, but it is non-blocking.
Teaches agents the device-login flow for sandboxes where the browser can't reach the CLI's loopback callback (ChatGPT app, SSH, containers).
Per Tony's direction this documents only
login --device(RFC 8628) — the paste-back--no-browser/--callback-urlmechanism exists in the CLI but is deliberately not taught to agents.references/login.md: Device login section — runlogin --device --json, relay the pre-filled link + code, user clicks Authorize, CLI polls to completion; rerun resumes the same pending code after a sandbox kills the process.SKILL.md: auth guidance points agents at--devicewhen a browser exists but can't reach the CLI.Retrieval-tested: an agent given only this doc chose the right command, relayed the link properly, handled the killed-process resume, and knew the user never pastes anything back.
Merge after the CLI release that ships
--device(InsForge/CLI#199; backend InsForge/insforge-cloud-backend#733 must be deployed first). After merge: bumpversionin.codex-plugin/plugin.jsonand re-upload the plugin zip to the OpenAI portal — portal snapshots are frozen.🤖 Generated with Claude Code
https://claude.ai/code/session_01GcszudKMZBSm5RMP14h7fu