Skip to content

Add streaming JSONL output to gh aw logs - #77304

Merged
pelikhan merged 5 commits into
mainfrom
pelikhan/logs-jsonl-output
Nov 13, 2026
Merged

pelikhan merged 5 commits into
mainfrom
pelikhan/logs-jsonl-output

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CLI consumers currently have to wait for the full logs report before parsing results. Add gh aw logs --format jsonl so they can consume progress and processed run data during collection.

  • Stream typed progress, run, warning, summary, and completion/error events across discovery, multi-workflow, and stdin modes, including cache hits and empty results.
  • Serialize concurrent writes without buffering, cancel collection on output failures, and retain final aggregates and continuation metadata in the summary event.
  • Preserve existing output modes and document the event contract. JSONL is selected only through --format jsonl; no standalone flag is added.

The final summary is authoritative: streamed runs do not yet include cross-run analysis or live outcomes. Human diagnostics remain on stderr.

ADR: ADR-77304: Stream JSONL Output from the Logs Command

Validation

  • go test ./pkg/cli -run '^Test(LogsJSONL|NewLogsCommand)$|^TestLogsJSONL' -count=1
  • Focused logs regression tests with the race detector, including a blocked-download test proving run records arrive before batch completion.
  • make agent-report-progress-no-test
  • make build
  • golangci-lint run ./pkg/cli (0 issues)
  • make check-workflow-drift (365 workflows compiled; no drift)
  • Verified the built CLI emits parseable JSONL using --stdin --format jsonl.

Impacted unit tests passed during the final gate. Initial lint findings were corrected and the affected checks rerun; custom analyzers have no diagnostics in changed files, with unrelated baseline diagnostics remaining elsewhere.

Review fixes also passed focused race-enabled JSONL, stdin empty-result, and Harbor tests. Harbor tests use a canonical temporary directory on macOS because /var is a symlink; build, lint, and workflow drift checks were rerun after the fixes.

@pelikhan
pelikhan marked this pull request as ready for review November 13, 2026 01:30
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 01:30
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Specification Reviewer · gpt56 · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #77304

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 182 · ◷

Generated by Ponytail Reviewer for #77304

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/77304-stream-jsonl-output-from-logs-command.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 the missing sections. Add context the AI could not infer, refine the decision rationale, and list real alternatives you considered.

  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-77304: Stream JSONL Output from the Logs Command (link unavailable: invalid HTTPS URL)

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)?

ADRs are stored in docs/adr/ as Markdown files, numbered by PR number (for example, 77304-stream-jsonl-output-from-logs-command.md).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
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 /diagnosing-bugs, /codebase-design, and /grill-with-docs. Skill selection used the fallback heuristic because the triage step was not run. The JSONL-focused tests pass under go test -race, and the core design holds up: the stream is mutex-guarded, the first write error cancels collection, and the multi-target path does not emit a duplicate summary. Three items remain.

📋 Key Themes & Highlights

Key Themes

  • Cancellation reported as failure: a cancelled run emits progress with stage: failed, not skipped (inline comment on logs_format_jsonl.go).
  • Duplicated stdin summary logic: two identical opts.JSONOutput || stream != nil blocks (inline comment on logs_orchestrator_stdin.go).
  • Docs contract gap: the docs promise a summary for empty results, but an all-targets-failed run ends without one (inline comment on logs_multi.go).

Positive Highlights

  • ✅ Run events are emitted during collection, and tests check that they arrive before the batch finishes.
  • ✅ Count parity between streamed run events and the final report is tested (TestLogsJSONLRunMatchesFinalReportCounts).
  • ✅ The stdin stream path reuses appendProcessedWorkflowRuns, so it keeps parse handling and cache writes.
  • ✅ The ignoredlocalerror suppression on splitLogsATIFError carries a clear justification.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/cli/logs_multi.go Resolved
Comment thread pkg/cli/logs_orchestrator_stdin.go Resolved
Comment thread pkg/cli/logs_format_jsonl.go Resolved

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.

🟡 Changes recommended

Streamed runs can expose work-queue details excluded by the selected artifact scope, while misclassified skips and missing metadata-failure events make stdout status reporting unreliable.

4 open issues
What changed in this PR

Adds gh aw logs --format jsonl so CLI consumers can receive progress and processed runs during collection, followed by an authoritative final summary.

Changes:

  • Introduces typed JSONL events, synchronized writes, and cancellation on output failures.
  • Integrates streaming across discovery, multiple workflow targets, stdin, cache hits, and empty results.
  • Adds format validation, focused tests, and event-contract documentation.
