--------------------------------------------------------------------------- E2E tests for the CompletePoisonCycle fix. Bug: CompletePoisonCycle was called on EVERY response, including intermediate responses that contained tool/function calls. The first call cleared poisonTaskID, so the final text r
(t *testing.T, format string, taskID uint32)
| 23 | // testSetup swaps in a fresh session manager and creates a session with an |
| 24 | // active poison cycle. Returns cleanup func, session ID, and the manager. |
| 25 | func testSetup(t *testing.T, format string, taskID uint32) (cleanup func(), sessionID string, mgr *sessions.Manager) { |
| 26 | t.Helper() |
| 27 | mgr = sessions.NewManager(10 * time.Minute) |
| 28 | old := sessions.SwapGlobal(mgr) |
| 29 | cleanup = func() { sessions.SwapGlobal(old) } |
| 30 | |
| 31 | sess := mgr.Touch("test-key", "test-agent/1.0", format, "test-session-poison") |
| 32 | sessionID = sess.ID |
| 33 | mgr.SetPoisonActive(sessionID, true, taskID) |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | // ginCtx builds a minimal gin.Context with the sessionID stored. |
| 38 | func ginCtx(sessionID string) *gin.Context { |
no test coverage detected