Send a pi agent back at stop in a real session, and name only the refusals it can fix
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Review of 706. The settle handler skipped any event whose `context.canContinue` was false, and pi 1.0.3 computes that preview before a handler's entries: a run that ends on the agent's own reply reads false until a message is appended (`_buildBoundaryContext`, pi's `dist/core/agent-session.js`). So in a real session the policy was never asked and the agent was never sent back. - The settle now skips only a run that did not complete (aborted or errored). pi itself refuses a continuation without runnable context, and an Esc during the settle aborts it, so the dropped guard protected nothing. Checked against a real AgentSession over pi-ai's faux provider (a throwaway probe outside the repo): 1 provider call before, 4 after (three sends-back, the fourth settle stands); a second probe gave the brief once over two prompts and blocked a `write` to the config folder's project file with TouchedJudge's text, nothing written. - The send-back's entry names the refusals the agent can fix, as the stop hook's hold does (`explain(fixable)`), through one `fixable` helper the push block shares; when a policy holds on retryable refusals alone, it names those. - The handler runner is `reply`, not `answer`: Answer is a glossary noun, and the verdict text in the same file uses it in that sense. - Tests: the settle fixture now has `canContinue: false`, as pi sends it (red by assertion on six tests before the fix); added "sends back a completed run whose context ends on the agent's own reply" and "lists only the refusals the agent can fix, as the stop hook does"; the stopped-or-failed test drops its canContinue case. - Still for 799, outside the territory: the live edit guard (decide.ts's `toolRefusals`), one home for `sessionFacts`, and `--base` in PushCheck.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+109 added−38 removed
- tests:+78 added−23 removed
- other:+31 added−15 removed