Skip to content

feat(context): object-store names for run-context trajectory keys - #101

Merged
earakely-scale merged 2 commits into
mainfrom
edgararakelyan/run-context-object-urls
Oct 7, 2026
Merged

earakely-scale merged 2 commits into
mainfrom
edgararakelyan/run-context-object-urls

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Neutral twins for the S3-named PromptResponse fields.

  • PromptResponse gains agent_trajectory_object_url, agent_trajectory_object_prefix and target_agent_per_turn_trajectory_object_urls. They are appended after the existing fields, so positional construction is unchanged.
  • The S3-named fields (agent_trajectory_s3_uri, agent_trajectory_s3_prefix, target_agent_per_turn_trajectory_s3_uris) stay as real fields, mirrored from the neutral ones at construction. dataclasses.asdict, which persists prompt responses, therefore writes both keys. Readers on older versions keep reading the legacy key, and code reading the S3-named attributes keeps working without a warning.
  • The S3-named keywords still work through warn_deprecated, which logs a countable agent_env_deprecated_symbol line. Giving both spellings with different values is a ValueError. Giving them equal is a copy, so dataclasses.replace(response) and rebuilding from asdict both work.
  • from_dict reads either key, the legacy one first, as with the artifact twins: only a raw-doc writer outside core can make the two differ, and those know only the legacy key. A legacy key holding None falls through to the neutral one, and a stored empty per-turn list stays []. Stored documents are not rewritten, and read compatibility for the legacy keys is permanent.

The rest of the run context.

  • Rubrics verifier metadata: writes compact_trajectory_object_url and judge_trajectory_object_url beside compact_trajectory_s3_uri and judge_trajectory_s3_uri. The private names inside the verifier move to neutral ones, including the judge call's internal result key.
  • Unit-test verifier: its stdout_artifact / stderr_artifact entries carry object_url beside s3_url.
  • Snapshot series rows: carry trajectory_object_url beside trajectory_s3_uri.
  • Run output (agent-env task run): prints the neutral labels, and reads verifier metadata keyed either way.
  • Helpers: context.dual_keyed / context.read_dual_keyed write and read a renamed run-context key.

Core's own constructors, prompt_agent included, use the neutral keywords. The explorer UI still reads the legacy keys, which stay written; moving it to neutral-or-legacy is a follow-up.

Testing

  • Unit:
    • A response built with the neutral keywords carries both spellings with no warning.
    • A response persisted through build_context_update_ops carries both keys.
    • A stored response keyed only by the legacy names, or only by the neutral ones, loads the same.
    • When the two keys differ, the legacy one wins, including an empty per-turn list.
    • Each S3-named keyword warns, still works and is logged.
    • Disagreeing spellings raise; replace and an asdict round trip don't.
    • Verifier metadata, the unit-test verifier's artifact entries and snapshot rows carry both keys at every write site.
    • The judge trajectory URL from the attempt that passed is the one returned through the output-retry loop.
    • The run output prints neutral labels for metadata keyed either way.
    • Tests that built responses with the S3-named keywords now use the neutral ones, and no deprecation warnings come from PromptResponse in the suite.
    • Suite: 6200 passed, 13 skipped.
  • Mutants (out-of-tree): 27 of 27 caught. Each of these fails a test:
    • dropping either mirror, the keyword warning or the conflict check, or raising on equal values;
    • reading neutral-first, legacy-only or truthy-or, or letting a legacy None hide the neutral value;
    • writing only one key in dual_keyed, or at any single write site (four snapshot sites, two verifier artifacts, two rubrics metadata keys);
    • splitting the judge result key between producer and consumer;
    • dropping the recorded-URI read;
    • reverting any run-output label or read.
  • Downstream: the sdk's unit suite gives the same result against this core as against main (1739 passed). The one failure is a floor-constant check that reads the test venv's installed metadata, and it fails the same way against both.
  • Dev stage (Mongo + object store): I recorded a prompt-agent completion (a response plus verifier metadata) through the instance store's own update path, once with 0.9.1282 and once with this branch.
    • The 0.9.1282 instance stored only the legacy keys. This branch's instance stored both, with equal values.
    • 0.9.1282 loads both instances and prints them as before.
    • This branch loads both, resolves the neutral fields for the legacy-only one, and prints neutral labels for each.

Labelled bump-version.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge based on the changes since the previous review.

What we checked:

  • Empty turn lists stay empty: No. An empty list is not None, so the reader keeps the legacy list.

Summary

Run-context trajectory links gain neutral object-store names while keeping the older S3-named keys readable and written for compatibility. Verifiers, snapshot rows, and agent-env task run output use the neutral names too.

  • Prompt responses use neutral trajectory names and keep the old keys.
  • Snapshot rows carry both trajectory URL names.
  • Verifier records and run output use neutral object URL names.
  • The context update test mutates a different response field.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Prompt and verifier steps] --> B[Write legacy and neutral keys]
  B --> C[Stored run context]
  C --> D[Older readers use legacy keys]
  C --> E[Current readers accept either key]
  E --> F[Task output uses neutral labels]
Loading

Reviews (2) · Last reviewed commit: "fix(context): a legacy run-context key h..." · Reviewed by Greptile

PromptResponse gains agent_trajectory_object_url, agent_trajectory_object_prefix and
target_agent_per_turn_trajectory_object_urls. The S3-named fields stay as mirrors, so every
persisted prompt response carries both keys and readers on older versions keep working.
The S3-named keywords still work, warning through warn_deprecated; giving both spellings
with different values is an error. Stored responses load keyed either way, legacy key first.

Verifier metadata (compact/judge trajectory, unit-test stdout/stderr artifacts) and snapshot
series rows write the neutral key beside the legacy one, and the run output prints the
neutral labels while reading metadata keyed either way.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner October 7, 2026 19:25
Comment thread src/agent_env/task_step/context.py Outdated
Comment thread src/agent_env/cli/task/run.py
…the neutral one

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 92fc256 into main Oct 7, 2026
14 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/run-context-object-urls branch October 7, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant