Repository navigation
feat(logs)!: require canonical episode identity and report coverage - #70277
Conversation
Preserve legacy selected-run root fields while exposing recorded canonical root claims, representative aliases, and conservative coverage evidence. Retain useful single-run metadata in compact JSON and propagate collection bounds independently from lineage confidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
Remove heuristic episode reconstruction and legacy root aliases. Preserve recorded roots, representative identity and conservative selected-run coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
…nture Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ PR Code Quality Reviewer completed the code quality review.
|
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (407 new lines in 📄 Draft ADR committed: The draft records the decision to add
📋 What to do next
Once an ADR is linked in the PR body, this gate will run again and check that the implementation matches the decision. ❓ Why ADRs MatterADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors, including your future self, can find the reasoning behind the code. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
There was a problem hiding this comment.
🟡 Changes recommended
Coverage can misclassify lineage evidence and repository identities, making its machine-readable results unreliable.
3 open issues
What changed in this PR
Adds episode root identity and selected-run coverage evidence to gh aw logs while preserving existing grouping and legacy fields.
Changes:
- Adds recorded roots, representative aliases, and coverage metadata.
- Exposes evidence in compact JSON, verbose text, and the generated schema.
- Adds regression tests and documents selection limits.
| File | Description |
|---|---|
| schemas/logs.schema.json | Defines new episode metadata. |
| pkg/cli/logs_report.go | Marks truncation and retains useful episode evidence. |
| pkg/cli/logs_orchestrator_render.go | Applies collection coverage signals. |
| pkg/cli/logs_format_compact.go | Displays root and coverage evidence. |
| pkg/cli/logs_episode.go | Integrates coverage into episode construction. |
| pkg/cli/logs_episode_rollup.go | Populates representative aliases. |
| pkg/cli/logs_episode_coverage.go | Computes root observations and coverage gaps. |
| pkg/cli/logs_episode_coverage_test.go | Tests coverage, selection, and rendering. |
| pkg/cli/logs_cached_json_test.go | Checks coverage from cached context. |
| docs/src/content/docs/setup/cli.md | Explains metadata and count limits. |
| docs/src/content/docs/reference/cost-management.md | Documents selected-run usage semantics. |
Review effort: Max
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design (primary) with /tdd as a secondary lens. Triage note: the pr-triage agent was not separately invoked; classification used the documented fallback heuristic against pr-meta.json/pr-diff.patch directly — this reads as a feature change (new representative_run_id, recorded_roots[], coverage{} fields), with logs_episode_coverage.go, logs_episode_coverage_test.go, and schemas/logs.schema.json as the highest-impact files by changed lines.
One actionable /codebase-design observation posted inline (duplicate collection-truncation trigger across two call sites — currently harmless due to addGap dedup, but a maintainability risk). Everything else here is solid, so approving with that single non-blocking note.
📋 Key Themes & Highlights
Key Themes
- Minor duplication risk:
markEpisodeCollectionTruncatedis invoked from bothbuildLogsData(logs_report.go:706-708, gated oncontinuation != nil) andapplyLogsCollectionCoverage(logs_episode_coverage.go:139-144, gated onlen(continuations) > 0 || countLimitReached). Both fire on the same request viaprepareLogsData. Not a bug today (dedup viaslices.ContainsinaddGapmakes it idempotent), but two independently-maintained trigger conditions for one flag is a navigability smell worth consolidating.
Positive Highlights
- ✅
RepresentativeRunID/RepresentativeWorkfloware introduced as explicit, test-verified compatibility aliases of the legacyRootRunID/PrimaryWorkflowfields — a clean, non-breaking renaming strategy per/codebase-design. - ✅
logs_episode_coverage_test.gois thorough TDD-style coverage: root presence/absence/conflict, invalid/overflow run IDs, legacy-context compatibility, reusable same-run hops, missing-parent dedup/sort, and multiple collection-truncation shapes, plus compact/verbose JSON round-trips. - ✅
logs_cached_json_test.goconfirms coverage fields are recomputed per-selection rather than served stale from cache — good regression guard. - ✅ Docs (
cost-management.md,cli.md) introduce the new vocabulary ("recorded roots", "representative run", coverage scope/status/reasons) with clear field tables — good/grill-with-docshygiene.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 153.4 AIC · ⌖ 16 AIC · ⊞ 10.1K
Comment /matt to run again
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Requesting changes
The new episode coverage metadata still has two correctness gaps: multi-target continuations currently downgrade unrelated episodes, and partial recorded-root claims are being dropped from the JSON surface.
Blocking themes
collection_truncatedis applied globally instead of only to the targets that actually returned a continuation.recorded_rootsloses workflow or repository evidence wheneverroot_run_idis absent, so the new machine-readable output can hide partial or conflicting lineage claims.
This was a static diff review only; I did not run the code or tests.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 100 AIC · ⌖ 7.67 AIC · ⊞ 12.7K
Comment /review to run again
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 2ccb3c8
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
… targets Validate same-run parent repositories and compare repository identities case-insensitively. Centralize collection coverage with scoped continuation and count-limit evidence, including mixed local and remote targets. Add regressions and finalize the canonical-only episode ADR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the concurrent case-insensitive repository matching and regression tests while retaining scoped selected-member collection bounds, direct-builder consistency and explicit unverified-root evidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
In response to the design gate status: the substantive ADR request is addressed by the finalized ADR-70277 and its link in the PR description. The ADR records the current canonical-only behavior rather than the superseded compatibility-only proposal. |
|
In response to the skills review status: no actionable change was requested by this status notice, so no additional implementation change is needed for it. The concrete correctness findings from the other reviews are handled separately in this batch. |
|
In response to the test-quality status: I did not treat |
|
In response to the Ponytail review status: this notice contains no actionable finding, so no separate code change is needed. The batch is validated locally rather than relying on the review's no-action outcome. |
|
In response to the code-quality review status: the substantive findings are addressed by target-scoped collection coverage and preservation of partial recorded-root claims. Each detailed inline thread has its own response and resolution. |
|
Accepted the ADR requirement. Finalized ADR-70277 and linked it in the PR body, including the explicit canonical-only breaking decision, alternatives, consequences and conservative coverage limits. |
|
In response to the saved review themes: both underlying findings are addressed, with collection bounds scoped to affected targets and partial root claims retained in |
|
Accepted the outstanding-work request: merged the latest main with |
|
🎉 This pull request is included in a new release. Release: |

Summary
Require recorded canonical episode identity and distinguish recorded root claims from selected-run representatives. The canonical-only revision follows the explicit request to remove legacy episode implementation; this is no longer an additive compatibility-only change.
context.episode_id. Remove synthetic standalone/call IDs, heuristic workflow-call/workflow-run reconstruction, legacy bridging and inferred grouping. Runs without canonical IDs remain in.runs[]and overall usage totals but do not produce episode rollups or edges.root_run_idandprimary_workflow. Userepresentative_run_idandrepresentative_workflowfor selected-data identity; userecorded_roots[]for distinct recorded rootrun_id,workflow_id,repositoryand run-levelobservedevidence. Missing roots are never silently replaced with descendants.coveragewithscope: selected_runs,status: unknown | partial, deterministic missing/invalid/conflicting/unverified-lineage reasons, sorted uniquemissing_parent_run_ids, andcollection_truncatedfrom existing continuation/count-limit inputs.Coverage is deliberately never complete. Observing all recorded roots/parents, finding no gaps, or exhausting a cursor cannot establish that unselected descendants, missing context or same-run reusable hops are absent. Collection truncation describes bounded collection evidence, not proof of additional members in any particular episode. Lineage confidence remains independent of coverage. The default count is still 10 even with date filters. No crawler, per-hop graph, lifecycle store or outcome dependency is introduced.
ADR: ADR-70277: Episode Root Identity and Selected-Run Coverage Evidence
Breaking changes / migration
Replace episode-level
root_run_id/primary_workflowlookups withrepresentative_run_id/representative_workflowwhen selected-run identity is intended, or inspectrecorded_roots[]for recorded logical-root claims. Consumers must no longer expect synthetic episode IDs or episode coverage for runs without recorded canonical IDs. Shared run-context fields and ordinary per-run/overall usage reporting remain available.Review fixes
Validation
make merge-mainmerged main through6dffa9ce2e, rebuilt, recompiled all 344 workflows and formatted successfully.make fmtand fullmake lintpassed. Existing JavaScript warnings are non-blocking; Go lint reported zero issues.make agent-report-progresspassed its Go lint, schema and impacted-test stages. Its custom function-length diagnostic was fixed, thenmake agent-report-progress-no-testpassed with a session-owned isolatedTMPDIR, including all custom linters and all 344 workflow drift checks.go test ./pkg/cli -run 'Test.*(Episode|Logs|SuggestedRoute|GeneratedOutputSchemasAreCurrent|GeneratedSchemasValidateRealOutput|Continuation|MergeLogsTargetResults)' -count=1and the no-test publication gate passed again.Published revision:
88cf5dc6fe101101541ed1a834182c4a06f34927. Prior CI checks passed or were skipped before this push; CI on the published revision remains unverified and was not manually triggered.