feat(parser): add TraeX (TRAE CLI 2.0) as a first-class agent - #1349
Conversation
roborev: Combined Review (
|
|
looking |
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
- test(cli): pin TraeX live-activity hint target collection - fix(traex): scope Codex sidecars and guard path-keyed skips - revert: drop the in-place codex-to-traex adoption guard - docs: drop the build-channel detail from the TraeX evidence note - fix(sync): isolate provider freshness by agent - fix(sync): scope DB-backed freshness by agent - fix(sync): isolate verified-source repair state by agent - fix(traex): keep Codex index metadata out of TraeX sync - docs: design agent-scoped remote cache repair - fix(sync): preserve agent scope across cache repairs Co-authored-by: Wes McKinney <wesmckinn+git@gmail.com>
roborev: Combined Review (
|
An unchanged TraeX rollout can bypass database freshness and replace its stored messages on every periodic sync. Record the narrow format-family boundary and the observable regression before changing the incremental gate.
An unchanged TraeX rollout fell through the equal-size incremental gate with forceReplace set, so scheduled syncs reparsed and rewrote its messages before fingerprint freshness could apply. Treat Codex-format rollouts consistently at that gate so untouched TraeX sessions reach database freshness while true appends retain incremental parsing.
roborev: Combined Review (
|
TRAE CLI 2.0 (
traex) is a closed-source fork of codex-rs. It writes rolloutJSONL that is field-for-field the Codex shape into
~/.trae/cli/sessions,including the subagent
session_meta,token_countrecords, and a siblinghistory.jsonlat the same position relative to the sessions root. Until nowthe only way to index it was to declare that root as a
codexsource, whichgives the sessions the wrong agent and an ID prefix whose one-click resume
command (
codex resume <id>) cannot resume them.This adds
traexas its own agent, served by the Codex provider through arelabel hook — the same shape
opencode_provider.goalready uses to serveKilo, MiMoCode, and Icodemate from one implementation. Parsing, discovery,
fingerprinting, and JSONL-tail incremental appends are shared; only the agent
label and the
traex:ID prefix differ.internal/parser/traex.gois thewhole fork-specific surface and is the first place to look.
The relabel covers more than Kilo's does. Besides the session ID, parent, and
source-session ID, the Codex parser stamps
codex:onto theSubagentSessionIDof tool calls and their result events, so a partialrelabel would leave a TraeX parent pointing at
codex:<uuid>rows thetraex:namespace never stores. The provider's incremental path returnsappended messages with no session, so the hook takes
(*ParsedSession, []ParsedMessage)and treats a nil session as that path.Discovery keys are now agent-scoped (
CodexSourceKeytakes an agent). Bothagents name files by UUID, so a shared key would let one agent's session
resolve to the other's file.
In
internal/sync, the branches that describe the format — same-UUIDduplicate resolution, dated-over-flat layout preference, reconciliation
identity, the incremental
file_mtimebasis, and the parse-diff raced guard —move behind a new
isCodexFormatAgentpredicate. The branches that describeCodex's out-of-band files stay keyed to
parser.AgentCodexalone, becauseTraeX writes neither: there is no
session_index.jsonlsidecar (so no titlebackfill, no index-driven cache invalidation, and no index watch or changed-path
fan-out), and no
s3://.../raw/codex/...archive convention, so atraexrootthat looks like an S3 URI is skipped rather than imported under Codex's
identity. That split is the main thing worth reviewing.
Two consequences of having no index file are worth stating. Titles come from
the rollout head only, so a TraeX session never picks up a renamed thread name.
And
~/.trae/cliis not watched shallowly, unlike~/.codex, since the onlyreason to watch it would be the index file and the directory otherwise holds
constantly-rewritten SQLite WALs.
Evidence for the format is observational and documented as
no-public-sourcein the format inventory: TRAE CLI ships only as a binary, and neither Trae's
product site nor the public
Trae-AI/Traerepository publishes a sessionschema. A de-identified rollout with subagent spawn/wait records is kept as a
fixture.
Switching an existing installation from the
codex-source workaround toagent = "traex"is not handled: the stored rows are keyed by file path, sothe old
codex:<uuid>rows would satisfy the freshness skips and the new rowswould never be written. A full resync into a fresh database is the intended
path.
🤖 Generated with Claude Code