Skip to content

examples: the cost of the calls on a failure, the peer's task held, scratch removed at exit - #24

Merged
ohdearquant merged 5 commits into
mainfrom
fix/examples-telemetry-and-scratch
Sep 29, 2026
Merged

ohdearquant merged 5 commits into
mainfrom
fix/examples-telemetry-and-scratch

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Follow-ups from the source review of the examples part (record c22da7c9).

  • examples/backends.py says what the calls cost when a later one fails. The table of calls was printed only after the run returned, so a backend that failed after completed calls left the paid calls unreported. It is printed on the way out of a failure too, an interrupt included, when there were calls; a backend that fails before its first call still stops with the one line naming what is missing.
  • notebooks/03_two_actors.ipynb holds the researcher's task. The escalation handler started the researcher's run with asyncio.create_task and dropped the task, so a failure in the peer was the loop's to report at exit. The task is held and awaited where the peer's run is shown, so the error is raised on the page.
  • The scratch directory goes with the process. tools_and_gates.py and notes_and_context.py make one on import and never removed it; it is removed at exit, and the notes example's two runs still share it, which is the point of that example.
  • ADR-0010 cited examples/two_actors.py, which is not in the tree; the two-actor example is the scripted notebook, and nothing runs it against a live model.

Tests: every notebook runs, code cell by code cell with top-level awaits, offline; a researcher whose backend raises settles the reviewer's ask naming the error and is then raised where the peer runs are shown; the scripted examples leave nothing behind under TMPDIR; the live example's failure or interrupt after a metered call prints that call. Each arm fails on the code before this change.

…er's task; scratch goes with the process

examples/backends.py printed its table of calls only after the run returned, so a backend that
failed after completed calls left the paid calls unreported. The table is printed on the way out
of a failure too, when there were calls; a backend that fails before its first call still stops
with the one line naming what is missing.

notebooks/03_two_actors.ipynb started the researcher's run with `asyncio.create_task` and dropped
the task. The task is held now and awaited where the peer's run is shown, so an error in the peer
is raised on the page rather than logged at exit.

examples/tools_and_gates.py and examples/notes_and_context.py make a scratch directory on import
and never removed it. It is removed when the process ends; the notes example's two runs still share
one directory, which is the point of it.

ADR-0010 cited `examples/two_actors.py`, which is not in the tree; the two-actor example is the
scripted notebook.

Tests: the notebooks run, every code cell in order with top-level awaits; the scripted examples
leave nothing behind; the live example's failure after a metered call prints that call.
…'s error

A subtotal an attempt was missing from printed like a complete one, so
a cut-off call read as free; the row now prints >= before it and the
footer says so. A failed call's row carries its error instead of
None / None. The two-actor notebook test asserts both cells it checks
were met, so an added line cannot skip its checks.
@ohdearquant

Copy link
Copy Markdown
Owner Author

b829135: the call table prints >= before a subtotal an attempt is missing from (cost_complete false), so a cut-off call no longer reads as free, and the footer says so; a failed call's row carries the first line of its error where a finished one names its end. The two-actor notebook test asserts both cells it checks were met. A session call the CLI failed records no envelope at all, which is the backend's gap (#127), not the table's. Gates: pre-commit twice, pytest with coverage on 3.11, 3.12 and 3.14 at 100%.

@ohdearquant
ohdearquant merged commit 39252fc into main Sep 29, 2026
16 checks passed
@ohdearquant
ohdearquant deleted the fix/examples-telemetry-and-scratch branch September 29, 2026 01:44
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.

1 participant