Repository navigation
fix(tui): two-step failure screen for runs and logins, opt-in log report - #1612
Conversation
pnpm 12 refuses the pinned 10.34.5 with "High-risk trust downgrade (possible package takeover)": 10.34.6 and later are published through GitHub trusted publishing, and 10.34.5 was not. Local installs on current pnpm stopped before resolving anything. Moves packageManager (with its sha512), the volta pins and every CI pin to 10.34.9. pnpm install --frozen-lockfile on 10.34.9 leaves pnpm-lock.yaml unchanged.
A run that failed for any reason other than a deliberate stop showed "The Wizard's a little busy", and the exit line said the wizard was unavailable, even when a task failed (init on a plain HTML site ends in PHW_AGENT_ORCHESTRATOR_TASKS_FAILED). Reporting it meant emailing the log by hand. Only capacity codes (rate limit, API error, mint refused or failed, service outage) keep the busy copy. Every other failure shows "The wizard couldn't finish setup" with the failure message, and the exit line starts with "Setup did not finish:". The handoff screen asks once whether to send the report. Send report captures "wizard: failure reported" with the error code, message, a capacity flag and up to 64 KB of this run's log, read from where this process started writing, with recognized secrets and home paths masked. The manual report option and the email line are gone; the exit line keeps the log path. redactSecrets now masks secrets logged as JSON keys (raw or escaped) and pha_/phr_ tokens, and scrubHomePaths handles JSON-escaped Windows paths, which also tightens the other places that scrub through them. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: moderate
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
The failure screen stacked a headline, the runner's technical message, a send-or-not question and a second menu. It is now one red card with a plain cause and a suggested fix, a line saying the wizard team already knows, and one menu: Send log to the wizard team, Open in Claude Code, Open in Codex, Save skill, Exit. The log stays opt-in, and the item greys out once sent. Capacity failures and every other failure share the same shape with their own copy, and the exit line uses the same words. The report's message now goes through redactSecrets and scrubHomePaths, and secrets logged as JSON values are masked whole, raw or escaped, including escapes, quotes and newlines inside the value. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: moderate
…e log The red border made the screen busy; the red headline already marks the error. "We've let the wizard team know" read as if the log had gone too, next to the opt-in Send log item, so the note now says the error came in automatically but not the log. The exit line keeps only the first half, which holds whether or not the log was sent. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: narrow
One screen held what happened, the log question and every way to finish, which read as busy. Step 1 says what happened, that the error already reached us, and asks Send log or Don't send. Either answer moves to step 2, "Finish setting up PostHog": run the wizard again (in a few minutes when busy), or hand the setup to your own agent, with Open in Claude Code, Open in Codex, Save skill and Exit. The log prompt says we mask the keys and tokens we recognize, which is what the redaction covers. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: narrow
Review found the two steps read as two screens and leaned on sub-headers. Both steps now keep the same red headline under a dim "Step N of 2", bullets replace the numbered list, the command sits on its own line, and the log choices read "Send log and continue" / "Continue without sending", since "try again" sounded like the wizard would retry. A failed login ended on the generic outro with the raw error and OAuth bug-report details. Login failures with PHW_AUTH_LOGIN_FAILED or PHW_AUTH_PROJECT_FETCH_FAILED now take the same two steps, minus the agent handoff, which needs a project. PHW_AUTH_ACCESS_DENIED is a decision: one screen, no log question. The two new codes are for the login abort to emit. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: moderate
Brings in #1613's login fixes, written by Rafa (@rafaeelaudibert): a failed project or user fetch after login ended the run as completed with exit 0, a failed OAuth login showed only "Wizard setup cancelled.", and the paste-code overlay could cover the screens after login. The OAuth abort now carries PHW_AUTH_ACCESS_DENIED or PHW_AUTH_LOGIN_FAILED, so those logins reach the two-step failure screen. The project fetch throws PHW_AUTH_PROJECT_FETCH_FAILED and only the run's login aborts on it, since `wizard slack` and the MCP tutorial show that error inline with a retry. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: moderate
Every run appends to one shared log file, so reading it from this run's starting offset also picked up a concurrent run's prompts and tool output. The run now keeps its own last 64K of log lines as it writes them, and Send log uploads that, still masked. Ticket: task-failure-outro/U2 Confidence: high Scope-risk: narrow
gewenyu99
left a comment
There was a problem hiding this comment.
🥸 Reviewed by NotVincent, totally not Vincent. The real Vincent will review it separately. Probably slop, please disregard.
Hey, this looks generally good. There are two things to address: the post-login exit deadlock on non-program tools like wizard doctor, and MintFailureScreen overriding dedicated auth and abort screens. The rest are suggestions.
The failure screen took any logged-in error. A tool such as wizard doctor never waits on the handoff, so Exit left a blank terminal, and auth errors and tailored abort outros (missing SDK, missing scope, settings conflict) lost the screen that names their fix. Only a registered program shows it now, every error code has a route the compiler checks, and overlays resolve first. GatewayMintRefused and AgentApiError no longer show busy copy. Programs other than the integration say the wizard did not finish and name their own rerun command, or ask for the same command when they have none. Ticket: failure-routing-review-fixes/U1 Confidence: high Scope-risk: moderate
The opt-in failure log now masks minted phe_ gateway tokens, PEM private keys (including a block the log tail cut), and secret-named values that are JSON-escaped, quoted, or carry punctuation, without crossing a line or re-matching an earlier mask. Windows user paths nested in JSON are scrubbed. A failed login reports error status and is captured once, through the abort, with its OAuth fingerprint. The failure reported event carries the session properties like the events beside it. Ticket: failure-routing-review-fixes/U2 Confidence: high Scope-risk: narrow
gewenyu99
left a comment
There was a problem hiding this comment.
🥸 Reviewed by NotVincent, totally not Vincent. The real Vincent will review it separately. Probably slop, please disregard.
An uncoded error from the OAuth login (no callback ports, a port loop that exits) reached the TUI host with no credentials, so the run ended as completed with exit 0. The login now aborts it as AuthLoginFailed, which shows the login failure screen; coded errors pass through. A single log line over the 64K tail emptied the failure report log_tail; the tail keeps the end of that line. A test pins the access-denied screen skipping the log question. Confidence: high Scope-risk: narrow
Keeping the end of a line longer than the 64K tail could keep a secret value without the PASSWORD= name that gets it masked, since masking runs after the cut. Such a line is now replaced with a note. Confidence: high Scope-risk: narrow
Problem
When a run fails because a task failed, the wizard says it's busy. A customer ran it on a plain HTML site, init failed (
PHW_AGENT_ORCHESTRATOR_TASKS_FAILED), and they saw "The Wizard's a little busy" with an exit line saying the wizard is unavailable. Over the last 14 days, 246 of the 481 runs that landed on that screen were blocked tasks, and only 78 were mint refusals. Reporting it meant emailing us the log by hand.Stacked on #1610 (pnpm pin), so review that first. This also takes over #1613's login fixes from @rafaeelaudibert, so that PR can close once this merges.
Changes
npx @posthog/wizard@lateston its own line, then Open in Claude Code, Open in Codex, Save skill, Exit. No error codes or runner text. Capacity failures (AgentRateLimit,AgentApiError,GatewayMintRefused,GatewayMintFailed,EnvServiceOutage) get "The wizard is busy right now" and "in a few minutes". Every other run failure gets "PostHog isn't set up yet". The exit line uses the same headline and cause.PHW_AUTH_ACCESS_DENIED(new) orPHW_AUTH_LOGIN_FAILED(new), and the fetch throwsPHW_AUTH_PROJECT_FETCH_FAILED. Login and fetch failures take the same two steps with their own copy, and step 2 offers only Exit, since the agent handoff needs a project. Access denied is a decision: one screen, no log question. Only the run's login aborts on the fetch error;wizard slackand the MCP tutorial still show it inline with a retry. Timeouts keep their own overlay, and other login aborts keep their specific outro.wizard: failure reportedwith the error code, message,is_capacityand up to 64 KB of this run's own log lines. Every run appends to one shared log file, so the run keeps its lines in memory as it writes them and never reads another run's.redactSecretsandscrubHomePaths. Secrets logged as JSON values are masked whole, raw or escaped, including escapes, quotes and newlines.pha_/phr_tokens and JSON-escaped Windows home paths are covered too, which also tightens the other callers.main)Rendered from the real
MintFailureScreenin a PTY at 90x30.Test plan
pnpm typecheckand lint pass, andvitest --project tui --project sharedpasses (goldens updated), and the full suite passes (4795 tests)results.test.tsfail on the old redaction and pass now: JSON keys raw and escaped, values with a backslash, a quote and a multiline key,pha_, and an escaped Windows pathoauth-flow.test.tschecks the code on anaccess_deniedand aninvalid_scopecallback.ci-region.test.tschecks a failed fetch throws the coded error without aborting, which fails on fix(auth): end a failed login as failed and say why #1613's version, andlogin.test.tschecks the run's login aborts on it and passes other errors throughphc_tokens and 0 home pathsMintFailureScreen.test.tsxwalks both steps: Send log then save and continue, continue without sending then exit, the step 1 headline for a task failure against a mint refusal, and a failed login with no credentials reaching this screen with only Exit after the log question