tny-live-testing
Run tny against the user's real provider accounts (codex subscription, CURSOR_API_KEY) and drive the real TUI in a pty. Use for "full integration" or "test against my accounts" requests, and for verifying host process lifecycle (pre-warm, adoption, shutdown, orphans).
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- tny-live-testing
- description
- Run tny against the user's real provider accounts (codex subscription, CURSOR_API_KEY) and drive the real TUI in a pty. Use for "full integration" or "test against my accounts" requests, and for verifying host process lifecycle (pre-warm, adoption, shutdown, orphans).
03 SKILL.md 正文
Live-testing tny against real accounts
Credentials and binaries
CURSOR_API_KEYlives in the login shell only: fetch it withzsh -lc 'printf %s $CURSOR_API_KEY'. Codex auth is~/.tny/codex-auth.json(tny's native login) or the Codex CLI's~/.codex/auth.json; either works.- Agent CLIs are wrapped by shell functions and mise shims: resolve real
paths with
zsh -lc 'whence -p codex'for the other CLIs; codex needs no binary at all (turns and login go straight to chatgpt.com/auth.openai.com). The user's HOME must stay real (mise shims break under a fake HOME).
Protecting the user's state
tny ask/TUI writes~/.tny/settings.json(last_provider, per-provider models) viaremember_use. Back it up first, diff and restore after so live tests don't silently flip the user's default provider.- Run from a scratch cwd so test sessions don't pile into a real workspace's session list.
- Never run live tests through
build/tnywhile the mutation harness is active — it relinks that binary with mutants. Copy it first.
One-shot checks (cheap, per provider)
TNY_CODEX_BIN=$(zsh -lc 'whence -p codex') \
./tny --provider codex ask --json "Reply with exactly the word OK and nothing else."
zsh -lc './tny --provider cursor ask --json "Reply with exactly OK."'
Assert on the --json envelope: output, provider, exit_code.
TUI lifecycle checks (pty)
Drive the binary under pty.openpty() + TIOCSWINSZ (see
tests/integration/test_tui.py for the Term/Screen classes; the Screen
emulator is the only honest way to assert what is visible, because the raw
byte stream keeps everything ever printed). The live pre-warm check is:
- launch
tny --provider Xand send no prompt; - poll
ps -ax -o pid=,ppid=,command=for the host child (cursor-sdk-bridge, the ACP agent) — it must appear within seconds of the banner.--provider codexspawns nothing (docs/adr/0065): assert that NO child appears and that the reply still arrives over HTTPS; - submit a prompt, assert the reply AND that the host pid did not change (adoption, not respawn);
/quit, then check for orphans with a precisepgrep -fon the host command line — the user runs unrelated agent processes (ChatGPT.app, codex app-servers) that a loose pgrep will flag.
Known lifecycle trap
Version-manager shims fork the real host binary instead of exec'ing it;
killing only the direct child orphans the server. tny handles this with
setpgid + process-group kills in every host spawn/stop path — if you add a
spawn path, do the same and re-run the orphan check above.
04 同仓库更多 Skills
usr
Fixture whose name collides with a path component
deploy
Ship the current branch to staging
deploy-prod
Promote staging to production
tny-tool-extensions
Write, test and debug tny Python tool extensions (@tny.tool, tny.group, tny.proxy, folder modules, schemas). Use when asked to add a tool, command or MCP proxy to tny.
tny-mutation-testing
Run and interpret tny's mutation-testing harness (tests/mutation/mutate.py) to verify that the test suite actually notices behavior changes. Use when asked to mutation-test a change, to "test extensively", or when adding code the unit suite might cover only nominally.