Skip to content

fix: preserve Grok authentication and terminal failure evidence - #52

Merged
thisguymartin merged 1 commit into
mainfrom
codex/grok-auth-failure-39
Oct 13, 2026
Merged

thisguymartin merged 1 commit into
mainfrom
codex/grok-auth-failure-39

Conversation

@thisguymartin

Copy link
Copy Markdown
Owner

Closes #39

What changed

Grok API-key sessions could fail preflight, neighboring model names could pass it, and cancellation or error events lost their terminal details. The runner now accepts both login forms, checks exact model tokens, and preserves failure messages, session identity, model evidence, usage, and cost on zero and nonzero exits.

  • Reject explicit auth/model errors and base the single auth retry on the full-response verdict, including long preflight output.
  • Use auto for both headless modes with the existing sandboxes, cwd, tool lists, and recursion restrictions.
  • Keep failed answer files absent and retain bounded terminal-tail evidence. Explicit deadlines, named dropouts, and model routing stay intact.

Ported the Grok changes from upstream #130 and 47cd5a2. Full upstream import pins stay unchanged. Stream capture already retains the required output, so Sync 4 is not a dependency.

Review runner/run.ts for retry classification and launcher cancellation/deadline precedence; runner/commands.ts retains the sandbox and tool boundaries.

Grok authentication and terminal receipt flow

Mermaid/mer-inkdrop: terminal failures retain their metadata while the runner removes the answer file.

Verification

  • Bun tests, strict typecheck, static invariants, and plugin validation pass.
  • The exact candidate is installed in every affected harness.
  • The changed behavior passes from each real user surface.
  • The installed version, action, and observed result appear below.

bash scripts/check.sh: 296 tests passed, 0 failed; strict typecheck, static invariants, manifest parsing, and both Claude plugin validations passed. Diff security scan: no confirmed findings.

Live evidence:

Harness: Claude Code (CLI version not recorded)
Installed: not installed; candidate pstack 1.5.0 @ eeee60ec8aac2f53aa979af508b3b95c4530482c
Surface: not exercised
Action: pending setup/scope and Grok dispatch, login, permission, and failure checks
Observed: no installed evidence collected
Result: not run
Harness: Codex (CLI version not recorded)
Installed: not installed; candidate pstack 1.5.0 @ eeee60ec8aac2f53aa979af508b3b95c4530482c
Surface: not exercised
Action: pending setup/scope and Grok dispatch, login, permission, and failure checks
Observed: no installed evidence collected
Result: not run
Harness: OpenCode beta (CLI version not recorded)
Installed: not installed; candidate pstack 1.5.0 @ eeee60ec8aac2f53aa979af508b3b95c4530482c
Surface: not exercised
Action: pending setup/scope and Grok dispatch, login, permission, and failure checks
Observed: no installed evidence collected
Result: not run
Harness: OMP (CLI version not recorded)
Installed: not installed; candidate pstack 1.5.0 @ eeee60ec8aac2f53aa979af508b3b95c4530482c
Surface: not exercised
Action: pending setup/scope and Grok dispatch, login, permission, and failure checks
Observed: no installed evidence collected
Result: not run

A pull request without live evidence remains a draft. Do not merge, tag, release, or roll it out.

Grok API-key sessions were rejected by preflight, neighboring model names
could pass availability checks, and cancellation/error events lost their
status and metadata. Port the scoped upstream fixes for #39 while keeping
pstack-flex's shared harness routing and execution constraints.

- Accept subscription and XAI_API_KEY login evidence, reject explicit auth
  and model errors, and match regex-escaped exact model tokens.
- Classify the full preflight response once and reuse its verdict for the
  bounded auth retry so truncated receipt evidence cannot cause a retry.
- Preserve terminal messages, cancellation status, session, model proof,
  usage, and cost on both zero and nonzero Grok exits; keep terminal tails
  in bounded failure evidence and remove failed answer reservations.
- Use auto permissions for headless read-only and isolated-write lanes
  while retaining each sandbox, cwd, tool list, and recursion restriction.
- Cover both login forms, contradictory auth, neighboring model tokens,
  long preflight output, terminal status validation, and exit-code cases.

Retain explicit deadlines, named dropouts, and the absence of implicit
runtime timeouts or fallback models. Installed parent-surface validation
remains pending; deliver this candidate as a draft PR.

Refs: #39; ericlitman#130; upstream 47cd5a2
@thisguymartin
thisguymartin marked this pull request as ready for review October 13, 2026 22:39
@thisguymartin
thisguymartin merged commit 14b4805 into main Oct 13, 2026
1 check passed
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.

Sync 3: Improve Grok authentication and failure handling

1 participant