mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #400] [CLOSED] fix(glm): preserve turn checkpoints after restoring conversation slots #515
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#515
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/400
Author: @Zcg2021
Created: 10/22/2026
Status: ❌ Closed
Base:
main← Head:codex/glm-slot-turn-checkpoint📝 Commits (2)
8714483fix(glm): checkpoint restored conversation slots before a new turn5d93b90test(glm): document and reproduce slot-restored turn edits📊 Changes
6 files changed (+1893 additions, -17 deletions)
View changed files
➕
bench/results/2026-10-23-glm-slot-turn/README.md(+152 -0)➕
bench/results/2026-10-23-glm-slot-turn/engine-excerpts.txt(+20 -0)➕
bench/results/2026-10-23-glm-slot-turn/results.json(+1496 -0)📝
src/program/generate.cpp(+19 -17)➕
tools/repro_glm_slot_turn.py(+126 -0)➕
tools/test_repro_glm_slot_turn.py(+80 -0)📄 Description
Problem
With one GLM sequence, switching A → B → A can restore A's conversation slot correctly, but editing the short user turn just submitted after that restore rereads the whole conversation. At 248K tokens this meant approximately four minutes before the first output.
The turn-start checkpoint introduced in #253 was captured before
slot_take. Consequently it only covered an already-live snapshot. Slot restoration happened later and invalidated the previous conversation's checkpoints.Change
Move the existing turn-start checkpoint block after slot restoration and
ckpt_drop_past(reuse), before prefill. The restored snapshot can then be retained before prefill replaces it. No condition, model arithmetic, CUDA call, public API, flag default, checkpoint layout or slot serialization changes.This PR contains only the upstream checkpoint fix, a synthetic HTTP reproduction probe with six CPU tests, and the measurement report. It does not contain the local alesha projection implementation.
Reproduction
Use an isolated idle GLM server,
--parallel 1, normal slot/checkpoint defaults, fresh per-arm slot directories, and identical model/settings. Do not run against production.Run the included stdlib probe against the unpatched/patched server respectively:
--base-urland the optionalMAYA_API_KEYenvironment variable select the isolated endpoint. The probe checks synthetic archive facts, restored prefix reuse and a short edited tail, without imposing a machine-dependent latency threshold. The probe itself has CPU/mocked-HTTP coverage; the GPU results below came from the earlier 23-request harness, not this new four-request script.Measured result
Same frozen synthetic workload, one serial run per arm, Windows 11 build 26100, Ryzen 9 5900X, 128 GB RAM, RTX 3090 24 GB, CUDA 12.8. Both GPU arms used Maya-M with alesha runtime projection, v1.1.21 (
451f9cb) plus that local projection port; candidate additionally applied only this ordering fix. These are not stock-model or current-main GPU measurements.Full settings, scope, per-request metrics/assertions/output hashes and selected native logs:
bench/results/2026-10-23-glm-slot-turn/README.md.Current-main validation and compatibility
Based on
main25deec5(after v1.1.24). The completegenerate.cppfile was unchanged from the measured v1.1.21 base; the slot-load and checkpoint-copy implementations were also unaffected by intervening changes.Local Python 3.12 checks:
python tools/check_hip_compat.py: passed.python -m unittest tools.test_repro_glm_slot_turn: 6 passed.python -m unittest discover -s serve -p 'test_*.py' -t .: 342 tests, OK, 11 skipped./proc/meminfo, and macOS/varvs/private/varpath assumptions). These are not reported as passing local tests; the equivalent Ubuntu suite passed below.Ubuntu CI on this PR head
5d93b90: passed in 2m15s. Full run and logs:This is the fork's run of the repository's unchanged
tests.ymlworkflow. It does not substitute for upstream maintainer approval or GPU validation.No current-main CUDA build/GPU rerun, stock-model A/B, HIP runtime, multi-GPU, RAM-slot or long-soak result is claimed. The maintainer GPU gates in CONTRIBUTING.md still apply.
For future rebases, preserve restore selected state → invalidate incompatible checkpoints → retain valid turn-start snapshot → prefill and the existing snapshot-copy synchronization. Existing single-sequence/fast-path/text-only/reuse/checkpoint guards and
STRATA_GLM_CKPT_TURN=0opt-out remain unchanged. Old slot files need no migration. This does not persist all historical checkpoints: earlier edits, changed prefixes, evictions and cold restarts can still reread history.Related #387 touches the same function for multi-sequence shared-prefix slots; it addresses a different guarded path. Both probes should be rerun if those changes are combined.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.