Skip to content

forge: concept scripts piping a CLI into jq swallow its exit status and stderr #1651

Open

Description

@waleedkadous

Context

PR #1646 (fixes #1645) found that scripts/forge/github/pr-list.sh ran gh straight into a
jq pipe. POSIX sh has no pipefail, so the pipeline reports jq's exit status — a
rate-limited or unauthenticated gh looked like a successful empty result, and its stderr,
the only place the reason is named, was discarded.

That matters beyond cosmetics: Tower's rate-limit suspension (#1645) is driven entirely by a
concept command's exit status and stderr. A concept that swallows them gets negative caching
but can never trigger a suspension and never reports rate-limited — it just returns
empty lists forever while the forge refuses it.

#1646 fixed the concepts on the overview's hot path:

  • github/pr-list.sh
  • gitlab/pr-list.sh
  • gitea/issue-list.sh, gitea/recently-closed.sh

(gitea/pr-list.sh, gitea/recently-merged.sh and gitea/user-identity.sh already did this
correctly — with a comment naming the pipefail issue, so the pattern was known.)

What is left

These still pipe their CLI or curl straight into jq:

gitea/_lib.sh          gitea/issue-view.sh    gitea/issue-search.sh
gitea/pr-create.sh     gitea/pr-view.sh
gitlab/issue-view.sh   gitlab/issue-search.sh gitlab/pr-exists.sh   gitlab/pr-view.sh
linear/issue-list.sh   linear/recently-closed.sh  linear/issue-view.sh
linear/issue-search.sh linear/issue-comment.sh    linear/user-identity.sh

The Linear ones are the reason this is a separate issue rather than more of #1646: their
curl invocation already nests $(jq -n …) inside a -d "…" argument, so the
capture-into-a-variable rewrite needs care with quoting and cannot be done mechanically. An
attempt during #1646 produced a syntax error and was reverted rather than shipped unverified.

What to build

For each script, capture then pipe:

OUT="$(the-cli --args)" || exit $?
printf '%s' "$OUT" | jq '…'

Follow-up to #1645. See also #1647, #1648, #1650.

Activity

  1. added
    area/core
    on Sep 8, 2026
  2. added a commit that references this issue on Sep 8, 2026
  3. waleedkadous commented on Sep 8, 2026

    @waleedkadous
    ContributorAuthor

    Correction: #1646 was superseded, not merged

    This issue's body says PR #1646 shipped part of the fix. It did not — #1646 was closed
    unmerged on 2026-09-08 and the core is being rebuilt on a fresh branch (architect decision;
    ten rounds of fix-on-fix, and one commit whose message described changes it did not contain).

    So the behaviour this issue builds on does not exist yet. Read the body as describing the
    design that #1645's rebuild will land, not the current state of main.

    The specific invariants are captured as one-line testable statements in the rebuild's pitfall
    list (/tmp/bugfix-1645-pitfalls.md, attached to the #1645 lane), including the ones this
    issue depends on. Sequence this work after the rebuild lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions