Skip to content

Make entire "why" deterministic across clones and surface actionable checkpoint-metadata miss reasons#1552

Open
karthik-rameshkumar wants to merge 3 commits into
entireio:mainfrom
karthik-rameshkumar:copilot/fix-non-deterministic-output
Open

Make entire "why" deterministic across clones and surface actionable checkpoint-metadata miss reasons#1552
karthik-rameshkumar wants to merge 3 commits into
entireio:mainfrom
karthik-rameshkumar:copilot/fix-non-deterministic-output

Conversation

@karthik-rameshkumar

Copy link
Copy Markdown
Contributor

This pull request enhances the attribution "why" functionality by providing more informative error messages and metadata when checkpoint metadata is missing. It introduces a new field to capture the reason for missing metadata, ensures this reason is propagated through the codebase, and improves both the human and JSON output to include actionable suggestions for remediation. Several new tests are added to verify these behaviors.

Improvements to missing metadata handling:

  • Added a MetadataMissingReason field to both attributionLine and attributionCheckpointContext structs to store detailed reasons when checkpoint metadata is missing. [1] [2]
  • Implemented the metadataMissingReason function to generate actionable and descriptive messages, including suggested commands to fetch missing metadata.
  • Updated the attribution resolver and related code paths to set and propagate the MetadataMissingReason field when metadata is unavailable, including after failed remote fetch attempts. [1] [2] [3]

User-facing output improvements:

  • Enhanced both the human-readable and JSON output of the attribution "why" command to display the MetadataMissingReason when available, giving users clearer guidance on how to resolve missing metadata issues. [1] [2]

Testing enhancements:

  • Added comprehensive tests to verify that the missing metadata reason is included in outputs and that checkpoint maps remain stable across successive calls. [1] [2]

@karthik-rameshkumar karthik-rameshkumar requested a review from a team as a code owner June 28, 2026 14:23
Copilot AI review requested due to automatic review settings June 28, 2026 14:23
@karthik-rameshkumar karthik-rameshkumar changed the title Make entire why deterministic across clones and surface actionable checkpoint-metadata miss reasons Make entire "why" deterministic across clones and surface actionable checkpoint-metadata miss reasons Jun 28, 2026

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.

Pull request overview

This PR improves entire why attribution diagnostics when checkpoint metadata can’t be resolved locally by adding a structured “missing reason” field, propagating it through attribution resolution, and surfacing it in both human-readable and JSON outputs. It also changes entire why to attempt the same remote-refresh path as entire checkpoint explain when metadata is missing, and adds tests covering the new behavior.

Changes:

  • Add metadata_missing_reason to per-line (attributionLine) and per-checkpoint (attributionCheckpointContext) attribution payloads and propagate it through resolution and rendering.
  • Enable fetch-on-miss in the entire why path so missing metadata triggers the remote enrichment attempt.
  • Add tests validating the reason appears in outputs and that checkpoint maps remain stable across successive calls.
Show a summary per file
File Description
cmd/entire/cli/attribution.go Adds missing-metadata reason plumbing and display; enables fetch-on-miss for entire why.
cmd/entire/cli/attribution_test.go Adds coverage for missing-reason propagation and stable checkpoint-map behavior.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines +223 to +225
// entire why is explanation-focused: when local metadata is missing it
// should attempt the same remote enrichment path as checkpoint explain.
result, err := resolveFileAttribution(ctx, file, true)
Comment on lines 420 to 423
if err != nil {
ctx.MetadataMissing = true
ctx.MetadataMissingReason = metadataMissingReason(r.ctx, cpID.String(), err)
return ctx
if line == nil || len(line.Candidates) == 0 {
return nil
func metadataMissingReason(ctx context.Context, checkpointID string, cause error) string {
reason := "checkpoint metadata was not found locally"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants