Skip to content

fix(conversation): gate a token-triggered rollover through the optimizer - #1595

Merged
edenreich merged 5 commits into
mainfrom
fix/issue-1592
Oct 20, 2026
Merged

edenreich merged 5 commits into
mainfrom
fix/issue-1592

Conversation

@edenreich

@edenreich edenreich commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1592

Summary

maybeRolloverSession runs at the top of every headless turn and PerformRollover compacted with force=true. That is the force: true on every auto compaction in #1586, and it had three effects on the run there: the backoff from #1584 only guards !force, so a failed summary was retried every turn (five compaction_started in six minutes), each failed attempt still started a new session and copied the full history into it, and the gate estimated over hidden system reminders the compaction then dropped, which is how current_tokens: 497420 was logged under a 500k threshold.

Changes

  • MaybeRollover calls the new performRollover with force=false for the token trigger, so the optimizer applies its own threshold and failure backoff. The idle trigger and the manual PerformRollover (/compact outside the TUI) keep forcing.
  • A gated rollover whose optimizer produced no checkpoint message returns errNoCheckpoint and leaves the session and the group index untouched. Message count cannot tell, since the skill restorer re-emits loaded skills after the checkpoint. MaybeRollover logs it at debug.
  • visibleMessages is shared by the gate and the compaction, so both estimate the same message set.
  • Tests: the fired case asserts force=false, TestMaybeRollover_NoCheckpointKeepsSession pins the failed-summary path over three turns, TestMaybeRollover_IdleTriggerForces pins the idle path, and TestShouldRollover gains a hidden-entries case.

In headless both the rollover and optimizeConversation in the agent loop consult the optimizer once per turn, so a backoff of buffer_size now counts two checks per turn. Unifying the two gates is a separate change.

no docs ticket: internal bug fix.

Session rollover compacted with force=true on every headless turn, so a
failed summary skipped the backoff from #1584 and was retried each turn,
and the rollover still started a new session copying the full history
when nothing was summarised. Its gate also estimated over hidden entries
the compaction then dropped.

A token-triggered rollover now compacts with force=false, so the
optimizer applies its own threshold and failure backoff, and it keeps
the current session when the optimizer returned no reduction. The idle
trigger and the manual PerformRollover keep forcing. The gate estimates
the same visible messages the rollover compacts.
@edenreich

Copy link
Copy Markdown
Contributor Author

@infer please use counterfeiter for fakes or mocks, add this also to your AGENTS.md so this is not repeating, fix this.

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Model: ollama_cloud/glm-5.3-flash · Action: v0.58.0 · CLI: v0.233.0 · View Job

Todos

  • Read Taskfile mocks:generate, optimizer interface, existing fake conventions
  • Add ConversationOptimizer to Taskfile mocks:generate and run counterfeiter
  • Replace hand-written fakeOptimizer in session_rollover_test.go with generated fake
  • Convert fakeRolloverOptimizer in chat_message_processor_test.go
  • Add explicit counterfeiter rule to AGENTS.md
  • Run tests, precommit, commit and push

Pull Request

#1595

✅ Infer Result: Success

Done. The PR now uses counterfeiter-generated fakes everywhere it touches, and AGENTS.md states the rule explicitly so the feedback does not repeat.

What changed

  • Added ConversationOptimizer (from internal/conversation/domain) to Taskfile's mocks:generate and committed the generated tests/mocks/conversation/fake_conversation_optimizer.go (FakeConversationOptimizer).
  • internal/conversation/session_rollover_test.go: removed the hand-written fakeOptimizer struct. Tests now build convmocks.FakeConversationOptimizer and configure it through OptimizeMessagesStub (a small optimizeTailStub helper reproduces the old summary-plus-tail and failed-summary behaviors), assert call counts with OptimizeMessagesCallCount() and the force flag with OptimizeMessagesArgsForCall(0).
  • internal/presentation/tui/handlers/chat_message_processor_test.go: converted the pre-existing hand-written fakeRolloverOptimizer to the same generated fake, since it was the identical violation.
  • AGENTS.md Testing section now reads: never hand-write fake or mock structs in _test.go, not even for a single method; every test double is counterfeiter output committed to tests/mocks/; for an interface without a fake, add a line to mocks:generate, run task mocks:generate, and configure the fake's Stub/Returns fields from the test.

Verification

  • go test ./internal/conversation ./internal/presentation/tui/handlers passes with the same expectations as before (fired case, no-reduction keeps session, idle trigger forces).
  • task precommit:run is green: mocks regenerated deterministically, fmt, lint:imports, golangci-lint 0 issues, markdownlint.
  • Pushed as two conventional commits, both in sync with the PR branch: test(conversation): replace hand-written optimizer fakes with counterfeiter output and docs: require counterfeiter test doubles in AGENTS.md.

no docs ticket: internal-only refactor.

Skipped: I did not sweep the rest of the repo for other hand-written doubles - a grep for the optimizer interface found only these two fakes, and other test doubles I saw in passing are already counterfeiter output. Risk: none known, the stubs behave exactly like the old fakes and the same assertions pass.

Model: ollama_cloud/glm-5.3-flash · Action: v0.58.0 · CLI: v0.233.0 · Exit Code: 0 · Duration: 7m 40s

Tokens: 2,749,148 in · 26,227 out · 2,775,375 total (38 requests)

Tool calls: 57 total · 100% success rate

Traces
Session: 1792530160-00673be6

session (headless, success)                                                                        7m33s
├── chat ollama_cloud/glm-5.3-flash                                                                 2.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
│           ╰── POST [inference-gateway, server]                                                    2.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
├── execute_tool Bash call_a27d4v03                                                                  4ms
├── execute_tool Bash call_sfsbwtb3                                                                  4ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
│           ╰── POST [inference-gateway, server]                                                    1.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
├── execute_tool Read call_vwne60xk                                                                698µs
├── execute_tool Read call_2d34gyib                                                                791µs
├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
│           ╰── POST [inference-gateway, server]                                                    2.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
├── execute_tool Grep call_xja89w5q                                                                719ms
├── execute_tool Bash call_oi9x9zpr                                                                  3ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.1s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.1s
│           ╰── POST [inference-gateway, server]                                                    3.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.1s
├── execute_tool Bash call_j1c43qyz                                                                  3ms
├── execute_tool Grep call_nxwnodse                                                                  1ms
├── chat ollama_cloud/glm-5.3-flash                                                                 7.8s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.7s
│           ╰── POST [inference-gateway, server]                                                    7.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.7s
├── execute_tool TodoWrite call_i4iu0p91                                                            56µs
├── chat ollama_cloud/glm-5.3-flash                                                                 1.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.5s
│           ╰── POST [inference-gateway, server]                                                    1.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.5s
├── execute_tool Read call_10yyb9f8                                                                512µs
├── execute_tool Read call_pdnw1n8l                                                                510µs
├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.4s
│           ╰── POST [inference-gateway, server]                                                    2.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.4s
├── execute_tool Grep call_w4ejvyl5                                                                  1ms
├── execute_tool Read call_45ml3cul                                                                527µs
├── chat ollama_cloud/glm-5.3-flash                                                                 3.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.5s
│           ╰── POST [inference-gateway, server]                                                    3.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.5s
├── execute_tool Grep call_g36hz7fu                                                                717ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.5s
│           ╰── POST [inference-gateway, server]                                                    2.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.5s
├── execute_tool Grep call_kk59mzxb                                                                776ms
├── execute_tool Grep call_nuwe6gfq                                                                529ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.2s
│           ╰── POST [inference-gateway, server]                                                    2.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.2s
├── execute_tool Bash call_54486vuf                                                                  4ms
├── execute_tool Read call_2z6sjnec                                                                523µs
├── chat ollama_cloud/glm-5.3-flash                                                                20.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      20.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    20.3s
│           ╰── POST [inference-gateway, server]                                                   20.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                20.3s
├── execute_tool Read call_oqr6b2b8                                                                471µs
├── execute_tool Read call_ql6wv2tj                                                                465µs
├── execute_tool Read call_xeithz2k                                                                459µs
├── chat ollama_cloud/glm-5.3-flash                                                                21.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      21.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    21.6s
│           ╰── POST [inference-gateway, server]                                                   21.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                21.6s
├── execute_tool TodoWrite call_41edijpc                                                            66µs
├── execute_tool Grep call_a31xrfxz                                                                  1ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.0s
│           ╰── POST [inference-gateway, server]                                                    2.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.0s
├── execute_tool Edit call_psjv6dey                                                                955µs
├── chat ollama_cloud/glm-5.3-flash                                                                 1.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.6s
│           ╰── POST [inference-gateway, server]                                                    1.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.6s
├── execute_tool Bash call_n7twvpsh                                                                10.4s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
├── execute_tool Read call_nj3037e6                                                                476µs
├── chat ollama_cloud/glm-5.3-flash                                                                 9.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       9.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     9.0s
│           ╰── POST [inference-gateway, server]                                                    9.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 9.0s
├── execute_tool Read call_qn9ub0v4                                                                434µs
├── chat ollama_cloud/glm-5.3-flash                                                                10.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      10.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    10.9s
│           ╰── POST [inference-gateway, server]                                                   10.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                10.9s
├── execute_tool MultiEdit call_8u0jkj1i                                                             1ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.8s
│           ╰── POST [inference-gateway, server]                                                    2.8s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.8s
├── execute_tool Memory call_a0qwsjeq                                                              128µs
├── execute_tool Grep call_hsa8w2fe                                                                  1ms
├── execute_tool Read call_xspty8ns                                                                451µs
├── chat ollama_cloud/glm-5.3-flash                                                                 3.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.9s
│           ╰── POST [inference-gateway, server]                                                    3.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.9s
├── execute_tool TodoWrite call_4cd1iemx                                                            57µs
├── execute_tool Grep call_rwmt7yc7                                                                  1ms
├── chat ollama_cloud/glm-5.3-flash                                                                 6.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.6s
│           ╰── POST [inference-gateway, server]                                                    6.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.6s
├── execute_tool MultiEdit call_y9k9g49e                                                           938µs
├── chat ollama_cloud/glm-5.3-flash                                                                 3.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.2s
│           ╰── POST [inference-gateway, server]                                                    3.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.2s
├── execute_tool TodoWrite call_ff21v7t4                                                            68µs
├── execute_tool Edit call_7rk8k0ir                                                                819µs
├── chat ollama_cloud/glm-5.3-flash                                                                 2.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.0s
├── execute_tool TodoWrite call_3i42ygw2                                                            49µs
├── execute_tool Bash call_orpro2yq                                                                39.0s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
│           ╰── POST [inference-gateway, server]                                                    1.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
├── execute_tool Bash call_764sd4qd                                                                 2.0s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.1s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.1s
│           ╰── POST [inference-gateway, server]                                                    1.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.1s
├── execute_tool Bash call_ze0z9tp4                                                                 10ms
├── chat ollama_cloud/glm-5.3-flash                                                                 7.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.2s
│           ╰── POST [inference-gateway, server]                                                    7.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.2s
├── execute_tool Bash call_hlhbjixu                                                                2m57s
├── chat ollama_cloud/glm-5.3-flash                                                                 5.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.9s
│           ╰── POST [inference-gateway, server]                                                    5.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.9s
├── execute_tool Bash call_yohjfrz8                                                                  8ms
├── execute_tool Read call_b9oqcrnf                                                                445µs
├── chat ollama_cloud/glm-5.3-flash                                                                 8.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       8.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     8.5s
│           ╰── POST [inference-gateway, server]                                                    8.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 8.5s
├── execute_tool Bash call_ojgmp03j                                                                 5.1s
├── chat ollama_cloud/glm-5.3-flash                                                                 5.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.7s
│           ╰── POST [inference-gateway, server]                                                    5.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.7s
├── execute_tool Bash call_6t7ah1rd                                                                  5ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.1s
│           ╰── POST [inference-gateway, server]                                                    1.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.1s
├── execute_tool Bash call_4ex2sl9x                                                                  6ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.0s
│           ╰── POST [inference-gateway, server]                                                    3.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.0s
├── execute_tool Bash call_tef7vf1n                                                                  8ms
├── execute_tool Bash call_tasr35uj                                                                  3ms
├── chat ollama_cloud/glm-5.3-flash                                                                 5.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        5.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.2s
├── execute_tool Bash call_jxk5opdq                                                                 5.1s
├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
├── execute_tool Bash call_543g59ao                                                                  5ms
├── chat ollama_cloud/glm-5.3-flash                                                                23.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      23.1s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    23.1s
│           ╰── POST [inference-gateway, server]                                                   23.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                23.1s
├── execute_tool Bash call_wtvss7he                                                                  8ms
├── chat ollama_cloud/glm-5.3-flash                                                                 8.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.9s
│           ╰── POST [inference-gateway, server]                                                    7.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.9s
├── execute_tool Bash call_yc912xre                                                                 5.1s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
│           ╰── POST [inference-gateway, server]                                                    1.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
├── execute_tool Bash call_vr2y9g6y                                                                 1.4s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.5s
│           ╰── POST [inference-gateway, server]                                                    1.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.5s
├── execute_tool Bash call_z8rvl60k                                                                  8ms
├── execute_tool Bash call_6zgs7r4q                                                                  9ms
├── chat ollama_cloud/glm-5.3-flash                                                                 5.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.5s
│           ╰── POST [inference-gateway, server]                                                    5.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.5s
├── execute_tool TodoWrite call_qq9fhbn6                                                            60µs
╰── chat ollama_cloud/glm-5.3-flash                                                                 4.0s
    ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.0s
        ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.0s
            ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        4.0s
                ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.0s
