Skip to content

[deep-report] Remove hidden context.Background() in github_cli.go wrappers and log-parsing chain #66258

Description

@github-actions

Description

Several call sites hide context.Background() behind non-context wrapper functions or root their own context instead of accepting one from a caller, confirmed by direct read:

  • pkg/workflow/github_cli.go:105,190,212 — setupGHCommand, and gh-command helpers call context-aware variants (RunGHContext, RunGHCombinedContext) but hardcode context.Background() instead of taking a ctx parameter.
  • pkg/cli/logs_parsing_javascript.go:65-76 — three call sites to runSessionParser(WithSources) all pass context.Background() directly.
  • pkg/cli/logs_parsing_persisted.go:40,52 — same pattern.
  • copilot_agents.go:202, experiments_command.go:335, branch_file_reader.go:19 — additional single-site instances.

Repo-wide, there are ~58 production context.Background() calls (grep -rn "context\.Background()" --include="*.go" pkg/ | grep -v _test.go); this issue targets the subset that sit in call chains that already have a cmd.Context() or caller ctx available but don't plumb it through.

Expected Impact

Reduces hidden un-cancellable roots in commonly-hit code paths (gh CLI wrapper helpers, log parsing); the context-aware variants already exist, so this is wiring, not new design.

Suggested Fix

Add a ctx context.Context parameter to the non-context wrappers in github_cli.go (deprecate or remove the bare variants once callers migrate), and thread cmd.Context() down through logs_parsing_javascript.go / logs_parsing_persisted.go to their runSessionParser calls.

Acceptance Criteria

  • Listed call sites accept and propagate a caller-supplied ctx instead of context.Background()
  • make test-unit passes

Suggested Agent

Go-focused agent familiar with pkg/workflow/github_cli.go and the CLI command tree.

Estimated Effort

Medium (1-4 hours) — mechanical but touches several files.

Data Source

Repository Quality: Context Propagation & Cancellation Hygiene — 2026-10-06 (#66149), Task 3.

Generated by 🔬 Deep Report · claude · agent · 421.8 AIC · ⌖ 9.14 AIC · ⊞ 7.1K · ◷

  • expires on Oct 8, 2026, 10:47 AM UTC-08:00

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 21.7 AIC · ⌖ 8.13 AIC · ⊞ 12.7K · ◷

  2. github-actions commented on Oct 8, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-10-08T18:47:05.559Z.

    Closed by Workflow

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions