Skip to content

Let shipped logs leave event ids to admission, and give the diff gallery's replies ids - #6737

Merged
leaf-agent merged 2 commits into
mainfrom
fix/diff-thread-gallery-reply-ids
Nov 22, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/diff-thread-gallery-reply-ids

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

test_a_shipped_log_replays_its_example_state in tests/journeys/test_render_pages.py fails on main with KeyError: 'id'. Two seeded agent replies in examples/developer/diff-thread-gallery.jsonl, added in #6682, have no id. #6682 never ran this test, because a pull request runs only the journeys tests it edits.

The seed was valid. Admission gives an event an id when it has none (append_admitted), and examples/AGENTS.md says a seed line is an event as its writer would send it. The test's {event["id"] for event in events} was what required every shipped event to carry an id. It now checks only that each id a seed names survives replay, so the next seed that leaves an id to admission passes.

The two replies also get ids now, dfg-line-cap-answer and dfg-line-backoff-answer, like every other seeded event in the corpus. Nothing reads a reply's id, so the gallery draws the same threads.

The test failed on main at 850e0bf and passed after the seed edit (uv run pytest tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state -n0). This PR edits the test file, so its CI runs the test against the change to the test.

`examples/developer/diff-thread-gallery.jsonl`, added in #6682, seeds two agent replies without an `id`. Every other seeded log in the corpus gives each event one. `tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state` checks that each shipped event's id survives replay, so it fails on main with `KeyError: 'id'`. #6682 never ran it, because a pull request runs only the journeys tests it edits.

The two replies now carry `dfg-line-cap-answer` and `dfg-line-backoff-answer`. No state, test or page reads a reply's id, so the gallery draws the same threads.

The test failed on main at 850e0bf and passes with this change (`uv run pytest tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state -n0`).

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The reply events were valid without ids. The test is what failed. Admission gives an event an id when it has none (append_admitted in src/leaf/event_contracts.py: if "id" not in event: event = {**event, "id": new_event_id(events)}), and examples/AGENTS.md says a seed line is "an event as its writer would send it", so leaving id out is allowed. The KeyError comes from the test's own assert {event["id"] for event in events} <= previous in test_a_shipped_log_replays_its_example_state. That line requires every shipped event to carry an id, which no contract requires. As it stands, the next seed that leaves an id to admission fails the same way, and only the nightly journeys run notices. I'll push a change so the line checks only the ids a seed names. The ids this PR adds stay, matching the rest of the corpus.

Admission assigns an id to an event that has none, and examples/AGENTS.md
says a seed line is an event as its writer would send it, so an id-less
seed is valid. test_a_shipped_log_replays_its_example_state still raised
KeyError on one: it now checks only that each id a seed names survives
replay.
@leaf-agent leaf-agent changed the title Give the diff thread gallery's seeded replies event ids Let shipped logs leave event ids to admission, and give the diff gallery's replies ids Nov 22, 2026
@leaf-agent
leaf-agent merged commit 655fc43 into main Nov 22, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/diff-thread-gallery-reply-ids branch November 22, 2026 10:20
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