Skip to content

v1.3.100

Choose a tag to compare

@topcheer topcheer released this 01 Jul 12:18
· 5980 commits to main since this release

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:

  1. TUI persistFullSessionMessages(): Changed from Save() (full rewrite) to incremental AppendMessageToDisk() — only new messages are appended, never rewriting existing records.

  2. loadSession(): Now loads ALL message records from the JSONL file into ses.Messages (for rendering), regardless of checkpoints. Previously, only the last checkpoint + post-checkpoint messages were loaded, discarding everything before the checkpoint. A new ses.ContextMessages field holds the compacted version for agent LLM restoration only.

  3. Daemon exit/restart paths: Replaced ses.Messages = ag.Messages() + store.Save(ses) with AppendMetaToDisk() — 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 = 2000 cap 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 to loadSession(), TUI append, and daemon/desktop append paths.
  • Removed f.Sync() from appendRecordLine() (was called 222K+ times per session).
  • Removed unnecessary index updates from tunnel event and metric append paths.

Features

  • /retry command: Re-run the last submission after an error without retyping the prompt.
  • /edit command: 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.json with SHA256-keyed grouping.

Files changed

22 files changed, +671/-269 lines since v1.3.99.