Resuming a session can leave truncated and concatenated events in events.jsonl
Personne n'a encore pris cette issue.
- Langage dominant
- Shell
- Étoiles
- 11.2k
- Forks
- 1.9k
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 6
Description
Describe the bug
A resumed session contained malformed JSONL records that prevented it from being resumed again.
Three physical lines each contained an incomplete event prefix immediately followed by a complete JSON event without a newline or separator:
{"type":"assistant.message", ... <truncated content>{"type":"assistant.message", ...}
Parsing failed with:
Expecting ',' delimiter
Affected configuration
- GitHub Copilot CLI 1.0.71-0
- Linux
- Model: GPT-5.6 Sol (
gpt-5.6-sol) - Context window: 1.1M
- Reasoning effort: high
- Session resumed with
copilot --resume=<session-id>
The model configuration may not be directly relevant to JSONL persistence, but it is included to make the report reproducible.
Observed behavior
The affected events.jsonl contained three malformed physical lines:
- One truncated
tool.execution_completeprefix followed by a complete event. - Two truncated
assistant.messageprefixes followed by complete events. - The complete suffixes retained the same tool-call or message identifiers as their truncated prefixes.
The complete JSON object began before the preceding incomplete object had been closed or terminated with a newline. The session could not be resumed because the event log was not valid JSONL.
Expected behavior
Session event writes should be atomic and serialized.
When resuming, the CLI should detect and recover from an incomplete trailing record rather than appending another event directly after it. Concurrent processes should also be prevented from writing to the same session without locking.
Workaround
After backing up the session, I discarded each unrecoverable prefix and retained its complete JSON-event suffix. Once every physical line contained exactly one valid JSON object, the session resumed normally.
Possible cause and related issue
Potential causes include:
- Resuming a session while another process still has it open.
- A process being interrupted during an event write.
- Missing locking or recovery around large or chunked JSONL writes.
The same session contained a 72 MB persisted apply_patch event reported in #4097. That unusually large write may have widened the failure window, but there is not enough evidence to claim both issues share the same root cause.
I have not attached events.jsonl because it contains conversation and tool history.
Investigated and filed with assistance from GitHub Copilot CLI.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le flux copilot --resume=<session-id> et suivez la manière dont events.jsonl est écrit et analysé lors de la reprise d’une session. Reproduisez une écriture interrompue ou concurrente si possible, puis vérifiez que les sessions reprises ne créent pas d’enregistrements JSONL concaténés et que les données finales incomplètes sont traitées en toute sécurité.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- shell
- Domaine
- cli
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100