Skip to content

[FEA]: Reconstruct ATIF trajectories from OpenCode and Codex agent logs #118

Description

@mimran-khan

Problem to solve

load_trajectory_with_fallback already rebuilds trajectories from claude-code.txt, cursor-cli.txt, and cline.txt when trajectory.json is empty. OpenCode and Codex tee their JSON streams to opencode.txt and codex.txt, but those files are not converted today.

OpenCode is a documented Tier 3 agent. When Harbor leaves trajectory.json absent or with empty steps[], the verifier writes "No trajectory or reconstructible agent log" and scoring collapses. The collector can spot runtime errors in opencode.txt, but it cannot recover tool calls for deterministic checks.

This is separate from #110, which is about mis-parsing native Codex exec inside an existing trajectory. Here we are reconstructing ATIF from agent log files.

Proposed approach

  1. Parse OpenCode run --format=json events into ATIF steps (tool_use, text).
  2. Reuse that parser for Codex when the tee log is structured JSONL.
  3. Wire both into load_trajectory_with_fallback after the existing claude/cursor/cline fallbacks.
  4. Keep the existing Harbor bundle copy path (adapter.py already copies log_converters.py).

Fail closed on non-dict tool inputs so raw strings are not treated as shell commands.

Additional context

I did not find an open issue for this OpenCode trajectory gap. Regression tests cover read/bash tool calls, error-only logs, and the load_trajectory_with_fallback path.

Before submitting

  • I agree to follow this project's Code of Conduct
  • I have searched open enhancement issues and found no duplicate of this request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions