Skip to content

[WIP] Standardize stderr usage for console output in workflow package#11041

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/standardize-stderr-usage
Closed

[WIP] Standardize stderr usage for console output in workflow package#11041
Copilot wants to merge 1 commit intomainfrom
copilot/standardize-stderr-usage

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Plan: Standardize stderr usage for console output in workflow package

  • Identify all occurrences of fmt.Println(console.Format...) in workflow package (12 occurrences found)
  • Fix pkg/workflow/stop_after.go - 8 occurrences (lines 81, 83, 90, 103, 105, 332, 334, 352, 354)
  • Fix pkg/workflow/engine_firewall_support.go - 2 occurrences (lines 72, 100)
  • Fix pkg/workflow/mcp-config-custom.go - 1 occurrence (line 125)
  • Run unit tests to validate changes (make test-unit)
  • Run full test suite to ensure no regressions (make test)
  • Run make agent-finish for complete validation

Total: 12 occurrences across 3 files that need to be changed from fmt.Println(console.Format...) to fmt.Fprintln(os.Stderr, console.Format...)

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Standardize stderr usage for console output in workflow package</issue_title>
<issue_description>### Description

Standardize console output to use fmt.Fprintln(os.Stderr, ...) instead of fmt.Println(...) in the workflow package (~15 occurrences) to ensure consistent output handling and prevent issues with piped/redirected output.

Problem

Current State:

  • ~15 occurrences of fmt.Println(console.Format...) in workflow package
  • Output goes to stdout instead of stderr
  • Inconsistent with codebase guidelines in AGENTS.md
  • Can break when output is piped or redirected

Why it's problematic:

  • All user-facing output should go to stderr (except JSON output)
  • Current pattern: fmt.Println(console.FormatInfoMessage(...))
  • Correct pattern: fmt.Fprintln(os.Stderr, console.FormatInfoMessage(...))
  • Breaks piping and redirection expectations

Suggested Changes

Update all console output calls to use stderr:

// ❌ CURRENT - Output to stdout
fmt.Println(console.FormatInfoMessage("Refreshed stop-after time"))

// ✅ CORRECT - Output to stderr
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Refreshed stop-after time"))

Files Affected

Approximately 15 occurrences across:

  • pkg/workflow/stop_after.go (lines 81-354)
  • pkg/workflow/engine_firewall_support.go (line 72)
  • pkg/workflow/mcp-config-custom.go
  • Other workflow package files

Success Criteria

  • All fmt.Println(console.Format...) calls changed to fmt.Fprintln(os.Stderr, console.Format...)
  • Consistent stderr usage across workflow package
  • All existing tests pass: make test
  • Output correctly appears in stderr (not stdout)
  • Follows guidelines documented in AGENTS.md

Implementation Strategy

  1. Identify all occurrences: grep -r "fmt.Println(console\\.Format" pkg/workflow/
  2. Replace pattern systematically file by file
  3. Test each file after changes
  4. Run full test suite to ensure no regressions

Source

Extracted from Terminal UI Analysis: Console Output Patterns discussion githubnext/gh-aw#10958

Priority

Medium - Improves output consistency and prevents piping issues

Estimated Effort

Medium - 1-2 hours to fix ~15 occurrences and test

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 4, 2026, 2:09 PM UTC

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Standardize stderr usage for console output in workflow package

3 participants