Skip to content

DEP-4368: Add CI logs output modes#499

Merged
121watts merged 1 commit intomainfrom
watts/dep-4368-ci-logs-output-modes
May 5, 2026
Merged

DEP-4368: Add CI logs output modes#499
121watts merged 1 commit intomainfrom
watts/dep-4368-ci-logs-output-modes

Conversation

@121watts
Copy link
Copy Markdown
Contributor

@121watts 121watts commented May 4, 2026

Summary

  • Add depot ci logs --timestamps for historical and follow output while keeping default plain output unchanged.
  • Add canonical --output json / -o json NDJSON output with line, follow status, and follow end events.
  • Expose a metadata-aware CI log stream callback in pkg/api while preserving the existing raw writer wrapper.

Validation

  • go test ./pkg/cmd/ci ./pkg/api
  • go test ./...
  • go vet ./pkg/cmd/ci ./pkg/api
  • git diff --check
  • Rebased onto main after PR feat(ci): follow live job logs #498 and preserved the log follow cancellation/deadline fixes.

Post-Deploy Monitoring & Validation

No additional production monitoring required. This is a CLI-only output formatting change with no backend, proto, database, or runtime service changes.

Release validation should smoke-test:

  • depot ci logs <attempt-id> --timestamps
  • depot ci logs <attempt-id> -o json
  • depot ci logs <job-id> --follow -o json

Healthy signals: default logs remain raw body lines, timestamped logs use UTC RFC3339/RFC3339Nano prefixes, JSON output is valid NDJSON, and follow JSON stdout contains only JSON events.

Failure signals: human spinner/status text appears on JSON stdout, line events are missing metadata fields, duplicate replayed lines appear after reconnect, or plain default output changes. Mitigation is to revert this CLI change or pin the previous CLI release.

Validation window and owner: first CLI canary/release smoke by the CLI release owner.

Generated with Codex via the Compound Engineering workflow.


Note

Medium Risk
Medium risk because it changes ci logs streaming/output behavior and introduces new callback-based streaming APIs that could affect log consumption and error propagation, though the default plain output path is intended to remain unchanged.

Overview
Adds new output modes to depot ci logs: --timestamps prefixes plain lines with UTC RFC3339Nano timestamps, and --output json emits NDJSON events (log lines with metadata, status updates while following, and a final end event) while suppressing all human/spinner messages.

Refactors CI log streaming in pkg/api by introducing CIStreamJobAttemptLogLines (metadata + error-returning callbacks with duplicate suppression) and re-implementing CIStreamJobAttemptLogs as a thin writer wrapper. Job target resolution is also made non-interactive when JSON output is selected to avoid prompts.

Reviewed by Cursor Bugbot for commit 3135817. Bugbot is set up for automated code reviews on this repo. Configure here.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 4, 2026

@121watts 121watts deleted the branch main May 5, 2026 15:35
@121watts 121watts closed this May 5, 2026
@121watts 121watts reopened this May 5, 2026
@121watts 121watts changed the base branch from watts/dep-4262-live-log-streaming to main May 5, 2026 15:38
@121watts 121watts force-pushed the watts/dep-4368-ci-logs-output-modes branch from ffa6806 to 6f6c0fa Compare May 5, 2026 15:46
@121watts 121watts marked this pull request as ready for review May 5, 2026 15:47
@121watts 121watts force-pushed the watts/dep-4368-ci-logs-output-modes branch 2 times, most recently from 589f0af to 7356426 Compare May 5, 2026 16:10
Comment thread pkg/api/ci.go Outdated
Comment thread pkg/cmd/ci/logs.go
Address PR feedback by using step_key in JSON output, disabling interactive job selection for JSON logs, and clarifying CI log stream target validation.
@121watts 121watts force-pushed the watts/dep-4368-ci-logs-output-modes branch from 7356426 to 3135817 Compare May 5, 2026 17:04
@121watts 121watts merged commit 77e3f37 into main May 5, 2026
14 checks passed
@121watts 121watts deleted the watts/dep-4368-ci-logs-output-modes branch May 5, 2026 17:19
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