Skip to content

fix(runs): give each imported document a trial of its own, never renaming one already there - #404

Merged
harenome merged 7 commits into
ThinkFlowLab:mainfrom
harenome:fix/import-trial-names
Nov 25, 2026
Merged

harenome merged 7 commits into
ThinkFlowLab:mainfrom
harenome:fix/import-trial-names

Conversation

@harenome

@harenome harenome commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #401

What

  • Two imported documents could share one trial folder while the job counted both:
    • OpenTelemetry: same root span name, same first 7 hex of the trace id.
    • ATIF: paths that flatten to one name, a/b.json and a__b.json.
  • Names are now chosen before anything is written:
    • A document whose trial exists keeps that name exactly. Judgements key on it.
    • A newcomer that would collide takes the full trace id, or an 8-hex digest of its path.
    • A name stays its document's, recorded in config.json trial_documents before any pruning, even after its folder goes; never reused, even as a longer name.
    • ATIF compares real paths.
    • An old folder holding two documents is split; both take the longer name.
    • A collision left over is refused, before writing.
  • OpenTelemetry trials record source_document.trace_id.
  • An import's files are written whole.

Verified

ATIF a__b.json, then a/b.json added; OpenTelemetry abcdef1fff…, then abcdef1000…, root span agent run.

Main: the second conversion overwrites the first trial.

atif__atif/a__b/result.json session-later
otel__otel/agent_run__abcdef1/result.json None
n_total_trials 2

Here:

atif__atif/a__b/result.json session-first
atif__atif/a__b__6c45d4fe/result.json session-later
otel__otel/agent_run__abcdef1/result.json abcdef1fffffffffffffffffffffffff
otel__otel/agent_run__abcdef10000000000000000000000000/result.json abcdef10000000000000000000000000

Risk

Agents

  • Claude Code, Opus 5.5: code, tests
  • Claude Code, Fable 5.2: review
  • Codex, GPT-6.2-Astra: review

@github-actions github-actions Bot added the needs review Tests pass, no conflict, no verdict on its latest commit label Nov 25, 2026
…collide

OpenTelemetry traces sharing a root span name and the first 7 hex of their
trace id, and ATIF paths that flatten to one name (a/b.json, a__b.json), were
written into one trial folder while the job counted both. Names are now
decided before writing: an unshared name is kept as it is, a shared one takes
the full trace id (OpenTelemetry) or a digest of its path (ATIF), and a name
still shared is refused. The OpenTelemetry trial records its full trace id.
…es with it

Judgements are keyed by a trial's name, so a later conversion must not rename
a trial already in the output job. Each importer now reads which document each
existing trial folder holds (the recorded trace id or source path, or the
trace a folder carries) and keeps that name for it; only a newcomer that
collides takes the longer name. A folder an older conversion wrote two
documents into is split, and a folder whose document cannot be told keeps
its name for the first document that would take it.
…ocuments by real path and split only a folder listed twice

A trial whose recorded document is known but no longer in the source keeps its name reserved: a newcomer with the same short name takes the longer one. ATIF documents are compared by real path, so one tree reached through a link keeps its trials. A folder counts as written by two documents when its job's config lists it twice; only a job without that list falls back to the trial count.
…der is pruned

The job's config.json keeps each trial name with the document it was given
to, across conversions. A later document never takes a name another
document once held, even after a conversion without that document pruned
its folder; the document itself gets its name back when it returns.
…t keeps its trial names

A conversion rewrote config.json in place: a refresh stopped mid-write left it
truncated, and with it the trial names kept for documents whose folders are
gone. Each file is now written beside the old one and renamed over it.
…re kept, and from a longer name

A job converted before trial_documents lost a gone document's name on its
first refresh: the folder was pruned before its name was recorded. The names
of every folder whose document is known are now recorded before pruning.

A document whose short name was taken fell back to its longer name even when
that name was kept for a gone document. Such a conversion is now refused
before anything is written.
@harenome
harenome force-pushed the fix/import-trial-names branch from 55b1fc6 to d062c10 Compare November 25, 2026 14:12
@github-actions github-actions Bot added needs review Tests pass, no conflict, no verdict on its latest commit and removed needs review Tests pass, no conflict, no verdict on its latest commit labels Nov 25, 2026
@harenome
harenome merged commit a8226ba into ThinkFlowLab:main Nov 25, 2026
3 of 4 checks passed
@harenome
harenome deleted the fix/import-trial-names branch November 25, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review Tests pass, no conflict, no verdict on its latest commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Imports: two documents can land in one trial folder, when their trial names collide

1 participant