Repository navigation
v1.3.88
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 —
EnsureSessionnow 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 —
InitAgentnow calls
RestoreSessionIntoAgentto 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
SetCheckpointHandlerso
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-memoryses.Messages
is preserved soGetSessionHistory()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 usechatWriteUserMarkdownfor proper markdown rendering. - Team-scoped broadcast — The
/chatbroadcast command now sends to
team members only.
Files Changed
desktop/wailskit/chat.go— Session loading, compaction, checkpoint, renderingdesktop/ggcode-desktop-wails/app.go— Startup session initdesktop/ggcode-desktop-wails/frontend/src/components/ChatView.tsx— LAN Chat rendering, session fallbackdesktop/ggcode-desktop-wails/frontend/src/components/Layout.tsx— Session ID pollingdesktop/ggcode-desktop-wails/frontend/src/components/LanChatView.tsx— Identity refreshdesktop/ggcode-desktop-wails/frontend/src/components/LanChatApprovalDialog.tsx— New componentinternal/tool/lanchat_tool.go— as_agent default, broadcast semanticsinternal/tui/commands.go— Markdown rendering for agent messagesinternal/tui/chat_mode.go— Team-scoped broadcastinternal/tui/lanchat_panel.go— Receipt suppressioninternal/tui/session_history.go— Markdown rendering for historyinternal/lanchat/hub.go— Presence re-broadcast on session changeinternal/config/config.go— Collaboration routing system promptdocs/guide/lan-chat.md— Updated messaging scopes documentation