[codex] harden Metal failure recovery#184
Closed
Chedrian07 wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Harden Metal backend failure recovery after command-buffer errors and make decode command batches easier to diagnose.
What changed
checkpoint_valid, so stale token lengths and checkpoint tokens are not exposed as live KV state after a backend error.DS4_METAL_GRAPH_TOKEN_FLUSH_EVERYto split decode command buffers every N layers while preserving the existing default split behavior.Root cause
After a Metal command-buffer failure, the session only marked
checkpoint_valid=false;checkpoint.lenand token history remained visible through session accessors. The server could then observe a nonzero live position even though common-prefix matching correctly returned zero, which made recovery and cache decisions operate around stale state. Cold rebuilds also relied on prefill overwriting prior graph state instead of resetting the Metal compressor/indexer frontiers first.Validation
make ds4-servermake allmake ds4_cpu.o ds4_server_cpu.o./ds4_test --server --metal-kernelsmake testwas also run. It compiled and passed long-context, tool-call-quality, metal-kernels, and server tests, but failedlogprob-vectorsonlong_memory_archive. The same./ds4_test --logprob-vectorsfailure reproduces on cleanorigin/mainwith the same local model/fixtures, so it is not introduced by this PR.