Skip to content

Read a Pi acting agent's event stream as Pi's in parse_log and the AHE Evolver's texts - #91

Draft
iamziyuzhao wants to merge 1 commit into
mainfrom
fix/pi-stream-readers
Draft

iamziyuzhao wants to merge 1 commit into
mainfrom
fix/pi-stream-readers

Conversation

@iamziyuzhao

Copy link
Copy Markdown
Collaborator

Change

Two places that read an acting agent's event stream by the CLI that wrote it did not know Pi's (#89):

  • records.parse_log(log, backend, model) read every stream but Codex's as Claude Code's, so a Pi stream
    (pi --mode json) gave no session id and no usage. It now reads a pi stream with Pi's own reader (parse_pi).
    No hermit code calls it during a run (each CLI agent reads its own stream); hermit.agent.evolver.agent
    re-exports it for a method's code.
  • The AHE Evolver's texts (START.md, DEBUGGER.md, the evolution query, the Debugger's question) name the acting
    agent's event stream. debugger.STREAM_TEXTS had only Claude Code's wording, so with a Pi acting agent they named
    agent-codex.jsonl, which is not there (rollout_stream finds agent-pi.jsonl). They now name Pi's stream and
    its command (pi --mode json).

Found while adding DeepSeek Harness (#90) and split out of it, so that #90 changes only dsh. #90 adds its own
entries beside these two (a one-line overlap in each place).

Validation

  • tests/core/test_pi_agent.py::test_a_pi_stream_is_read_back_by_its_name_or_by_its_events: parse_log on the
    recorded tests/fixtures/pi/success.jsonl with pi gives the stream's session and its 4 calls (4,000 input and
    80 output tokens).
  • tests/methods/ahe/test_ahe_hosts.py::test_the_evolvers_texts_name_every_acting_agents_stream_it_reads: for
    every stream but Codex's (Claude Code's, Pi's), START.md and DEBUGGER.md name that stream and no Codex file or
    command.
  • Each test fails with its fix undone (each undone in turn in a copy of the checkout).
  • Full suite, Linux container (Ubuntu 24.04) as root, --integration: 2 failed, 1165 passed, 85 skipped. On main
    the same run gives 2 failed, 1164 passed, 85 skipped: the same two tests, which fail as root
    (test_isolate::test_a_rollout_sees_what_is_declared_and_nothing_else,
    test_ahe_hook_runner::test_logs_that_cannot_be_written_lose_the_line_not_the_call).

Review

  • Tests and documentation cover the affected behavior, where applicable. Tests: see Validation. Documentation:
    no document names parse_log or these texts.
  • Commands, defaults, and public interfaces are consistent. parse_log keeps its signature; an unknown
    backend's stream is still read as Claude Code's.
  • Shared logs and examples contain no credentials or private data. The fixture is Add Pi as a CLI Base Agent (acting agent and pi Evolver) #89's recorded stream.
  • Documentation-only: N/A.
  • Core changes: hermit/agent/base/records.py (parse_log) and the AHE method's debugger.py, both for a
    Pi acting agent.
  • Real execution paths and tests: parse_log on a stream the real Pi recorded; the AHE texts as the
    learners read them.
  • Test checklist: each test is in the group of its code, named for the behaviour, and fails without its fix.
  • This description: TBD.
  • Independent review (post-PR audit): pending.

🤖 Generated with Claude Code

…ver's texts

records.parse_log read every stream but Codex's as Claude Code's, so a Pi stream gave no
session id and no usage; it now reads a pi stream with parse_pi. The AHE Evolver's texts named
agent-codex.jsonl for a Pi acting agent, whose stream is agent-pi.jsonl; debugger.STREAM_TEXTS
now has Pi's wording and command. Each test fails without its fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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