reset() can desync isStreaming from an active run #1541
anusbutt
started this conversation in
Bug reports
Replies: 2 comments
|
I went ahead and implemented the H7 fix and added a regression test. The tests are passing, including the existing abort behavior and the full agent test suite. I opened PR #1590, but the GitHub Actions bot automatically closed it because I'm not currently a vouched contributor. If the fix looks reasonable, could someone vouch me or let me know the preferred process for getting this reviewed? PR: #1590 |
0 replies
|
Quick follow-up: I rechecked current I still have the regression test + focused fix from #1590. Happy to update it against current main if this is something you'd like to take. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Agent core
What happened?
Calling agent.reset() while a prompt is still running clears isStreaming and the message state, but does not stop or clear the active run.
The run continues emitting events afterward, which can repopulate the messages that were just cleared. Meanwhile, agent.prompt() still reports that the agent is already processing because activeRun remains active.
This leaves the agent in an inconsistent state: it reports isStreaming === false while a run is still in progress.
I reproduced this with a deterministic regression test.
Steps to reproduce
agent.reset()while the run is active.reset()has completed.Expected behavior
Calling
agent.reset()during an active run should fully invalidate or stop the current run so that no events, messages, or tool results from the pre-reset run can update the agent state afterward.Prime Agent version
Running from source.
@earendil-works/pi-agent-core0.7.3, commit8ee310c5d551b5a020c724b44573371a7bf383fc.Environment
8ee310c5d551b5a020c724b44573371a7bf383fc(@earendil-works/pi-agent-core0.7.3)Additional context
I investigated the issue and traced it through the agent lifecycle/state management code.
The main finding is that
Agent.reset()clears the visible runtime state, but the active run is still alive and can continue emitting events/updating state after the reset.I have a related Discussion with the investigation details and reasoning.
All reactions