Bug Report & Fix Log — 2026-03-09 Session #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This issue documents all bugs diagnosed and fixed during the 2026-03-09 session. All fixes are infrastructure-level (Node.js daemon + Go plugin). No behavioral/prompt changes.
Bug 1: Token Burn — 13 Sessions Heartbeating Simultaneously
Symptom: Anthropic returning
overloaded_error. High token usage. Agent sessions staying alive for hours.Root cause: Multiple agent sessions each triggering 30-minute heartbeats with full context. 13 concurrent sessions × full context = massive parallel LLM load.
Fix: Set
heartbeat.lightContext: truein gateway config. Reduces input tokens per heartbeat by ~80%. Real work turns unaffected.heartbeat.everykept at30mper user preference.Bug 2: Status Box Stayed Active 60s After Turn Complete
Symptom: Status box showed "Agent session active" long after reply was sent.
Root cause: Daemon used a 60-second file inactivity timer to detect turn completion. No infrastructure signal was used.
Fix 1 (commit
b7c5124): Detectopenclaw.cache-ttlcustom record in JSONL stream. Gateway writes this after every completed assistant turn. On detection withpendingToolCalls === 0, fire 3-second grace timer instead of waiting 60s.Fix 2 (commit
cdef7a1): Watch.jsonl.lockfile deletion. Gateway deletes the lock file the instant the final reply is sent. On deletion → calltriggerIdle()immediately. Zero wait, no timer. This is now the primary done signal.Bug 3: Status Box Not Appearing on New Messages (Reactivation Failure)
Symptom: After a session completed, sending a new message did not bring up a new status box.
Root cause (layer 1):
_completedSessionscooldown — 5-minute file-staleness check prevented re-detection. Changed to usesessions.json updatedAt > completedAttimestamp comparison (infrastructure signal, no AI involvement).Root cause (layer 2, commit
f545cb0): Ghost watch — afterremoveSession(), thefileToSessionmapping was deleted sofs.watchfired but had nothing to match. Fixed: keep mapping as\x00ghost:prefix entry. On ghost file change → emitsession-reactivate→clearCompleted+pollNow.Root cause (layer 3, commit
b0cb6db):_knownSessionswas replaced wholesale (this._knownSessions = currentSessions) at end of every_poll(). This meantforgetSession()had zero effect — next poll immediately re-added the key as "known" without firing_onSessionAdded. Fixed: maintain_knownSessionsincrementally (.set()/.delete()).Root cause (layer 4, commit
cc65f9b):clearCompleted()removed from_completedSessionsbut left key in_knownSessions. SoisKnown=truesuppressed_onSessionAddedeven after ghost watch fired. Fixed:clearCompleted()now deletes from both maps.Bug 4: Stale File Offset — No Content Updates Sent to Plugin
Symptom: Status box created but never updated with any content. Lines stayed at 0.
Root cause: Persisted offset file (
/tmp/status-watcher-offsets.json) hadlastOffset: 1,718,497but JSONL file was only1,715,183bytes (context compaction had shrunk the file). Every_readFilecall returned 0 bytes silently becausefileSize <= lastOffset.Fix (commit
b0cb6db): WhenfileSize < lastOffset(stale or post-compaction), resetlastOffsettofileSize(current end of file). Previously reset to 0, which would re-parse gigabytes of old content. Resetting tofileSizemeans only new bytes from this point forward are read.Bug 5: Status Box Not Triggered Until First Reply Token
Symptom: Status box appeared only when the first JSONL content was written, not when user message was received. Turns with no tool calls showed nothing.
Root cause: Daemon watched only
.jsonlfile changes. First write happens after the model starts generating, not when message is received.Fix (commit
0bdfaaa): Watch.jsonl.lockfile creation. Gateway writes this the instant it starts processing a user message — before any JSONL content. On lock creation →clearCompleted+pollNow→ status box created immediately. Latency: <100ms from message receipt.Bug 6: Orphan KV Sessions With Zero Timestamps
Symptom: Multiple "Agent session active" posts in channels with no corresponding running session. Plugin health showed active sessions that were not real.
Root cause:
CleanStaleSessions()instore.gohad acontinuestatement for sessions whereLastUpdateMs == 0 && StartTimeMs == 0(sessions created before cleanup was implemented). These were skipped forever.Fix: Rebuilt Go plugin. Non-active sessions with zero timestamps → deleted immediately. Active sessions with zero timestamps → interrupted immediately, then deleted on next cleanup cycle. Binary rebuilt via Docker (
golang:1.22-alpine) and deployed.Bug 7: Reactivated Session Reusing Stale Plugin Post
Symptom: After reactivation, no new status box appeared. Old completed post was silently reused.
Root cause:
session-addedhandler calledfindExistingPost()(REST search) even in plugin mode. It found the old completed/done plugin post via Mattermost search API and reused the post ID, sopluginClient.createSession()was never called.Fix (commit
cc65f9b): SkipfindExistingPostentirely when in plugin mode. Plugin always creates a freshcustom_livestatuspost viapluginClient.createSession(). Plugin KV entry is replaced atomically so no duplicate boxes.Summary Table
lightContext: truein gateway configopenclaw.cache-ttl→ 3s graceb7c5124.jsonl.lockdeletion →triggerIdle()cdef7a1sessions.json updatedAtcomparisonb320bcf\x00ghost:entry infileToSessionf545cb0_knownSessionsreplaced wholesale each pollb0cb6dbclearCompletedleft key in_knownSessionsclearCompletedcc65f9bfileSizenot 0b0cb6db.jsonl.lockcreation0bdfaaafindExistingPostran in plugin modecc65f9bTriaged. This is a documentation/tracking issue logging 7 infrastructure bugs diagnosed and fixed during the 2026-03-09 session.
All fixes are already applied (commits referenced inline). No action items remain open. Marking for archival/reference.
Summary:
This issue can be closed once the team confirms nothing was missed.
Acknowledged. Fix log received and recorded for issue #8 (2026-03-09 session). 7 bugs documented with commits
b7c5124,cdef7a1,b320bcf,f545cb0,b0cb6db,cc65f9b,0bdfaaaplus Go plugin rebuild. Closing as complete.