Skip to content

fix(tracing): preserve string payloads in HDF5 round trips - #585

Open
Cookie0103 wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
Cookie0103:fix/hdf5-trace-string-roundtrip
Open

Cookie0103 wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
Cookie0103:fix/hdf5-trace-string-roundtrip

Conversation

@Cookie0103

Copy link
Copy Markdown

HDF5 trace loading still interprets every {/[-prefixed string as JSON. For example, an EvolutionTrace.llm_response of {"code": "result = 42"} is returned as a dictionary after an export/load round trip; valid Python expression code such as [1, 2] also changes type. This corrupts the original code/response payload used for trace analysis.

Extend the encoding-key marker already used for file-level metadata to each trace group. Only attributes explicitly encoded as JSON are decoded, while unmarked legacy trace groups retain their current loading behavior. This follows the metadata fix in #580/#574 and addresses the remaining per-trace path.

Tests cover an actual EvolutionTrace with JSON-looking code, response and change-description strings, numeric datasets, JSON-encoded lists/nested artifacts, and an old file without the marker.

Validation (Python 3.12, optional h5py installed):

  • Before the fix: the new EvolutionTrace round-trip test failed (1 failure out of 8 HDF5 tests).
  • Related trace suites: 39 tests passed.
  • OPENAI_API_KEY=test-key-for-unit-tests python -m unittest discover tests: 1072 tests ran, OK (2 skipped).
  • Repository pre-commit hooks (isort/Black) and git diff --check passed.

No live model request was used. AI assistance: Codex investigated, implemented and validated this contribution on behalf of the account owner, who has not independently reviewed or tested it.

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