Skip to content

Add console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites#47108

Merged
pelikhan merged 8 commits into
mainfrom
copilot/deep-report-add-console-print-wrappers
Jul 22, 2026
Merged

Add console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites#47108
pelikhan merged 8 commits into
mainfrom
copilot/deep-report-add-console-print-wrappers

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

pkg/console exposed Format* helpers but no direct stderr print API, which led to widespread two-step fmt.Fprintln(os.Stderr, console.Format*(...)) patterns and inconsistent output routing ergonomics. This change introduces thin Print* wrappers and migrates the two largest offenders in CLI code.

  • Console output API consolidation

    • Added new stderr-oriented wrappers in pkg/console/print.go that mirror existing Format* helpers and centralize newline + destination handling (os.Stderr).
    • Includes wrappers for success/info/warn/error/command/progress/prompt/verbose/section/list/error-chain and related stderr-specific formatters.
  • Targeted migration in highest-volume files

    • Replaced two-step formatted stderr output in:
      • pkg/cli/mcp_inspect_mcp.go
      • pkg/cli/engine_secrets.go
    • Converted both direct Fprintln(..., console.Format*) and newline-wrapped Fprintf("\n%s\n", console.Format*) patterns to console.Print* while preserving message structure.
  • Docs + usage guidance alignment

    • Updated console package docs (pkg/console/doc.go, pkg/console/README.md) to prefer Print* for diagnostic stderr output.
  • Focused wrapper coverage

    • Added pkg/console/print_test.go to assert that new Print* wrappers emit expected formatted output to stderr.
// before
fmt.Fprintln(os.Stderr, console.FormatWarningMessage("No resources available"))

// after
_, _ = console.PrintWarningMessage("No resources available")

Run: https://github.com/github/gh-aw/actions/runs/29895667664

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · gpt54 8.82 AIC · ⌖ 8.78 AIC · ⊞ 5.5K ·
Comment /souschef to run again


run: https://github.com/github/gh-aw/actions/runs/29898890921

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · gpt54 10.6 AIC · ⌖ 9.49 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 21, 2026 15:53
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add console.Print wrappers to reduce stderr calls Add console.Print* stderr wrappers and migrate high-volume MCP/secrets callsites Jul 21, 2026
Copilot AI requested a review from pelikhan July 21, 2026 16:14
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category feature
Risk medium
Score 45 / 100
Action batch_review
Batch pr-batch:go-code

Score breakdown: Impact 22 · Urgency 12 · Quality 11

