Keep finished `BackgroundTools` results in the history when a run pauses for deferred tools
- Closes #11741
When a run pauses for deferred tools, BackgroundTools.after_node_run now keeps results that already arrived instead of leaving them queued for wrap_run to drop. They go into the history as user content, the same shape enqueue would have delivered, so a resumed run gives the model the result it was promised. Nothing is enqueued, so the pause still ends the run without another model request.
- They are appended as a new
ModelRequestafter the paused step, so existing history is not edited. - An error outcome still ends the run, as
wrap_runalready did. - Tools that are still running are still cancelled at the pause.
Not in this PR: #11741 also mentions that a cancelled tool's placeholder return still says its result "will arrive automatically". That is separate from keeping finished results, so I left it out to keep the fix narrow.
Tests cover a result that finishes before the pause and reaches the resumed run, a step where every call deferred (so it leaves no request of its own), an error that still ends the run, and a result that finishes only after the pause has ended, which is still not delivered. The first two fail on main. The docs page and README now say finished results are kept.
The dropped-results behaviour was documented, and a paused run's history now ends with one more ModelRequest, so I left the breaking-change and compatibility-impact items unticked. Should this get a compatibility impact warning?
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.