Repository navigation
v1.3.100
v1.3.100
Critical fixes
Session JSONL no longer destroys pre-compaction message history
This release fixes a critical data-loss bug that affected all three modes (TUI, daemon, GUI).
Root cause: Every time the agent's context manager compacted messages (replacing earlier turns with a summary), the session persistence code overwrote ses.Messages with the compacted version and called Save() — which rewrote the entire JSONL file from scratch. All pre-compaction message records were permanently destroyed on every compaction cycle.
Symptoms: When reloading a session, conversation history was truncated — earlier user messages, tool calls, and assistant responses were silently missing from the rendered view.
Fix — three layers:
-
TUI
persistFullSessionMessages(): Changed fromSave()(full rewrite) to incrementalAppendMessageToDisk()— only new messages are appended, never rewriting existing records. -
loadSession(): Now loads ALL message records from the JSONL file intoses.Messages(for rendering), regardless of checkpoints. Previously, only the last checkpoint + post-checkpoint messages were loaded, discarding everything before the checkpoint. A newses.ContextMessagesfield holds the compacted version for agent LLM restoration only. -
Daemon exit/restart paths: Replaced
ses.Messages = ag.Messages()+store.Save(ses)withAppendMetaToDisk()— no more full rewrite on shutdown or self-restart.
New separation of concerns:
| Field | Purpose | Populated by |
|---|---|---|
ses.Messages |
Full conversation history for TUI rendering | loadSession() — ALL message records |
ses.ContextMessages |
Compacted messages for agent LLM context | loadSession() — last checkpoint + post-checkpoint |
| Agent context manager | What gets sent to the LLM | RestoreSessionIntoAgent() from ContextMessages |
No data migration needed: Old session files are read as-is. The fix only changes how messages are loaded and persisted going forward. Pre-existing data loss from old Save() rewrites is irreversible (those records were already destroyed).
Tunnel event memory bound
MaxTunnelEvents = 2000cap on in-memory tunnel events to prevent session files from growing to hundreds of MB. Previously, tunnel events accumulated unboundedly (one session had 202K tunnel events / 484MB). The cap applies toloadSession(), TUI append, and daemon/desktop append paths.- Removed
f.Sync()fromappendRecordLine()(was called 222K+ times per session). - Removed unnecessary index updates from tunnel event and metric append paths.
Features
/retrycommand: Re-run the last submission after an error without retyping the prompt./editcommand: Edit and resend the last submission. Opens the existing text in the input field for modification before re-submitting.- Cron persistence per session: Cron jobs are now persisted and loaded per-session instead of per-workspace, preventing cross-session interference. Uses
~/.ggcode/cron-jobs.jsonwith SHA256-keyed grouping.
Files changed
22 files changed, +671/-269 lines since v1.3.99.