Skip to content

fix(kanban): preflight Codex worker auth readiness - #31551

Open
mg-mister wants to merge 1 commit into
NousResearch:mainfrom
mg-mister:fix/kanban-codex-worker-readiness
Open

fix(kanban): preflight Codex worker auth readiness#31551
mg-mister wants to merge 1 commit into
NousResearch:mainfrom
mg-mister:fix/kanban-codex-worker-readiness

Conversation

@mg-mister

Copy link
Copy Markdown

Summary

  • let profile-local broken Codex auth fall back to valid root/global Hermes auth without copying refresh tokens into worker profiles
  • add a narrow Kanban pre-spawn readiness gate for deterministic Codex auth failures, including immediate block for no-fallback auth failures
  • preserve configured runtime fallback providers and ACPX canonical-home routing for profile workers

Test plan

  • python -m py_compile hermes_cli/auth.py hermes_cli/kanban_db.py
  • scripts/run_tests.sh tests/hermes_cli/test_auth_codex_provider.py tests/hermes_cli/test_auth_profile_fallback.py tests/hermes_cli/test_kanban_db.py

Notes

  • The readiness probe uses refresh_if_expiring=False so it does not consume Codex refresh tokens during preflight.
  • Refreshes sourced from the global auth store write back to that source store, not to profile-local auth files.

Allow Kanban workers with broken profile-local Codex auth to use valid global auth fallback without copying refresh tokens into profile homes.

Add a narrow pre-spawn readiness gate for deterministic Codex auth failures, preserving configured runtime fallbacks and blocking immediately instead of crash-looping when no fallback can run.

Tests cover profile/global auth fallback, source-store refresh writes, retry-limit override for readiness failures, ACPX canonical home env, and fallback-provider readiness semantics.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools codex P3 Low — cosmetic, nice to have labels May 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to closed #19475 (original Codex profile auth preflight fix) and open #31461 (Claude CLI runtime + Kanban auth preflight). This PR extends the preflight concept with global-root auth fallback — not a direct duplicate since it adds new fallback logic, but overlaps significantly with #31461's auth preflight scope.

@mg-mister

Copy link
Copy Markdown
Author

Thanks — agreed this overlaps with #31461 at the Kanban preflight layer, but the failure mode here is narrower/different:

  • Codex OAuth profile-local auth can become invalid/empty and shadow a valid root/global Hermes auth store.
  • This PR lets workers use the valid source auth store without copying refresh tokens into profile homes.
  • The readiness gate is narrow: it preflights deterministic openai-codex auth failures without consuming refresh tokens, preserves configured runtime fallbacks, and fails open on inconclusive fallback probes.

Local validation on the PR branch:

python -m py_compile hermes_cli/auth.py hermes_cli/kanban_db.py
scripts/run_tests.sh tests/hermes_cli/test_auth_codex_provider.py tests/hermes_cli/test_auth_profile_fallback.py tests/hermes_cli/test_kanban_db.py
# 200 passed, 0 failed

Actions are currently action_required from the fork with no jobs/logs yet, so maintainer approval is needed before CI can run.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the broken-local-Codex-state case. The premise still holds on current main: _load_provider_state_with_source() returns a profile-local provider block before root fallback (hermes_cli/auth.py:1190-1204), and _read_codex_tokens() rejects malformed local tokens (hermes_cli/auth.py:3232-3278).

Problems

  • The auth implementation needs a current-head salvage, not a direct application. Current _save_codex_tokens() also synchronizes eligible Codex credential-pool entries (hermes_cli/auth.py:3382-3407), while the current refresh path includes CLI self-healing (hermes_cli/auth.py:3560-3601). Source-aware global writes must preserve both contracts.
  • The Kanban dispatcher has moved: ready and review claims now occur at hermes_cli/kanban_db.py:7497 and :7589. Apply the readiness decision consistently to both current loops.

Suggested changes

  • Rebuild the source-selection/refresh path against current auth code and add regressions for malformed local state, global-source persistence, pool synchronization, and self-healing.
  • Reapply the readiness gate after each current claim and before spawn, retaining current task-run/event semantics.

Automated hermes-sweeper review.

@alt-glitch alt-glitch added comp/cron Cron scheduler and job management needs-decision Awaiting maintainer decision before any implementation labels Jul 13, 2026
@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools codex comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants