Skip to content

Skip non-object Harbor ATIF artifacts - #1794

Open
GoldArowana wants to merge 1 commit into
openenv:mainfrom
GoldArowana:fix/harbor-non-object-atif
Open

GoldArowana wants to merge 1 commit into
openenv:mainfrom
GoldArowana:fix/harbor-non-object-atif

Conversation

@GoldArowana

@GoldArowana GoldArowana commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

If an external agent/trajectory.json contains valid JSON with a non-object root, load_trace currently treats it as ATIF and skips the available Pi session. Reconciliation then raises AttributeError before it can compare the captured turns.

Treat non-object JSON like the other unusable native artifacts the loader already handles. Keep the native ATIF object first, and leave the token comparison unchanged.

Type of Change

  • Bug fix

Alignment Checklist

  • Checked the repository principles and invariants against the loader change.
  • Ran the pre-submit lint hook and the official CPU pytest command against the exact proposed commit.

RFC Status

  • Not required for this loader bug fix.

Test Plan

  • Replayed an external trajectory.json containing [] with a valid Pi session. The base raises AttributeError. The candidate selects the Pi session and reconciles. A valid native ATIF trace still wins over Pi, and a native token mismatch still fails reconciliation.
  • PYTHONPATH=src:envs uv run pytest tests/envs/test_harbor_reconcile.py -v --tb=short passed 54 tests. The official CPU command passed 6,590 tests on Python 3.12.12, with 149 skips, 129 deselections, and 23 subtests passed. The candidate source was checked before and after execution. Exact-head validation
  • The pre-submit lint hook passed. The pre-submit test wrapper reached its 300-second cap and exited 124. The standard CPU suite completed in 541 seconds. Hook execution

Review

Codex assisted with implementation and testing. A separate Codex reviewer reran the failing case and eight preservation controls on the exact base and head and found no blocking issue. The test uses an invalid external artifact fixture with the real Pi session format and no live model calls.


Note

Low Risk
Narrow loader guard with fallback to existing Pi session path; dict ATIF unchanged. Low risk to reconciliation semantics.

Overview
load_atif now returns None when agent/trajectory.json parses but its root is not a JSON object (arrays, strings, booleans, numbers, or null). That matches how other unusable artifacts are handled, so load_trace can fall back to the Pi session instead of passing a non-dict into reconciliation (which previously raised AttributeError).

Valid dict-shaped ATIF still wins over Pi; token comparison behavior is unchanged. A parametrized test covers several non-object roots and expects Pi-session reconciliation to succeed.

Reviewed by Cursor Bugbot for commit 3c1c9ea. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

The docs for this pull request built successfully. A maintainer can publish a preview of this commit by adding the docs-preview label and re-running the Docs check.

This branch has not been deployed

No deployments
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.

1 participant