Skip to content

chore(weave): add structured fields when ref objects are not found#7200

Open
domphan-wandb wants to merge 2 commits into
masterfrom
dom/improve-error-handling-ref-object
Open

chore(weave): add structured fields when ref objects are not found#7200
domphan-wandb wants to merge 2 commits into
masterfrom
dom/improve-error-handling-ref-object

Conversation

@domphan-wandb

@domphan-wandb domphan-wandb commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

This PR surfaces the missing refs in a structured field, missing_digests. This PR allows for better error handling on the application when a batched read is made.

See accompanying FE PR for how the error gets surfaced on an eval table: https://github.com/wandb/core/pull/45716

When a run dies before the Weave SDK flushes all of its objects, refs_read_batch references objects the server doesn't have and fails the whole batch with a generic 404:
{ "reason": "Ref read contains 4 digests, but found 3 objects. Diff digests: {'aq4j…'}" }

The model evals client, reads every compared run's eval + model objects in one batch) can't tell which object is missing without scraping that human-readable string. This adds the missing digests as a structured field so clients can attribute the failure programmatically (we want to map a digest back to the run that referenced it) instead of parsing the message.

What changed

  • New RefObjectsNotFoundError(NotFoundError) carrying missing_object_digests: list[str].
  • Subclasses NotFoundError, so existing except NotFoundError callers and 404 handling are unaffected.

Response shape
Status code (404) and reason are unchanged; the only addition is the new field:

{
  "reason": "Ref read contains 4 digests, but found 3 objects. Diff digests: {'aq4j…'}",
  "missing_object_digests": ["aq4j…"]
}

Compatibility
Additive:

  • Existing clients that only read reason/status see no change.
  • RefObjectsNotFoundError is a NotFoundError, so type-based handling continues to work.

Testing

How was this PR tested?

  • Added a unit test.

@domphan-wandb domphan-wandb requested a review from a team as a code owner June 12, 2026 14:59
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
weave/trace_server/errors.py 60.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@domphan-wandb domphan-wandb force-pushed the dom/improve-error-handling-ref-object branch from 6e112fc to b4e5e74 Compare June 12, 2026 15:01
@wandbot-3000

wandbot-3000 Bot commented Jun 12, 2026

Copy link
Copy Markdown

Comment on lines +5807 to +5808
f"Ref read contains {len(ref_digests)} digests, but found {len(found_digests)} objects. Diff digests: {ref_digests - found_digests}",
missing_digests,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why duplicate ref_digests - found_digests?

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