CLI exits 0 with no brief when next_need reports a refused token

Open Beginner friendly
#374 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, rust

Research direction

Read the CLI path that handles next_need errors and compare it with the server-side token refusal path, which the issue says exits 2. Reproduce with an expired App token followed by a fresh token; confirm that a refused token exits non-zero with the documented message and that exit 0 produces a JSON brief.

Written by the indexing model from the issue text.

Description

Observed

mergeloop agent-labs-dev/nebula-mobile#2205 --after 481936a10fe9cfb3 (CLI mergeloop 0.1.0, run through the ~/bin/mergeloop shim that mints a merge-loop App installation token into MERGELOOP_TOKEN) exited 0 with no brief after a wait of more than an hour, on 2026-12-01:

mergeloop: agent-labs-dev/nebula-mobile#2205: Nothing new since `481936a10fe9cfb3`; waiting
mergeloop: https://mergeloop.ai does not take the GitHub token: check MERGELOOP_TOKEN or `gh auth status`
mergeloop shim: App token rejected (expired after a long wait); minted a new one, rerunning (1/20)
mergeloop: agent-labs-dev/nebula-mobile#2205: Nothing new since `481936a10fe9cfb3`; waiting
mergeloop: next_need: GitHub does not take this token.
exit 0

The first failure is the one-hour App token expiring (exit 2, handled by the shim). The second is new: with a freshly minted token, next_need reported a refused token and the CLI exited 0, the same code as "a brief was printed", without printing a brief. A caller that treats exit 0 as "work the brief" has nothing to work, and the PR is left unwatched.

Reproduction

Run mergeloop <repo#N> --after <id> on a PR held for a human review long enough (over an hour) for an App installation token in MERGELOOP_TOKEN to expire; let the wrapper re-mint and rerun.

Verified vs suspected

  • Verified: exit 0 with next_need: GitHub does not take this token. and no JSON brief, right after a rerun with a newly minted token.
  • Suspected: the CLI maps a token refusal from next_need to a normal return instead of the exit 2 it uses for the server's token refusal; why the fresh token was refused (a cached old token, or a GitHub propagation delay for a just-minted installation token) is not established.

Expected

A refused token exits non-zero with the same documented sentence as the server-side refusal, so wrappers can re-mint; exit 0 only with a brief.

Related: #366 (same message after a rate-limit wait, exit 2). Duplicates checked: searched for "does not take this token", "next_need token", "exit 0"; none found.

Dominant language
Rust
Stars
6
Forks
0
Avg merge
4h 17m
Merged PRs (30d)
132

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from agent-labs-dev/mergeloop

All issues in agent-labs-dev/mergeloop

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.