Skip to content

logs --adoption: record per-run lifecycle evidence failures instead of aborting the batch - #79258

Merged
mnkiefer merged 6 commits into
mainfrom
copilot/fix-logs-adoption-error
Nov 19, 2026
Merged

mnkiefer merged 6 commits into
mainfrom
copilot/fix-logs-adoption-error

Conversation

@mnkiefer

@mnkiefer mnkiefer commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

When one run's lifecycle session (aw_session.jsonl) lacked its format or execution identity, gh aw logs --adoption / --delivery failed the whole invocation with evaluate adoption for run N: … and produced no JSON. Isolating the run and retrying re-downloaded everything else; in the pilot this took about 1,300 API requests instead of about 300.

This PR records the failure on the affected run and keeps evaluating the rest of the batch.

"adoption_errors": [
  {"run_id": 44062786863, "reason": "lifecycle_identity_missing",
   "error": "lifecycle session is missing its format or execution identity"}
]

Error classification (logs_lifecycle_evidence.go, logs_outcomes.go)

  • Identity error: a new sentinel errLifecycleIdentityMissing, with the same message as before.
  • Per-run wrapper: lifecycleEvidenceError{reason, err} wraps only the readLifecycleItems error in collectRunLifecycle. It supports Unwrap, so errors.Is still matches the original error.
  • Reasons:
    • lifecycle_identity_missing for a missing format or execution identity.
    • lifecycle_evidence_invalid for everything else that is per-run: identity/repo/host mismatch, malformed JSON, oversized file, manifest decode or I/O errors.
  • Still fatal: context cancellation and deadline errors pass through unwrapped. Cache lock/load/merge/write and observeLifecycle errors are unchanged.

Batch behaviour (collectLogsLifecycles)

  • Classified error: the run's report gets:
    • unavailable coverage on both adoption and delivery
    • eval_error set
    • a stderr warning
  • Retained data: manifest items are discarded and the retained cache isn't consulted, so the coverage gap stays explicit.
  • No JSONL: no adoption JSONL file is written for the failed run.
  • Everything else keeps the existing behaviour: evaluate adoption for run %d: %w.
  • Single-run callers (audit, experiments) still receive the error as before.

Output

  • New field: adoption_errors (json:",omitempty") on LogsData and CrossRunAuditReport, filled in attachLogsOutcomes and copied into the cross-run render.
  • Modes: filled in both --delivery and --adoption, including logs episode.
  • runs[] still contains the failed run.
  • Schema: schemas/logs.schema.json regenerated.
  • Not listed: runs with no evidence at all keep their existing unavailable coverage and are not listed in adoption_errors.

Docs/spec

  • Updated: reference/delivery-adoption.md, setup/cli.md, specs/safe-output-lifecycle.md.
  • New MUST: logs records the failure in adoption_errors and continues with the other runs.

Other

  • Lint suppression: a one-line //nolint:ignoredlocalerror on an existing, intentional fail-open discard (GetCurrentRepoSlug) in logs_report.go. The change-scoped lint gate flags any diagnostic in a touched file.

Test

  • TestLogsOutcomeRunEvidenceErrorsDoNotAbortBatch: four runs (no session, header-only, mismatched identity, valid), run in both delivery and live modes.
  • Assertions:
    • per-run reports and stderr warnings
    • adoption JSONL written only for healthy runs
    • JSON and cross-run JSON output
    • unchanged single-run error

mnkiefer and others added 3 commits November 19, 2026 12:29
…atisfy custom lint gate

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@mnkiefer mnkiefer changed the title [WIP] Fix logs adoption error when a run lacks lifecycle identity logs --adoption: record per-run lifecycle evidence failures instead of aborting the batch Nov 19, 2026
@mnkiefer

Copy link
Copy Markdown
Collaborator Author

@copilot Fix failing checks

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix failing checks

Fixed the org-rollout result framing failures and restored the unrelated workflow change in commit 4892245. The focused regression tests and impacted Go tests passed.

@mnkiefer
mnkiefer marked this pull request as ready for review November 19, 2026 14:37
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 14:37
@mnkiefer

Copy link
Copy Markdown
Collaborator Author

@copilot Resolve conflicts

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.

🔵 Needs a closer look

Interacting changes to batch failure handling, cache bypass, reporting coverage, and rollout subprocess-result acceptance affect operational and trust-boundary contracts beyond the limited-consequence review scope.

No open issues 🎉

What changed in this PR

This PR addresses #79254 by keeping gh aw logs --adoption and --delivery batches running when an individual run has invalid lifecycle evidence, preserving results for the remaining runs.

Changes:

  • Records per-run evidence failures in adoption_errors with unavailable coverage while preserving fatal errors.
  • Adds JSON output support, schema updates, documentation, and regression coverage.
  • Separately tightens rollout worker result validation to reject trailing output.
File Description
specs/​safe-output-lifecycle.md Requires per-run error reporting and continued batch evaluation.
schemas/​logs.schema.json Adds adoption_errors to output schemas.
pkg/​cli/​org_rollout.go Rejects worker results followed by trailing output.
pkg/​cli/​org_rollout_test.go Covers trailing output without a newline.
pkg/​cli/​logs_report.go Adds the errors field and documents an intentional lint suppression.
pkg/​cli/​logs_outcomes.go Classifies evidence failures and records them without aborting batches.
pkg/​cli/​logs_outcomes_test.go Covers mixed-validity batches, warnings, JSON, and single-run errors.
pkg/​cli/​logs_orchestrator_render.go Copies adoption errors into cross-run output.
pkg/​cli/​logs_lifecycle_evidence.go Introduces a sentinel for missing lifecycle identity.
pkg/​cli/​audit_cross_run.go Exposes adoption errors in cross-run reports.
docs/​src/​content/​docs/​setup/​cli.md Documents continued processing after evidence failures.
docs/​src/​content/​docs/​reference/​delivery-adoption.md Describes error fields, reasons, and unavailable coverage.

Review effort: Balanced (adaptive)

…tion-error

# Conflicts:
#	pkg/cli/org_rollout.go
#	pkg/cli/org_rollout_test.go

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot Resolve conflicts

Merged refreshed main and resolved the rollout conflicts in 9f1f777b. Focused lifecycle and rollout tests pass; CI checks for the updated PR commit are running.

@mnkiefer
mnkiefer merged commit 400c5cc into main Nov 19, 2026
80 checks passed
@mnkiefer
mnkiefer deleted the copilot/fix-logs-adoption-error branch November 19, 2026 15:48
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.

logs --adoption: one run without lifecycle identity aborts the whole batch

3 participants