Skip to content

test(smoke): drive quickstart through to the token-mint prompt#336

Open
tildesrc wants to merge 10 commits into
mainfrom
panopticon/smoke-quickstart-mint
Open

test(smoke): drive quickstart through to the token-mint prompt#336
tildesrc wants to merge 10 commits into
mainfrom
panopticon/smoke-quickstart-mint

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

What

Extends the smoke workflow beyond "the services come up" to exercise the quickstart flow, running the real panopticon quickstart and asserting it reaches the token-mint prompt — the last step before the interactive claude setup-token OAuth that CI can't complete.

How

  • Stub claude/docker so the doctor gate passes. panopticon quickstart gates on panopticon doctor, which requires claude (absent on both runners) and a reachable docker daemon (absent on macOS). doctor only checks binary presence (which) and docker info's exit code, so a #!/bin/sh; exit 0 stub on PATH satisfies it. claude is stubbed on both OSes; docker only on macOS (ubuntu-latest keeps its real daemon).
  • Safe because the setup-repo task is a shell workflow. Nothing after the doctor gate needs real docker to reach the mint prompt: quickstart migrates, starts the sessions, registers the repo, and creates the setup-repo task, which the runner spawns via ShellRunner (no image, no container). The real setup_repo.sh runs and stops at mint one with 'claude setup-token'. The claude stub is never invoked — the flow halts before the Enter that would run it.
  • Blank CLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEY so the script takes the mint path rather than the "adopt a token from your environment" path.
  • Handle the interactive console. quickstart ends by opening the console (tmux attach), which no-TTYs out in CI and returns; it's backgrounded so a stuck attach can't wedge the job, and killed once the assertion is made. The smoke then polls the panopticon-<task_id> pane for the mint string.

Runs on ubuntu-latest and macos-latest, so the real setup_repo.sh is exercised on macOS too.

panopticon-agent and others added 10 commits July 15, 2026 16:09
Extend the smoke workflow beyond "services come up" to run the real
`panopticon quickstart` — doctor gate, repo registration, and the
setup-repo shell task — and assert it reaches the `claude setup-token`
mint prompt (the last step before the interactive OAuth CI can't do).

doctor requires `claude` (absent on both runners) and a reachable
`docker` daemon (absent on macOS); it only checks binary presence and
`docker info`'s exit code, so a stub bin on PATH satisfies it. The
setup-repo task is a shell workflow, so nothing after the gate needs
real docker to reach the mint prompt. Keep real docker on Linux.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The macOS runner never observed the setup-repo shell session at the
mint prompt. Dump the task's final state, tmux sessions, pane history,
and runner/service logs on failure to pin down whether the session was
never created or ran to completion (read got EOF).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The setup-repo task stays RUNNING on macOS with no session, so its
shell pane exits mid-script. Set tmux remain-on-exit so the dead pane
persists, and always dump the pane scrollback, to capture the exact
error (macOS /bin/sh is bash 3.2 vs ubuntu's dash).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`detach=$(... awk '... print $(NF - 1) ...')` nests a `(` inside the
outer command substitution, which macOS /bin/sh (bash 3.2) mis-parses
("syntax error near unexpected token `('"), killing the setup-repo
shell task before it prompts. Assign `i = NF - 1` and `print $i` so the
substitution has no nested parens; behaviour is unchanged on Linux.

Uncovered by the extended smoke test now driving quickstart through the
token-mint prompt on macos-latest. Revert its diagnostics to a clean
failure-only dump.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The detach-key fix cleared the first bash-3.2 parse error, but the
macOS shell task still exits mid-script. Re-add remain-on-exit to
capture the next error's pane output.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The real bash-3.2 trip was a double-quoted string nested inside the
`awk '…'` program inside the `$(…)` command substitution — bash 3.2's
command-substitution parser mishandles the nested quotes and dies with
"syntax error near `('". Pass "detach-client" via `awk -v k=` so the
program carries no nested quotes. Behaviour unchanged on Linux.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The true bash-3.2 trip (reproduced locally with BASH_COMPAT=3.2) was the
apostrophe in `${PANOPTICON_ENV_FILE:-the repo's env-file}`: a `'` inside
a `${…:-default}` default within a double-quoted string derails macOS
/bin/sh's quote tracking, so it mis-parses the rest of the script and
dies at a later `(`. Reword the fallback without an apostrophe.

Revert the earlier detach-line edits (a wrong diagnosis — that line
parses fine on bash 3.2) so the only script change is this one line.
Drop the smoke test's temporary dead-pane diagnostic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…kstart-mint

# Conflicts:
#	src/panopticon/workflows/setup_repo.sh
Encapsulate the smoke test's pass/fail check — wait for the setup-repo
task, poll its host tmux pane for the `claude setup-token` mint prompt,
exit 0 on success or 1 with diagnostics — as a single command, so the
CI step is `panopticon smoketest` instead of an inline shell+python
heredoc. It's a CI-only helper: kept out of `panopticon --help` (no
subparser help + excluded from the subcommands metavar).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`panopticon quickstart` already starts the task service + runner (the
same detached tmux sessions and logs `make host` produces), so drop the
separate `make host` step and let quickstart bring everything up. Fold
the health-check and session-verify into the quickstart step, which
backgrounds quickstart and then asserts via `panopticon smoketest`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant