Skip to content

Artifact metadata not synced on append operations — inconsistent state between server and client #753

@KlementMultiverse

Description

@KlementMultiverse

Problem

When appending data to an artifact with append=True, the artifact's metadata fields (size, updated_at, checksum) are not recalculated or returned to the client. This creates an inconsistency: the server-side artifact has been modified, but the client's in-memory representation still reflects the pre-append state.

Impact

This breaks several workflows:

  1. State divergence: Client code can't trust artifact.size or artifact.updated_at after an append
  2. Resumable uploads: Code that chains multiple appends and checks size/checksum between operations will have stale data
  3. Consistency with other operations: Other mutations (delete, download) properly refresh metadata — append is inconsistent

Current Behavior

In src/a2a/client/task.py, the append_artifact() method likely:

  • Sends the append request to the server
  • Returns success/failure
  • Does NOT re-fetch artifact metadata

Expected Behavior

After a successful append, the returned artifact object (or the client's cached copy) should have updated:

  • size: new total size
  • updated_at: current timestamp
  • checksum: recalculated hash (if applicable)

Alternatively, the method should explicitly document that metadata is stale and recommend a refresh step.

Proposed Solution

One of:

  1. Refresh automatically: After append succeeds, fetch and merge the updated metadata back into the artifact object
  2. Return updated metadata: Have the append API response include updated metadata fields
  3. Add explicit refresh method: Provide artifact.refresh_metadata() so callers can explicitly re-sync

See #735 for original report — this is the core architectural question that needs resolution before fixing the bug.


Contributed by Klement Gunndu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions