Skip to content

Trajectory step 3: tool.call events from native session logs - #593

Merged
renmengye merged 3 commits into
mainfrom
feat/trajectory-tool-calls
Oct 25, 2026
Merged

renmengye merged 3 commits into
mainfrom
feat/trajectory-tool-calls

Conversation

@renmengye

Copy link
Copy Markdown
Member

Trajectory step 3: what the agent did inside a session.

  • src/outerloop/tool_calls.py parses the kernel's retained, redacted copy of the native session log, host-side, never the raw home file.
    • Claude: tool_use / tool_result parts.
    • Codex: function_call, custom_tool_call and their outputs, including newer Codex's exec script tool, whose input is the script itself.
    • Each call becomes {tool, files, command (first 200 chars), exit, ok}. No file contents or tool output are kept.
    • Hermes and unknown formats yield nothing, and malformed lines are skipped. At most 500 calls per session.
  • At session end, after evidence retention and before session.end, the kernel appends one tool.call event per call. This step is best-effort: a failure logs and never breaks the session.
  • outerloop trajectory summary: tool calls: N (Bash 12, Edit 5). PR body: a short ## Process section with the total and top tools, omitted when there are none.
  • No existing event changes. Older kernels ignore tool.call.

Checked on real logs (counts only, nothing printed):

  • a local Claude Code session gave 422 calls (398 Bash), with commands, files and outcomes;
  • a local Codex 0.153 rollout first showed the parser missed the exec script-tool shape. That's fixed and tested here, and the rollout now gives 3 calls with commands and outcomes.

Not checked: a rollout from the pinned Codex 0.160.

Gate: ruff check, ruff format --check, mypy, pytest (3077 passed, 7 skipped).

Built by DeepSeek-V4.1-Flash, with the Codex exec fix by Claude; reviewed by Claude.

@renmengye renmengye added the outerloop:review re-request the advisory review label Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 1 — reviewed head 02b133bf — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 2 blocking, 1 advisory.

3 findings attached to the lines below.

Tool-call retention duplicates resumed-session history and can retain non-repo paths or patch text.

Comment thread src/outerloop/tool_calls.py Resolved
Comment thread src/outerloop/tool_calls.py Resolved
Comment thread src/outerloop/tool_calls.py Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 2 (re-run on the same head) — reviewed head 02b133bf — reviewer summarizer:hermes/gpt-5.6-terra over coverage+credentials+deployment+general+lifecycle+prose.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 3 blocking, 1 advisory.

4 findings attached to the lines below.

Merged four findings. Rejected as duplicates: coverage, deployment, and lifecycle each independently reported the resumed-session duplication at src/outerloop/tool_calls.py:274; credentials and lifecycle each independently reported the 8 MiB truncation at :245; general and prose each independently reported out-of-repository path retention at :87. No substantive findings were rejected as mistaken.

Comment thread src/outerloop/tool_calls.py Resolved
Comment thread src/outerloop/tool_calls.py Resolved
Comment thread src/outerloop/tool_calls.py Resolved
Comment thread CHANGELOG.md Resolved
@renmengye renmengye added outerloop:review re-request the advisory review and removed outerloop:review re-request the advisory review labels Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 3 — reviewed head 8ce6ee96 — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 1 blocking, 0 advisory.

1 finding attached to the lines below.

The parser can omit tool calls from a configured larger retained log.

Comment thread src/outerloop/tool_calls.py Resolved
@renmengye renmengye added outerloop:review re-request the advisory review and removed outerloop:review re-request the advisory review labels Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Round 4 — reviewed head 4cde0e7f — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: nothing blocking — 1 advisory note.

1 finding attached to the lines below.

One advisory finding: resumed logs duplicate calls that do not carry an ID.

Comment thread src/outerloop/tool_calls.py Resolved
@renmengye
renmengye merged commit 1e99285 into main Oct 25, 2026
5 checks passed
@renmengye
renmengye deleted the feat/trajectory-tool-calls branch October 25, 2026 17:40
@renmengye renmengye mentioned this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

outerloop:review re-request the advisory review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant