Skip to content

fix(roadmap): intake hides why a gh issue create failed #5269

Closed

Description

@dan-petty

Problem Description

devops roadmap intake --title ... --body-file ... --confirm failed once to open a new issue: GitHubOperationError: Could not open the issue '<title cut to 64 characters>' in dan-petty/devops-cli (exit 1): unexpected end of JSON input. Intake then said Intake placed 0 item(s) and skipped the candidate. GitHub held no issue after it. The same command with a 3-character shorter title, 1 minute later, filed #5268. So the cause is not known: a gh call whose answer was empty, or the title. The message also cuts the title, so it does not show the title that intake sent.

Reproduction Steps

  1. uv run devops roadmap intake --repo dan-petty/devops-cli --title "test(docs): six docs tests read the DEVOPS_CLI_CONFIG of the shell" --body-file <file> --confirm on 2026-11-12 at about 22:16Z.

Expected vs Actual Behavior

Expected: the issue is filed, or the error names the gh command, its stderr and the full title.
Actual: exit 1: unexpected end of JSON input, with no stderr of gh and a cut title.

Environment Diagnostics

devops-cli at origin/main 5645b63 (after #5264), in the devcontainer.

Logs, Traces, or Terminal Output

✓ Intake placed 0 item(s).
✗ Intake finished with candidates it could not write: the writes failed for 1 candidate(s), and intake skipped them after writing the others; the next run tries them again: "test(docs): six docs tests read the DEVOPS_CLI_CONFIG of the shell" (GitHubOperationError: Could not open the issue 'test(docs): six docs tests read the DEVOPS_CLI_CONFIG of the she' in dan-petty/devops-cli (exit 1): unexpected end of JSON input)

Found by the builder of #5125.

Alternatives check of 2026-11-16: none.
Tool: none found.

Proposed design

Problem statement

Intake reports a failed gh issue create as GitHubOperationError: ... (exit 1): unexpected end of JSON input. That text is gh's own stderr, but intake presents it as an unlabeled blob, cuts the title to 64 characters, and omits the command. The fix names the command, labels the stderr (or says it is empty), and keeps the full title in both the store error and the intake summary.

Acceptance criteria

Requirement: Full title in the create error

When gh's stderr matches no classified failure, the error for a failed gh issue create SHALL name the full issue title that intake sent.

Scenario: A title longer than the store's 64-character cut fails to open

  • WHEN A unit test calls GitHubRoadmapStore.create_issue with a title longer than 64 characters and a fake gh result of exit 1 and stderr unexpected end of JSON input.
  • THEN The test asserts the error text contains the complete title and not the title cut to 64 characters.

Requirement: Command, exit code and stderr in the create error

When gh's stderr matches no classified failure, the error for a failed gh issue create SHALL name the gh api -X POST repos/<repo>/issues command, its exit code and its stderr.

Scenario: gh refuses the create with a validation error

  • WHEN A unit test gives GitHubRoadmapStore.create_issue a fake gh result of exit 1 and stderr HTTP 422: Validation Failed.
  • THEN The test asserts the error text contains gh api -X POST repos/dan-petty/devops-cli/issues, exit 1 and stderr: HTTP 422: Validation Failed.

Requirement: gh stderr is reported as stderr

The error for a failed gh issue create SHALL label the text gh wrote to stderr as stderr, so it is not mistaken for a JSON parse failure of intake.

Scenario: gh exits nonzero with empty stdout

  • WHEN A unit test gives GitHubRoadmapStore.create_issue a fake gh result of exit 1, empty stdout and stderr unexpected end of JSON input.
  • THEN The test asserts the error text contains stderr: unexpect and not GitHub returned malformed issue after it was opened.

Requirement: Empty stderr is explicit

The error for a failed gh issue create SHALL state when the stderr of gh is empty.

Scenario: gh fails with no stderr

  • WHEN A unit test gives GitHubRoadmapStore.create_issue a fake gh result of exit 1 and empty stdout and stderr.
  • THEN The test asserts the error text contains stderr: (empty).

Requirement: Full title in the intake summary

The intake failure summary SHALL name a candidate with the complete title that intake sent.

Scenario: A new candidate with a long title fails to file

  • WHEN A unit test runs intake_candidate with confirm=True for a new candidate whose title is longer than 80 characters, and the store's create_issue raises GitHubOperationError.
  • THEN The test asserts the intake failure text contains the complete title and not the title cut to 80 characters.

Existing Tool Considered

No open, maintained tool or library covers this need. The alternatives check of 2026-11-16 searched for a library that reports a failed gh command with its stderr and the full title and found none. The closest, plumbum's ProcessExecutionError, carries argv, stdout, stderr and the return code, but the project already receives the same fields from subprocess.CompletedProcess (src/devops_cli/roadmap/stores/github_store.py:1326), so it lacks only what this change adds: the intake action, the full title and the 256-character bound. No new component is built; the change edits _failure and create_issue. The written cost is about 2,000 tokens and under one hour.

Key questions

  • Should intake parse the stdout of gh issue create when the command exits nonzero?: No. GitHubRoadmapStore._write already checks proc.returncode first (src/devops_cli/roadmap/stores/github_store.py:1326) and returns stdout only after exit 0 (:1330); _validate parses it only after that (:1415). The unexpected end of JSON input in the issue is gh's own stderr, which _failure puts into the message (:1442-1447), not an intake JSON parse: an intake parse failure would read GitHub returned malformed issue after it was opened (:1419-1422). The change keeps the exit-code check and adds no second parse path. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py:1326, src/devops_cli/roadmap/stores/github_store.py:1328, src/devops_cli/roadmap/stores/github_store.py:1415, src/devops_cli/roadmap/stores/github_store.py:1447]
    • Rejected: Parse stdout first and add stderr to the JSON error. It hides the real gh failure and raises unexpected end of JSON input on empty stdout.
    • Chosen: Check the exit code first, then parse stdout. The store already does this (github_store.py:1328, :1415), so a failed gh call reports its stderr before any JSON parse.
  • What text must the intake write error show for a failed gh issue create?: It must show the full issue title, the gh api -X POST repos/<repo>/issues command, the exit code, and gh's stderr labelled as stderr, or stderr: (empty) when gh wrote none. The store error is built in _failure (github_store.py:1447), and the intake summary must not cut the title again (intake.py:462). (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py:975, src/devops_cli/roadmap/stores/github_store.py:1447, src/devops_cli/roadmap/intake/intake.py:462, openspec/specs/roadmap-intake-failures/spec.md:9]
    • Rejected: Keep the 64-character title and add stderr. The cut title does not show what intake sent, and the intake summary still hides the title (intake.py:462).
    • Rejected: Show the full title and stderr but omit the command. The issue asks for the command, and the command distinguishes this create write from the store's other writes.
    • Chosen: Show the full title, command, exit code and stderr. It gives the cause and the exact request, as the issue's expected behavior asks, within the existing 256-character bound.
  • How should the error name the gh command without printing the issue body?: Name the subcommand and endpoint, gh api -X POST repos/<repo>/issues, and stop before the first -f, -F or --input field value. The field values carry the title, body and labels; printing them would make the error long, could expose the body, and would push gh's stderr past the 256-character bound. (best practice) [sources: src/devops_cli/roadmap/stores/github_store.py:620, src/devops_cli/roadmap/stores/github_store.py:1447, src/devops_cli/security/sanitizer.py:551]
    • Rejected: Print the whole gh argv, including -f body=.... The body can be long and may hold sensitive text, and the field values would push stderr past the 256-character bound.
    • Chosen: Print the subcommand and endpoint only. It names the command and keeps the error short, while the full title is shown separately.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  2. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches for the need (an intake error that names the gh command, its stderr and the untruncated title when gh issue create fails) returned no relevant tool or library: the results were unrelated pages and near-miss packages (e.g. a subprocess-tee build repo) that do not surface gh's stderr or the full title. The change is an internal fix to intake's own error formatting and JSON parse of gh output, so no external tool covers it.

    Tool: none found

    Lacks:

    • No tool found that reports the failed gh command and its stderr
    • No tool found that keeps the full, untruncated title in the intake write error
    • The fix is to intake's own GitHubOperationError/JSON handling, not a third-party library

    Searches run:

    • python library capture stderr and command line in subprocess error message, results: 5
    • python wrapper around gh CLI that reports stderr on failure, results: 5
    • python plumbum sh subprocess library include stderr in exception message, results: 5
    • GitHub CLI gh issue create returns empty JSON "unexpected end of JSON input", results: 5
    • subprocess-tee pypi, results: 5
    • python gh CLI wrapper github operations error, results: 5
    • plumbum python library command execution ProcessExecutionError stderr, results: 5
    • GitHubOperationError devops-cli intake, results: 5
    • how to show full command and stderr in Python exception on failed subprocess, results: 5
    • githubkit python library pypi, results: 5

    Sources:

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  5. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 3f422ad (see proposed design in issue body).

  7. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 18, 2026
  8. removed
    status/in-review
    on Nov 18, 2026
  9. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 16:28 UTC

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

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions