Skip to content

fix: parsec ship should fall back to gh auth token (parity with parsec doctor) #281

@erishforG

Description

@erishforG

Problem

parsec ship fails to create the PR when PARSEC_GITHUB_TOKEN / GITHUB_TOKEN / GH_TOKEN env vars are absent, even though gh auth token is available and parsec doctor already accepts gh auth token for the GitHub auth check.

This creates an inconsistency:

Command gh auth token fallback
parsec doctor (token check) ✅ accepted
Tracker fetch (e.g. parsec start, ticket title lookup) ✅ accepted
parsec ship (PR creation) ❌ rejected

Repro

unset PARSEC_GITHUB_TOKEN GITHUB_TOKEN GH_TOKEN
gh auth status   # logged in
parsec start 207 --base develop
# ... do work, commit ...
parsec ship 207 --base develop
# remote: ... (push succeeds)
# note: PR/MR creation skipped — no token found.
#       Set PARSEC_GITHUB_TOKEN, PARSEC_BITBUCKET_TOKEN, or PARSEC_GITLAB_TOKEN to enable.
# error: [E012] Ship partial: branch pushed but PR/MR creation failed.

User has to run gh pr create ... manually after the fact. Workflow breaks.

Expected

parsec ship should resolve the GitHub token in the same priority order parsec doctor and the tracker layer use:

  1. PARSEC_GITHUB_TOKEN
  2. GITHUB_TOKEN
  3. GH_TOKEN
  4. gh auth token (shell out to gh auth token and capture stdout)

If all four fail, then surface the current error.

Acceptance

  • parsec ship succeeds with only gh auth login configured (no env vars set).
  • Same fallback order applied to GitLab (glab auth token) and Bitbucket if applicable — match whatever pattern the doctor / tracker layer already uses.
  • Add a unit/integration test for the token resolution helper.

Notes

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions