fix(glm): stabilize reasoning and context reporting#3615
Conversation
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/core/src/sessions/sessionService.ts:2043-2045
**Stale Values Pass ID Filter**
When a live select option keeps the same `id` but removes or renames the persisted value, this filter still restores that stale value. The failed mutation is only logged after the stale value has already been merged into local and persisted state, so the connected UI can show a setting the resumed agent did not accept.
### Issue 2 of 2
packages/core/src/sessions/sessionService.ts:2047
**Missing Capabilities Restore Everything**
When reconnect omits `configOptions`, such as after session compaction, this fallback restores every persisted option without checking whether the resumed agent still supports it. A stale reasoning-effort option can therefore reach `setConfigOption` and reproduce the reconnect failure this change is intended to prevent.
Reviews (1): Last reviewed commit: "fix(sessions): skip unsupported settings..." | Re-trigger Greptile |
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
The fix correctly filters restored options by ID match when live options are available, but the greptile bot raised valid P1 concerns — still present in the current diff — that the fix is incomplete: the compaction fallback (liveConfigOptions undefined) restores every persisted option unfiltered, which is the exact path where the original reconnect failure can reproduce. These bot concerns were not addressed between the flagged commit and the current head.
Restore only the persisted config options a resumed session still advertises and still offers a value for; when the agent reports no options (e.g. after compaction) restore nothing rather than push a value it may reject. Define GLM 5.2 reasoning as high/max across session controls and cloud-run validation, normalize its 1M context window when the gateway reports stale metadata, and keep context usage monotonic across incomplete stream and compaction snapshots.
d46882d to
72f2e42
Compare
There was a problem hiding this comment.
No showstoppers. The two P1 bot concerns (stale-value ID filter, compaction fallback restoring everything unvalidated) are both addressed in the current diff — isPersistedOptionSupported validates value availability, and the compaction path conservatively restores nothing. The stamphog bot reviewed an older commit; the current head resolves both issues with test coverage.
Problem
Why: GLM 5.2 sessions could restore unsupported reasoning settings, use a stale 128K context window, and replace trustworthy context usage with incomplete stream or compaction readings. This made the context meter jump between full and empty.
Changes
highandmaxonly across session controls and cloud-run request validation.