File Description
pkg/​cli/​logs_run_download_concurrent.go Emits download progress for cache hits and worker results.
pkg/​cli/​logs_orchestrator.go Starts and finalizes discovery-mode streaming.
pkg/​cli/​logs_orchestrator_types.go Carries the stream through orchestration and rendering options.
pkg/​cli/​logs_orchestrator_stdin.go Streams stdin collection and handles empty summaries.
pkg/​cli/​logs_orchestrator_render.go Renders JSONL summaries and shares message-count updates.
pkg/​cli/​logs_orchestrator_download.go Emits discovery progress and accepted run records.
pkg/​cli/​logs_multi.go Shares streaming across workflow targets and emits warnings.
pkg/​cli/​logs_format_jsonl.go Implements event encoding, write synchronization, cancellation, and terminal events.
pkg/​cli/​logs_format_jsonl_test.go Covers flags, streaming timing, concurrency, summaries, and write failures.
pkg/​cli/​logs_command.go Exposes the format and rejects combination with --json.
docs/​src/​content/​docs/​setup/​cli.md Documents events and distinguishes streaming from the JSONL cache.

Review effort: Max (dynamic)

Comment thread pkg/cli/logs_format_jsonl.go Resolved
Comment thread pkg/cli/logs_format_jsonl.go Resolved
Comment thread pkg/cli/logs_orchestrator_stdin.go Resolved
Comment thread pkg/cli/logs_command.go Resolved
@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the generated ADR notice: reviewed and finalized the draft against the implementation, including concurrent streaming, cancellation, and failure semantics. The finalized ADR is linked in the PR description.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding this review status: no code change is needed for the progress notice itself. The actionable findings are addressed in their individual review threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the Test Quality Sentinel result: no change is requested by this reported_no_action notice. It is not being treated as proof of test coverage; the review fixes have their own focused regression checks.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the skills-review completion notice: the notice itself needs no code change. The three findings in the accompanying review are addressed individually in their inline threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the specification-review result: this reported_no_action notice contains no requested change. Streaming remains selected only with --format jsonl, and the documented event contract was checked against the review fixes rather than inferred from the bot status.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Regarding the Ponytail Reviewer result: no code change is needed because this notice reports no actionable finding. The concrete inline findings are handled separately, with focused validation of their fixes.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Accepted the ADR gate feedback: finalized ADR-77304 with Context, Decision, Alternatives Considered, and Consequences, and linked it in the PR description. It documents the --format jsonl selector, authoritative summaries, cancellation, and incomplete-stream limitations.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The generated ADR notice is already addressed: the draft has been finalized and linked in the PR description. No further change is needed for this repeated notice.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The review progress notice contains no actionable finding, so no additional change is needed. Concrete findings are addressed in their individual review threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The Test Quality Sentinel notice requests no change. Its no-action result is not being used as evidence that tests passed or changes were published.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The skills-review completion notice introduces no additional change request. The accompanying actionable findings were handled in their inline threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The specification-review notice reports no actionable finding. Validation and publication are established separately rather than inferred from that status.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The Ponytail Reviewer notice contains no requested change. Its no-action result is not proof of validation or publication.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The ADR gate request is accepted and already satisfied: the committed ADR has Context, Decision, Alternatives Considered, and Consequences and is linked in the PR description. No additional ADR edit is needed for this repeated request.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed the prior ADR response: the committed ADR documents concurrent streaming, cancellation, and failure handling and is linked in the PR description. This acknowledgment introduces no further change.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The prior status response remains correct: the progress notice itself needs no change. Actionable findings are tracked separately in their inline threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The prior test-status response introduces no additional requirement. A reported_no_action result is not treated as proof of test coverage or passing checks.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The prior skills-review response is an acknowledgment, not a new implementation request. The original findings were addressed in their individual review threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed the prior specification response: streaming still uses only --format jsonl, with no standalone alias. No additional change is requested by this acknowledgment.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

The prior Ponytail response remains applicable: the notice has no actionable finding. Concrete findings and their validation are handled independently.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

Confirmed the prior ADR resolution: the finalized, linked ADR contains all four sections and documents selector, summary, cancellation, and incomplete-stream semantics. This is already satisfied and needs no additional edit.

@pelikhan
pelikhan merged commit b311f66 into main Nov 13, 2026
85 checks passed
@pelikhan
pelikhan deleted the pelikhan/logs-jsonl-output branch November 13, 2026 02:33
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

2 participants