Stats
Tool Calls

╭───────────┬───────┬───────┬─────────╮
│ Tool      │ Calls │ Fail% │ Avg     │
├───────────┼───────┼───────┼─────────┤
│ Bash      │ 23    │ 0%    │ 10655ms │
│ Read      │ 13    │ 0%    │ 514µs   │
│ Grep      │ 9     │ 0%    │ 306ms   │
│ TodoWrite │ 6     │ 0%    │ 57µs    │
│ Edit      │ 2     │ 0%    │ 875µs   │
│ MultiEdit │ 2     │ 0%    │ 1ms     │
│ Memory    │ 1     │ 0%    │ 125µs   │
╰───────────┴───────┴───────┴─────────╯

Token Usage

╭────────────────────────────┬─────────┬─────────┬────────────┬─────────┬──────╮
│ Model                      │ Prompt  │ Cached  │ Completion │ Total   │ Cost │
├────────────────────────────┼─────────┼─────────┼────────────┼─────────┼──────┤
│ ollama_cloud/glm-5.3-flash │ 2749148 │ 2213120 │ 26227      │ 2775375 │ -    │
╰────────────────────────────┴─────────┴─────────┴────────────┴─────────┴──────╯

Sessions

╭───────────┬──────────┬──────────╮
│ Execution │ Mode     │ Sessions │
├───────────┼──────────┼──────────┤
│ headless  │ headless │ 1        │
╰───────────┴──────────┴──────────╯

Triggered by edenreich · Infer Action · OSS

…feiter output

FakeConversationOptimizer is now generated by mocks:generate and both the session rollover tests and the chat rollover fixture configure it through its Stub field and generated accessors instead of hand-writing optimizer stand-ins in tests.

no docs ticket: internal-only refactor.
Makes the existing counterfeiter convention explicit so review feedback like this does not repeat: no hand-written fake or mock structs in tests, every test double is generated by mocks:generate and configured through its Stub or Returns fields.
…age count

The skill restorer re-emits loaded skills after the checkpoint, so a
compacted conversation can hold more messages than before. A gated
rollover now looks for the checkpoint message instead.
@edenreich
edenreich merged commit 50edc7f into main Oct 20, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1592 branch October 20, 2026 21:27
@edenreich edenreich moved this from QA to Done in 2026 Oct 20, 2026
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.234.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Session rollover bypasses compaction backoff and rolls over on a failed summary

1 participant