Draft PR adding console.Print* stderr wrappers in Go + tests + README. Medium risk (new API surface). No CI data yet. Batch with other Go code changes (see #47088).

Generated by 🔧 PR Triage Agent · sonnet46 43.3 AIC · ⌖ 5.33 AIC · ⊞ 5.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

This PR looks great! 🎉 The refactor consolidates stderr output ergonomics in the console package by introducing thin Print* wrappers and migrating the two highest-volume call sites (pkg/cli/mcp_inspect_mcp.go and pkg/cli/engine_secrets.go). This aligns perfectly with the project's focus on agentic development — the work is well-focused, includes comprehensive tests, and the PR body clearly explains the what and why.

Strengths:

  • Tests includedpkg/console/print_test.go provides assertions for new Print* wrappers
  • Focused changes — one goal (centralize stderr output), targeted migrations only
  • Clear documentation — PR body includes concrete before/after example and rationale
  • Agentic origin — authored by Copilot coding agent, following the project's core contribution model

This is ready for review by core team members!

Generated by ✅ Contribution Check · sonnet46 59 AIC · ⌖ 11.2 AIC · ⊞ 6.2K ·

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds stderr-oriented console printing helpers and migrates high-volume CLI callsites.

Changes:

  • Adds and tests console.Print* wrappers.
  • Migrates MCP inspection and secret-management output.
  • Updates usage documentation and a generated workflow permission.
Show a summary per file
File Description
pkg/console/print.go Adds stderr print wrappers.
pkg/console/print_test.go Tests wrapper output.
pkg/console/README.md Documents direct print helpers.
pkg/console/doc.go Updates package guidance.
pkg/cli/mcp_inspect_mcp.go Migrates MCP diagnostics.
pkg/cli/engine_secrets.go Migrates secret-management diagnostics.
.github/workflows/smoke-call-workflow.lock.yml Reduces an unrelated generated permission.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment thread pkg/console/print.go Outdated
Comment thread pkg/console/print.go Outdated
Comment on lines +14 to +15
func PrintSuccessMessage(message string) (int, error) {
return fmt.Fprintln(os.Stderr, FormatSuccessMessage(message))
Comment thread pkg/console/print.go Outdated
Comment on lines +74 to +75
func PrintErrorChain(err error) (int, error) {
return fmt.Fprintln(os.Stderr, FormatErrorChain(err))
Comment thread pkg/console/print_test.go Outdated
return string(out)
}

func TestPrintMessageHelpers(t *testing.T) {
# Review the called workflow's job-level permissions in ./.github/workflows/smoke-workflow-call.lock.yml.
permissions:
actions: write
actions: read
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 85/100 — Excellent

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 2, JS: 0)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (50%)
Duplicate clusters 0
Inflation No (1.01:1 ratio)
🚨 Violations 0
Test File Classification Issues
TestPrintMessageHelpers pkg/console/print_test.go:40 Behavioral contract (output verification) Happy-path only; no edge cases (empty strings, special chars)
TestPrintErrorChain pkg/console/print_test.go:65 Behavioral contract (error chain output) Wrapped error handling verified; return values ignored
📝 Notes
  • Build tag: ✅ Correctly placed (//go:build !integration)
  • Stderr capture helper: Well-designed helper function (captureStderr) reduces boilerplate
  • Return value handling: Both functions return (int, error) but tests ignore the error return; consider adding assertions for error returns in future tests
  • Coverage gaps: No validation of return values, no edge cases like empty strings or very long messages

Verdict

Passed. 0% implementation tests (threshold: 30%). No violations detected. Tests verify observable output behavior with proper stderr capture.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 9.38 AIC · ⌖ 7.66 AIC · ⊞ 7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: 85/100. 0% implementation tests (threshold: 30%). No violations detected.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: console.Print* stderr wrappers

Good consolidation overall — the intent of the PR is sound and the migration in engine_secrets.go and mcp_inspect_mcp.go is clean and consistent.

One blocking correctness issue was found in pkg/console/print.go:

Four Print* wrappers call the stdout-oriented Format* functions instead of their *Stderr counterparts:

Wrapper Currently calls Should call
PrintSuccessMessage FormatSuccessMessage (uses isTTY + applyStdoutStyleWithTTY) FormatSuccessMessageStderr
PrintInfoMessage FormatInfoMessage (uses isTTY + applyStdoutStyleWithTTY) FormatInfoMessageStderr
PrintSectionHeader FormatSectionHeader (uses isTTY + applyStdoutStyleWithTTY) FormatSectionHeaderStderr
PrintListItem FormatListItem (uses isTTY + applyStdoutStyleWithTTY) FormatListItemStderr

The stdout variants use isTTY (is stdout a terminal?) and apply colour-profile degradation via colorwriter.Degrade, which is only appropriate for stdout. When these wrappers write to os.Stderr, the styling decision is based on the wrong file descriptor — producing stray ANSI codes when stderr is redirected but stdout is a TTY, or plain output when stderr is a colour terminal but stdout is not.

The test expectations in print_test.go also need updating to reference the *Stderr format functions once print.go is fixed (inline comment posted there too).

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 40 AIC · ⌖ 5.42 AIC · ⊞ 5K

Comment thread pkg/console/print.go
// PrintInfoMessage formats and prints an info message to stderr.
func PrintInfoMessage(message string) (int, error) {
return fmt.Fprintln(os.Stderr, FormatInfoMessage(message))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong TTY check: use FormatSuccessMessageStderr instead of FormatSuccessMessage

PrintSuccessMessage writes to os.Stderr, but it calls FormatSuccessMessage which uses isTTY (stdout TTY check) and applyStdoutStyleWithTTY — correct only for stdout. For stderr output, call FormatSuccessMessageStderr which uses isStderrTTY and applyStyleWithTTY.

The same mistake affects three other wrappers:

  • PrintInfoMessage → should call FormatInfoMessageStderr
  • PrintSectionHeader → should call FormatSectionHeaderStderr
  • PrintListItem → should call FormatListItemStderr

When stdout is a TTY but stderr is not (or vice-versa), styling will be applied or stripped incorrectly, producing ANSI escape codes in redirected stderr or plain text when stderr is a colour terminal.

@copilot please address this.

Comment thread pkg/console/print_test.go
if stderr != want {
t.Fatalf("expected %q, got %q", want, stderr)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests validate against stdout Format* functions but Print* writes to stderr

The test assertions compare output against FormatSuccessMessage("ok"), FormatInfoMessage("info"), etc. — which use the stdout TTY check. Once the wrappers are corrected to call the *Stderr variants (see sibling comment on print.go), these comparisons will pass incidentally only when stdout and stderr have the same TTY status in the test environment, but they do not validate the actual contract.

After fixing print.go, update the expected strings to call FormatSuccessMessageStderr, FormatInfoMessageStderr, FormatSectionHeaderStderr, and FormatListItemStderr to match what the wrappers actually produce.

@copilot please address this.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (248 new lines in pkg/ directories) but did not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/47108-add-console-print-stderr-wrappers.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete any missing sections — add context the AI couldn't infer, refine the decision rationale, and verify the listed alternatives are accurate
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-47108: Add Print* Stderr Convenience Wrappers to the console Package

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 47108-add-console-print-stderr-wrappers.md for PR #47108).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 52.7 AIC · ⌖ 12.9 AIC · ⊞ 8.4K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design and /tdd — requesting changes on interface design and test completeness.

📋 Key Themes & Highlights

Key Themes

  • Interface noise: All 13 Print* wrappers return (int, error), but every call site discards those values with _, _ =. Void returns would be cleaner and more honest (see inline on print.go:14).
  • Incomplete test coverage: 7 of the 13 new wrappers have no test. The batched t.Fatalf style also hides failures past the first (see inline on print_test.go:40).
  • Test parallelism hazard: captureStderr mutates the global os.Stderr; parallel tests in the same package would race (see inline on print_test.go:22).
  • README example: code snippet omits _, _ = discards, making it invalid Go unless the signature is changed to void (see inline on README.md).

Positive Highlights

  • ✅ Clean, consistent wrapper layer — the abstraction is exactly the right shape.
  • ✅ Migration in engine_secrets.go and mcp_inspect_mcp.go is thorough and mechanical — great reduction in boilerplate.
  • ✅ Correct handling of the \n%s\nFprintln + Print* decomposition in displayServerCapabilities, preserving blank-line spacing.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 45.7 AIC · ⌖ 5.51 AIC · ⊞ 6.7K
Comment /matt to run again

Comment thread pkg/console/print.go Outdated
}

// PrintSuccessMessage formats and prints a success message to stderr.
func PrintSuccessMessage(message string) (int, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] All 13 Print* wrappers return (int, error), but every call site immediately discards them with _, _ =. If the return values are never meaningful to callers, making these functions return nothing (func PrintSuccessMessage(message string)) removes the noise and signals the intent more clearly — stderr writes failing silently is already an accepted trade-off at this layer.

💡 Suggested signature
func PrintSuccessMessage(message string) {
    fmt.Fprintln(os.Stderr, FormatSuccessMessage(message))
}

If surfacing the error to callers is ever needed in future, it's easy to add. Starting with a void return is a simpler, more honest interface.

@copilot please address this.

Comment thread pkg/console/print_test.go Outdated
return string(out)
}

func TestPrintMessageHelpers(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] TestPrintMessageHelpers batches 6 assertions in one test with t.Fatalf — the first failure hides all subsequent ones. Split into sub-tests (or use t.Errorf) so you can see all failures at once.

💡 Suggested pattern
cases := []struct{
    name string
    fn   func() (int, error)
    want string
}{
    {"success", func() (int, error) { return PrintSuccessMessage("ok") }, FormatSuccessMessage("ok")},
    // ...
}
for _, tc := range cases {
    t.Run(tc.name, func(t *testing.T) {
        got := captureStderr(t, func() { tc.fn() })
        if !strings.Contains(got, tc.want+"\n") {
            t.Errorf("want %q in stderr, got %q", tc.want, got)
        }
    })
}

@copilot please address this.

Comment thread pkg/console/print_test.go Outdated
return string(out)
}

func TestPrintMessageHelpers(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The test covers 6 of the 13 new Print* functions — PrintProgressMessage, PrintPromptMessage, PrintVerboseMessage, PrintListItem, PrintTableHeaderStderr, PrintErrorTextStderr, and PrintError have no test coverage. Add them to the table-driven test so regressions on any wrapper are caught.

@copilot please address this.

Comment thread pkg/console/README.md
console.PrintInfoMessage("Processing 3 files...")
console.PrintWarningMessage("Network access is unrestricted")
console.PrintErrorMessage("File not found: workflow.md")
console.PrintCommandMessage("gh aw compile workflow.md")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The README example drops the return-value discards (_, _ =) that every real call site uses. Either document the canonical call pattern including _, _ = (or a void form if the signature is simplified), so readers copy-paste a valid Go snippet.

@copilot please address this.

Comment thread pkg/console/print_test.go Outdated
if err != nil {
t.Fatalf("failed to create stderr pipe: %v", err)
}
os.Stderr = w

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] captureStderr reassigns the global os.Stderr. If tests run with t.Parallel() in the same package later, they will race on the global. Consider injecting an io.Writer into Print* functions (or at least document that these tests cannot be parallelised).

@copilot please address this.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES — Three issues need fixing before merge

The API design and test quality need corrections.

🔍 Key findings

High: Misleading (int, error) return signature

Every call site uses _, _ = console.Print*(), silently discarding both return values. The API implies callers should check errors but no one does. The functions should return nothing, which also eliminates the _, _ = noise throughout the codebase (~30 call sites).

High: captureStderr is a data race

os.Stderr is a package-level variable mutated without synchronization. Running tests with -race or in parallel will flag this. The root fix is to make Print* accept an io.Writer or use a package-level var stderr io.Writer = os.Stderr.

Medium: strings.Contains test assertions are too weak

TestPrintMessageHelpers batches all calls and checks the combined output with Contains. A copy-paste bug assigning the wrong Format* call to a wrapper would go undetected. Each wrapper should be tested in isolation with exact equality.

Medium: 7 of 13 new wrappers are untested

PrintTableHeaderStderr, PrintErrorTextStderr, PrintProgressMessage, PrintPromptMessage, PrintVerboseMessage, PrintListItem, and PrintError have no test coverage.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 57.1 AIC · ⌖ 5.03 AIC · ⊞ 5.6K
Comment /review to run again

Comment thread pkg/console/print.go Outdated
}

// PrintSuccessMessage formats and prints a success message to stderr.
func PrintSuccessMessage(message string) (int, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(int, error) return values are universally discarded — the API contract is misleading.

Every single call site uses _, _ = console.Print*(). If write errors are intentionally ignored, these functions should return nothing.

💡 Suggested fix

Change all Print* signatures to void:

// before
func PrintSuccessMessage(message string) (int, error) {
    return fmt.Fprintln(os.Stderr, FormatSuccessMessage(message))
}

// after
func PrintSuccessMessage(message string) {
    fmt.Fprintln(os.Stderr, FormatSuccessMessage(message)) (nolint/redacted):errcheck
}

This also eliminates the _, _ = noise at every call site.

Comment thread pkg/console/print_test.go Outdated
func TestPrintMessageHelpers(t *testing.T) {
stderr := captureStderr(t, func() {
_, _ = PrintSuccessMessage("ok")
_, _ = PrintInfoMessage("info")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race: captureStderr mutates the global os.Stderr without synchronization.

If tests run in parallel (or background goroutines write to stderr), this is a race condition that -race will flag.

💡 Suggested fix

Instead of swapping os.Stderr, accept an io.Writer in Print* functions (or use a package-level var stderr io.Writer) so tests can pass bytes.Buffer directly:

var stderr io.Writer = os.Stderr

func PrintSuccessMessage(message string) {
    fmt.Fprintln(stderr, FormatSuccessMessage(message))
}

Then in tests:

var buf bytes.Buffer
stderr = &buf
defer func() { stderr = os.Stderr }()
PrintSuccessMessage("ok")

This avoids touching OS-level file descriptors entirely.

Comment thread pkg/console/print_test.go
func TestPrintErrorChain(t *testing.T) {
err := errors.New("inner")
wrapped := fmt.Errorf("outer: %w", err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.Contains assertions cannot detect ordering errors, duplicate output, or wrong-function attribution.

If PrintSuccessMessage accidentally printed FormatInfoMessage's output (due to a copy-paste bug), this test would still pass because both strings are present somewhere in the combined capture.

💡 Suggested fix

Capture each Print* call individually and assert exact equality:

cases := []struct {
    fn   func()
    want string
}{
    {func() { PrintSuccessMessage("ok") }, FormatSuccessMessage("ok") + "\n"},
    {func() { PrintInfoMessage("info") }, FormatInfoMessage("info") + "\n"},
    // ...
}
for _, tc := range cases {
    got := captureStderr(t, tc.fn)
    if got != tc.want {
        t.Errorf("got %q, want %q", got, tc.want)
    }
}

Comment thread pkg/console/print_test.go
if stderr != want {
t.Fatalf("expected %q, got %q", want, stderr)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 of 13 new Print* wrappers have zero test coverage.

PrintTableHeaderStderr, PrintErrorTextStderr, PrintProgressMessage, PrintPromptMessage, PrintVerboseMessage, PrintListItem, and PrintError are not tested at all. A silent regression in any underlying Format* function (e.g., wrong argument passing) would go undetected.

💡 Suggested fix

Add table-driven test cases for each missing wrapper, following the same pattern as the existing tests. Since these wrappers are trivial one-liners, a single table-driven test covering all 13 is straightforward.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the remaining review feedback, and rerun checks once the branch is up to date.

Unresolved review threads (newest first):

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · gpt54 8.82 AIC · ⌖ 8.78 AIC · ⊞ 5.5K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 22, 2026 06:34
- Fix PrintError to use Fprint (FormatError already ends with \n)
- Add *Stderr-aware Format variants for Warning/Command/Progress/Prompt/Verbose
- Update all Print* wrappers to use *Stderr variants for correct styling
- Add FormatErrorChain and all missing *Stderr stubs to console_wasm.go
- Expand print_test.go to cover all 14 wrappers with exact newline assertions"

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the remaining review feedback, and rerun checks once the branch is up to date.

Unresolved review threads (newest first):...

Addressed all five review threads:

  1. PrintError double-newline – switched FprintlnFprint since FormatError already terminates with \n.
  2. Stdout-based styling on stderr – added *Stderr-aware format helpers (FormatWarningMessageStderr, FormatCommandMessageStderr, FormatProgressMessageStderr, FormatPromptMessageStderr, FormatVerboseMessageStderr) to console.go using applyStyleWithTTY(..., isStderrTTY), and updated all Print* wrappers to use them.
  3. WASM build break – added FormatErrorChain (and the other missing *Stderr stubs) to console_wasm.go; a comment explains the intentionally simplified chain rendering in the WASM context.
  4. Test coverage – replaced the single combined test with 14 individual tests, one per wrapper, each asserting the exact output including newline contract (PrintError vs the rest).
  5. smoke-call-workflow.lock.yml delta – the actions: write → read change is the correct compiler output: smoke-workflow-call.lock.yml already declares actions: read, so the caller must import the same value. Reverting would put the lock file out of sync with its source, which make check-workflow-drift rejects. The delta is intentional and correctly generated.

Copilot AI requested a review from gh-aw-bot July 22, 2026 06:38
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Unresolved review threads

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · gpt54 10.6 AIC · ⌖ 9.49 AIC · ⊞ 7K ·
Comment /souschef to run again

…tderr variable

- Change all Print* signatures from (int, error) to void — write errors
  on stderr are intentionally not surfaced at this diagnostic layer
- Add var stderr io.Writer = os.Stderr so tests can capture output
  via a bytes.Buffer without touching OS file descriptors
- Remove _, _ = prefix from all call sites in engine_secrets.go and
  mcp_inspect_mcp.go
- Update print_test.go to use the package-level stderr variable via
  captureStderr, removing the OS pipe approach and documenting the
  no-parallel constraint

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Unresolved review threads...

Addressed all remaining review threads:

  • Wrong TTY check / test comparisons (r3627789143, r3627789160) — already fixed in the prior push; Print* wrappers use *Stderr formatters and tests compare against Format*Stderr variants.
  • (int, error) return values discarded everywhere (r3627792857, r3627793085) — Print* functions are now void. All 67 _, _ = console.PrintX(...) call sites simplified to console.PrintX(...).
  • captureStderr data race (r3627792875, r3627793091) — replaced OS file-descriptor swapping with a package-level var stderr io.Writer = os.Stderr. Tests swap the variable (not os.Stderr), eliminating the OS-level race. Helper is documented as non-parallel-safe.
  • README return-value discards (r3627792872) — README already showed void-style calls; now consistent with the actual void signatures.
  • Batched tests / coverage gaps (r3627792864, r3627792867, r3627793095, r3627793098) — already fixed in prior push; 14 individual tests, each with exact-equality assertions against the correct *Stderr formatter output.

Commit: refactor(console): make Print* functions void and use package-level stderr variable

@pelikhan
pelikhan merged commit e03a9ec into main Jul 22, 2026
23 checks passed
@pelikhan
pelikhan deleted the copilot/deep-report-add-console-print-wrappers branch July 22, 2026 07:49
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[deep-report] Add console.Print* wrappers to eliminate 1,640 two-step stderr calls

4 participants