Skip to content

feat(standard): keep each model call whole and show a trial's conversation call by call - #342

Merged
aitianshi merged 9 commits into
ThinkFlowLab:mainfrom
pierreleca:feat/model-calls-record
Nov 24, 2026
Merged

aitianshi merged 9 commits into
ThinkFlowLab:mainfrom
pierreleca:feat/model-calls-record

Conversation

@pierreleca

@pierreleca pierreleca commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #341

What

Save each agent model request and reply so a trial can be inspected call by call, including pictures and full tool arguments. The Conversation tab shows new input, the answer and related steps; pictures open in an overlay. The CLI can list calls or reconstruct a request and verify its hash.

The builder offers Model calls saved: Pictures and text (default), Text alone, or Nothing. Its compact cards share a row with the label and match the surrounding form typography; narrow screens wrap them. Recording is bounded at 256 MB per unit by default and does not add model calls or tokens.

Touches

the standard · backend · routes · templates and static · docs and site

Before and after

Current screenshots: Chromium, 1280 px desktop and 390 px mobile. The Conversation example is a synthetic trial whose picture was written and read through the real exchange store; no model or benchmark was run for these captures.

Before (main, original captures) Current PR (ede2d18b)
Limits
Limits before
Limits: Model calls saved inline
Conversation
Conversation before
Conversation with saved picture
Artifacts
Artifacts before
Saved pictures in Artifacts
Layout follow-up, mobile, dark theme and picture viewer

The builder before the layout follow-up at the same 1280 px width.

Mobile, light Desktop, dark
Mobile saving choices Dark saving choices
Mobile Conversation, dark Opened picture
Mobile Conversation Saved picture enlarged

Verified

  • Latest head: 112 focused tests passed (ui_tests.test_builder_limits, ui_tests.test_trial_calls, tests.test_standard_exchanges, tests.test_trace_calls); loopback relay fixtures ran outside the restricted sandbox. git diff --check is clean.

  • Latest follow-up: removed the brittle label/HTML assertion; retained defaults, visibility, recipe persistence and click-to-command coverage.

  • Browser verification at ede2d18b: real Flask pages in Chromium, 1280 px and 390 px, light and dark. All three saving choices select correctly; labels fit; no horizontal page overflow after layout settles. Saved pictures load, enlarge and close with Close or Escape; Artifacts lists the picture. No page JavaScript errors. Captures visually reviewed. Earlier shared-preview timeouts were bypassed with local Chromium and Flask test-client routing.

  • Both suites, one module a process, beside main: nothing fails that main passes (backend 174 modules, 2,974 tests; routes 72 modules, 698 tests).

  • One OSWorld1 task, a scripted model, no key, run from an earlier head of the pull request that depends on this one: 2 calls and 2 pictures in a store of 232,744 bytes, beside a call record of 2,636. At this branch's earlier head too, runs show ... --calls listed both calls, one picture each; --call 1 --request rebuilt call 1 to its recorded sha256.

  • field_contract.py --write and catalogue_docs.py --write change nothing; git diff --check is clean; the judge's checks pass offline.

  • Not verified: a run with a provider's model.

Risk

Each picture is kept once per trial, about 120 kB a screenshot above, at most 256 MB a unit. Prompts and pictures sit unredacted in the job's folder. The relay gains two options and the job's config two keys. Revert the commits to undo; a store already written is then left unread.

@pierreleca
pierreleca force-pushed the feat/model-calls-record branch from 5fd6fd5 to d9ce88c Compare November 24, 2026 11:21
aitianshi added a commit that referenced this pull request Nov 24, 2026
Closes #379

## What

Before a live feed exists, a run now opens on Logs. Launch stages and
log output live there; the first usable feed switches to Live within the
same document, without reloading. Explicit tab choices are respected.
Restarted stages drop stale timing/detail, terminal executions settle
stage state, and unknown unit totals use an indeterminate bar.

The full-run overview shows identity cards with Runner first, then
Benchmark/Dataset, Agent/Model, and Trials/Duration. Task and All
attempts pages keep their own status and metrics without repeating run
identity.

Task overview cards put timing and Tool calls on the left and Model
usage on the right, stacking on narrow screens. Model usage combines a
compact token bar with Prompt growth when multiple calls were recorded.
Its labels and segments are input, cache, output; input means uncached
input, as its tooltip explains. Cache hit is plain text. Saved trial
totals provide a fallback when trajectory accounting is absent, and
missing usage is stated explicitly.

## Touches

backend · routes · templates and static · tests · field guide

No equivalent open or closed issue/PR was found in the repository or
private fork. Related open work: #336 (run facts), #338 (trial details),
#340 (task step progress). These have shared-file overlap, but implement
separate behavior. After merging main, pairwise merge checks are clean
for #332, #336, #338, #340, #342 and #344. Unmerged #352 and #354 still
require coordination in app/templates/runs/job.html and app/web/runs.py;
their features are not included here.

## Before and after

Task overview: the earlier real-run capture and the approved final
layout from that same saved run. Run identity is now kept on the
full-run overview.

| Before | After |
| --- | --- |
| <img width="430" alt="Earlier task overview with separate growth and
tool sections"
src="https://raw.githubusercontent.com/ThinkFlowLab/nullius/feat/run-logs-tab/app/ui_tests/evidence/run-logs/task-after.png">
| <img width="430" alt="Timing and Tool calls on the left, combined
Model usage on the right"
src="https://raw.githubusercontent.com/ThinkFlowLab/nullius/feat/run-logs-tab/app/ui_tests/evidence/run-logs/model-usage-after.png">
|

