pub fn fix_cancelled_model_state(path: &Path) -> Result<bool>Expand description
Fix cancelled modelState values in a compacted (single-line) JSONL session file.
VS Code determines lastResponseState from the file content, not the index.
If the last request’s modelState.value is 2 (Cancelled) or missing entirely,
VS Code refuses to load the session. This function:
- Finds the last request in the
requestsarray - If
modelState.valueis2(Cancelled), changes it to1(Complete) - If
modelStateis missing entirely, adds{"value":1,"completedAt":<now>}
Returns true if the file was modified.