Skip to content

v1.3.88

Choose a tag to compare

@topcheer topcheer released this 28 Jun 06:23
· 6134 commits to main since this release

v1.3.88

Desktop: Session Loading & History Preservation + LAN Chat Improvements

Desktop Session Auto-Load

Bug: Desktop app created a new empty session on startup instead of
loading existing workspace sessions, even when unlocked sessions with
messages were available.

Fixes:

  • Iterate all workspace sessions — EnsureSession now iterates all
    workspace sessions (newest-first) and loads the first one with actual
    messages that isn't locked by another instance, mirroring TUI behavior.
    Previously it only tried the single newest session.
  • Release session lock on close — Close() now explicitly releases
    the session lock, preventing zombie locks that block other instances.
  • Skip empty sessions — Auto-load skips sessions with zero messages,
    preventing stale auto-created empty sessions from taking priority.
  • Agent context restoration — InitAgent now calls
    RestoreSessionIntoAgent to populate agent context with loaded session
    messages. Without this, the agent started empty and the first
    saveSession() call would overwrite the session with 1-2 messages.
  • Frontend session ID fallback — ChatView self-fetches the session ID
    from the backend as a fallback when the parent's mount polling hasn't
    completed, fixing blank screen on startup.

Compaction History Preservation

Bug: Desktop app destroyed pre-compaction history when saving sessions
after compaction, because saveSession() did a full rewrite with the
agent's compacted messages (summary + recent only).

Fixes:

  • Checkpoint handler — Desktop now sets a SetCheckpointHandler so
    compaction appends a checkpoint record to the JSONL file instead of
    triggering a full rewrite. This matches TUI behavior.
  • Compaction-aware saveSession — saveSession() detects compaction
    (agent has fewer messages than session) and skips the full rewrite,
    only appending new digest messages to disk. In-memory ses.Messages
    is preserved so GetSessionHistory() returns the full conversation.

LAN Chat Message Rendering (Desktop)

Agent-to-agent messages injected via LAN Chat are now rendered properly:

  • "LAN Chat from xxx" label — The [LAN Chat from nick]: prefix is
    parsed into a small sender label above the message, matching the
    IM/Mobile source badge pattern.
  • Injection prefix stripped — The "New user guidance arrived while
    you were working..." prefix is removed from display.
  • Markdown rendering — LAN Chat messages now render as markdown
    instead of plain text.
  • Receipt suppression — Delivery receipts for agent-to-agent messages
    are no longer shown in the chat panel.

lanchat Tool Improvements

as_agent defaults to true — The lanchat tool is almost always
called by the agent itself, so as_agent now defaults to true. The LLM
no longer needs to explicitly pass as_agent=true on every call. Setting
as_agent=false explicitly still works for forwarding messages as the
human user.

to_role defaults to agent — When as_agent is true (the default),
to_role also defaults to agent, ensuring agent-to-agent delivery.

Team-scoped broadcast — broadcast now sends to your own team members
only (respects team isolation). New broadcast_all action sends to
everyone on the LAN.

Multi-recipient DM — send accepts comma-separated node IDs:

lanchat(action='send', to='id1,id2,id3', message='...')

TUI Improvements

  • Markdown rendering — Agent-to-agent messages and history loading
    now use chatWriteUserMarkdown for proper markdown rendering.
  • Team-scoped broadcast — The /chat broadcast command now sends to
    team members only.

Files Changed

  • desktop/wailskit/chat.go — Session loading, compaction, checkpoint, rendering
  • desktop/ggcode-desktop-wails/app.go — Startup session init
  • desktop/ggcode-desktop-wails/frontend/src/components/ChatView.tsx — LAN Chat rendering, session fallback
  • desktop/ggcode-desktop-wails/frontend/src/components/Layout.tsx — Session ID polling
  • desktop/ggcode-desktop-wails/frontend/src/components/LanChatView.tsx — Identity refresh
  • desktop/ggcode-desktop-wails/frontend/src/components/LanChatApprovalDialog.tsx — New component
  • internal/tool/lanchat_tool.go — as_agent default, broadcast semantics
  • internal/tui/commands.go — Markdown rendering for agent messages
  • internal/tui/chat_mode.go — Team-scoped broadcast
  • internal/tui/lanchat_panel.go — Receipt suppression
  • internal/tui/session_history.go — Markdown rendering for history
  • internal/lanchat/hub.go — Presence re-broadcast on session change
  • internal/config/config.go — Collaboration routing system prompt
  • docs/guide/lan-chat.md — Updated messaging scopes documentation