Full-run identity cards and Live/Results/Logs:

<img width="860" alt="Full-run overview with Runner first and benchmark,
dataset, agent, model, count and duration cards"
src="https://raw.githubusercontent.com/ThinkFlowLab/nullius/feat/run-logs-tab/app/ui_tests/evidence/run-logs/run-overview-after.png">

## Verified

- Backend suite: 2,856 tests in 173 modules passed after merging current
main outside the socket-restricted sandbox.
- Route suite: 660 tests in 68 modules passed after merging current
main.
- Focused progress and execution tests: 83 passed.
- Browser checks: desktop light/dark and narrow layout; automatic Logs →
Live retains the document and `performance.timeOrigin`; tab selection
and task metrics checked.
- Real τ³-bench Airline task using `meta/muse-spark-1.3-contributor`:
reward 1.0, 55.54 seconds agent time, 22 steps. Recorded uninterrupted
from cold setup through Logs → Live, Results and the task page. The
simulator and judge used `openai/gpt-4.1` because the configured dated
default alias was unavailable. The earlier refused attempt was not
counted as this successful run.
- Field-guide checks: 2 passed. Usage regression cases cover one call,
multiple calls, final metrics, trial totals, unreadable trajectories,
missing usage and output-only records.
- `git diff --check` passed.

## Risk

Feed readiness and polling changes could leave a preparing page on the
wrong tab; explicit choices must not be overridden. A terminal execution
now settles a remaining stage even if its final stage event was absent,
but does not manufacture a duration or unit count. Runs without launch
records have no Logs tab. The overview derives the benchmark from the
catalogue or a single recorded task source. The token summary preserves
existing trajectory cache accounting; partial per-call records can still
describe only the recorded subset. Revert to undo; no storage migration.
…ting

A custom provider without a key is sent a placeholder word. The run
wrote that word itself, while the launcher and the judge read it from
settings.MODEL_KEY_PLACEHOLDER. Reading it from the setting here too
lets every reader of a run's requests know which word is no secret.
…elay's record

A trial's call record keeps the last two messages of each model call,
cut to 2,000 characters and without pictures: what the model was shown
at a step is lost. Each unit's relay now also keeps every call of its
agent whole under the trial's .work/relay/exchanges: the request as
sent and its sha256, each distinct part and picture written once, and
the reply as it arrived. Only the relay's key is cut out. A failure to
write never changes or stops the reply, and each file names its format
so that a later one is refused rather than guessed.

run --exchanges whole|text|off (whole by default) and
--exchanges-max-mb N (256 a unit by default) choose and bound it; the
job's config records both and a recipe takes them. The judge's and the
simulated user's calls keep their call record alone.
… model calls

A recipe could take the exchange record's mode, but the builder had no
way to set it. The Limits step now has three small cards under the
spending caps: Pictures and text (the default), Text alone and Nothing.
A choice other than the default goes into the recipe and onto the run's
command line; the default adds nothing. A run that calls no model shows
no cards.
The record of a trial's calls is only useful once something reads it.
traces/calls.py builds a trial's conversation by model call from it:
each call's time, tokens and cost, what it sent that the call before
had not (pictures by their sha256), its answer whole and the steps of
the trajectory under it. A store of a later format is refused with a
notice, and a trial without a store reads as before.

runs show ... --calls prints that view as JSON, redacted.
runs show ... --call N --request prints call N's request rebuilt to the
bytes sent and says on stderr whether its sha256 is the recorded one.
Both find an earlier try of a trial by its NAME.try-N.
…ures

The Conversation tab lists the steps of a trajectory, and the pictures
an agent sent its model show nowhere. A trial with an exchange record
now opens the tab on its model calls, twelve a page: the selected call
shows what it sent that the call before had not, its answer and the
steps under it. A picture is served from the trial's own store by its
sha256, only when that store lists it and only as an image type; a
click opens it in a dialog over the page, and a click with a key held
opens it in a tab of its own. The Artifacts tab counts the pictures and
their size, with a link to the tab.
@pierreleca
pierreleca force-pushed the feat/model-calls-record branch from d9ce88c to eee9f14 Compare November 24, 2026 13:55
pierreleca and others added 4 commits November 24, 2026 19:41
The Artifacts tab lists the pictures sent to the model first, then
Nullius's records, then the benchmark's own under their heading row.

The trial's page imports main's evidence reader beside the calls, and the
builder's Limits row keeps main's words on attempts and retries, with
what each trial keeps of its model calls after the cap on them.
The rows this branch added on the exchange record retold the relay's
code: its file layout, its version line, its retries and its failures.
The record's section keeps two sentences and the rows a user chooses or
meets: the text mode, off, the bound, what is not kept and where the
result names it. The read-jobs rows and the builder's Limits row each
say what the command or the choice is.

Two clauses of the standard's Progress and Outcomes rows described the
live feed's steps and a scored cut, which this branch does not hold; one
linked a section it does not have. They go back to main's words.
…us into fix/model-call-choice-layout

# Conflicts:
#	docs/cli/run.md
@aitianshi
aitianshi merged commit 7c9e47e into ThinkFlowLab:main Nov 24, 2026
2 checks passed
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.

A trial keeps no whole record of its model calls, and the pictures its agent sent show nowhere

2 participants