Agent Skillsyc-software/qm › interactive-login

interactive-login

GitHub

指导Agent处理AWS、GitHub等CLI的交互式登录流程。利用平台后台轮询机制,避免阻塞或沙箱销毁导致认证失败,实现跨回合持久化令牌获取。

skills-seed/interactive-login/SKILL.md yc-software/qm

Trigger Scenarios

需要执行aws sso login、gh auth login等交互式认证命令时 遇到浏览器验证URL和一次性代码的登录场景时

Install

npx skills add yc-software/qm --skill interactive-login -g -y
More Options

Non-standard path

npx skills add https://github.com/yc-software/qm/tree/main/skills-seed/interactive-login -g -y

Use without installing

npx skills use yc-software/qm@interactive-login

指定 Agent (Claude Code)

npx skills add yc-software/qm --skill interactive-login -a claude-code -g -y

安装 repo 全部 skill

npx skills add yc-software/qm --all -g -y

预览 repo 内 skill

npx skills add yc-software/qm --list

SKILL.md

Frontmatter
{
    "name": "interactive-login",
    "description": "How to complete browser\/interactive logins (aws \/ gh \/ glab \/ gcloud). The platform backgrounds the login poller so it survives the human's browser round-trip — and when that does NOT work."
}

Interactive login (and what backgrounding can and can't do)

Some logins are interactive: the CLI prints a verification URL + one-time code, then polls the provider until the human approves in a browser, and only then writes the token to $HOME. Run that as a plain blocking execute and it either hangs your whole turn waiting for a human, or — worse — the turn's sandbox is torn down at turn end and the poller dies before the human finishes, so nothing is ever saved. The next turn starts over and loops forever.

You usually don't have to manage any of this. Just run the native login command.

aws sso login --use-device-code

AWS (and CLIs that log in through AWS SSO): always pass --use-device-code (aws sso login ≥ CLI v2 2.22). The bare form uses a PKCE flow that redirects to 127.0.0.1 and only completes if the approving browser is on the same machine as the CLI. Since the user approves on their computer, that flow can never finish on the agent computer; --use-device-code forces the device-grant (URL + code, completed by server-side polling) that works cross-device.

On the resident, per-scope agent computer (the production substrate), the platform recognizes these as interactive logins and runs each as a durable process session (ADR 0002): it returns the verification URL + code to you immediately instead of blocking, and keeps polling the provider on the agent computer across turns. (This recognition is wired only where the backend supports process sessions — on a per-turn local/docker sandbox nothing intercepts the command and it just blocks; see "When it will NOT work".) When the human approves, the poller writes the token into the durable $HOME and exits. Give the user the URL + code, tell them to approve, then on a later turn re-run the same command (or any command for that tool) — if approval landed, the platform reports you're already authenticated; if not, you get the same URL

  • code back. Each pending login self-expires (~10–15 min); if it lapses, just run the login again.

So the right pattern is: run the native login, hand over the URL + code, continue, and re-check later. You do not poll in a loop, you do not hold the turn open, and you do not hand-roll the exchange yourself.

When backgrounding works

  • The agent computer is a resident, per-scope machine (the production substrate — SANDBOX=fly): it has durable process sessions and a durable $HOME, so a login started in one turn is still polling in the next and the token persists.
  • The command is one of the recognized native flows: aws sso login, gh auth login, glab auth login, gcloud auth login. The platform knows these poll-then-write and keeps them alive for you.

When it will NOT work (don't rely on it)

  • On a per-turn sandbox (local/docker dev). Those backends have no process sessions and are torn down at the end of every turn — there is nothing to keep the poller alive across the human's approval. An interactive browser login cannot complete there. Use a non-interactive path instead: a token via env or --with-token / --token --stdin, a service-account / credentials file, or --cred-file. The platform deliberately leaves those non-interactive token forms to run normally (it only backgrounds the interactive login).
  • For logins the platform doesn't recognize. A CLI that prompts for a username/password at the TTY, or a bespoke OAuth flow that isn't in the list above, is not backgrounded — it runs as an ordinary blocking command and will hang and then die at turn teardown. Prefer that tool's non-interactive/token auth, or ask the user to provide a token you can configure.
  • For arbitrary processes you spawn yourself. Backgrounding with & / nohup does not make a process survive between turns. Only declared session kinds are kept alive past teardown, and today only the interactive-login broker is wired in. A dev server, a long build, or a sleep you launch will be reaped when the turn ends — don't architect a task around "I'll leave it running in the background."

Boundaries

  • A backgrounded login session is scope-keyed to the requesting scope and lives on that scope's computer only — it never crosses the data boundary; another principal in the same thread cannot read your session or use the resulting auth.
  • A session is a host for resident state, not an authority. The login only completes the auth exchange; any side-effecting or destructive command you run afterward still goes through the normal approval path.
  • Never echo the token, one-time code reuse, client secret, or resulting credentials into the channel — hand over only the verification URL + code the human needs.

Version History

  • 7f2c916 Current 2026-08-02 21:46

Same Skill Collection

.claude/skills/dev-instance/SKILL.md
.claude/skills/update-qm/SKILL.md
.claude/skills/upstream-pr/SKILL.md
.codex/skills/deploy-qm/SKILL.md
.codex/skills/dev-instance/SKILL.md
.codex/skills/update-qm/SKILL.md
.codex/skills/upstream-pr/SKILL.md
cli/templates/deployment/SKILL.md
plugins/onboarding/skills/onboarding/SKILL.md
skills-seed/admin/SKILL.md
skills-seed/browse/SKILL.md
skills-seed/cloud-cli/SKILL.md
skills-seed/connect-apps/SKILL.md
skills-seed/dropbox/SKILL.md
skills-seed/email-draft-in-voice/SKILL.md
skills-seed/email-voice-profile/SKILL.md
skills-seed/github-gitlab/SKILL.md
skills-seed/google-drive-sheets/SKILL.md
skills-seed/google-workspace/SKILL.md
skills-seed/linear/SKILL.md
skills-seed/memory/SKILL.md
skills-seed/morning-digest/SKILL.md
skills-seed/popular-web-designs/SKILL.md
skills-seed/publish/SKILL.md
skills-seed/taste-skill/SKILL.md
skills-seed/use-shared-credential/SKILL.md

Metadata

Files
0
Version
7f2c916
Hash
4adc9034
Indexed
2026-08-02 21:46

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-03 14:55
浙ICP备14020137号-1 $bản đồ khách truy cập$