Skip to content

gh project item-add suppresses success output when stdout is not a TTY #14055

Description

@zwick

Describe the bug

gh project item-add exits successfully but prints no confirmation when stdout is not a TTY. This makes successful automation and agent-driven calls indistinguishable from a command that produced no useful result.

The command currently gates its success message on IsStdoutTTY():

func printResults(config addItemConfig, item queries.ProjectItem) error {
	if !config.io.IsStdoutTTY() {
		return nil
	}

	_, err := fmt.Fprintf(config.io.Out, "Added item\n")
	return err
}

Steps to reproduce

Run gh project item-add with stdout redirected or through a non-TTY command runner:

gh project item-add <project-number> --owner <owner> --url <issue-url> >output.txt

The item is added and the command exits 0, but output.txt is empty.

Expected behavior

A successful non-TTY invocation should emit a terse, stable confirmation, ideally including the added project item identifier. Structured output via --format json remains available when callers need the full item.

Impact

This causes agents and automation to retry an already-successful mutation because they cannot observe success. In repeated Copilot CLI evaluations, the same one-line task varied from 2 tool calls to 9 tool calls; the expensive runs repeatedly invoked gh project item-add after the first call had already succeeded.

Activity

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

    enhancementa request to improve CLIgh-projectrelating to the gh project command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions