You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #129 (feat/issue-124) has 3 critical bugs found in code review. Fix them on the existing branch feat/issue-124.
Bugs to fix
1. u32 timestamp overflow (cloud_monitor.zig)
last_event_times uses u32 but std.time.timestamp() returns i64. Fix:
// BEFORE (broken):varlast_event_times: [MAX_AGENTS][2]u32=...last_event_times[i][1] =@as(u32, @intCast(now));
// AFTER:varlast_event_times: [MAX_AGENTS][2]i64=...last_event_times[i][1] =now;
2. entry_idx logic bug — duplicates for out-of-order JSONL (cloud_monitor.zig)
In restoreStateFromEvents, when a later JSONL line has older timestamp, entry_idx stays null but code falls through to add a duplicate. Fix:
if (latest_issue[i] ==issue) {
entry_idx=i; // ALWAYS set entry_idx when issue matchesif (ts>latest_ts[i]) {
latest_ts[i] =ts; // only update timestamp if newer
}
break;
}
3. appendEvent buffer too small (cloud_monitor.zig)
Context
PR #129 (feat/issue-124) has 3 critical bugs found in code review. Fix them on the existing branch
feat/issue-124.Bugs to fix
1. u32 timestamp overflow (cloud_monitor.zig)
last_event_timesusesu32butstd.time.timestamp()returnsi64. Fix:2. entry_idx logic bug — duplicates for out-of-order JSONL (cloud_monitor.zig)
In
restoreStateFromEvents, when a later JSONL line has older timestamp,entry_idxstays null but code falls through to add a duplicate. Fix:3. appendEvent buffer too small (cloud_monitor.zig)
512-byte buffer silently drops long events. Fix:
4. JSON output buffer (tri_cloud.zig)
Increase from 65536 to handle more events, or add proper truncation with valid JSON closing.
Instructions
git checkout feat/issue-124(branch already exists with PR feat(cloud): JSONL event persistence + deduplication + JSON history format (#124) #129)tools/mcp/trinity_mcp/cloud_monitor.zigandsrc/tri/tri_cloud.zigzig fmt src/ tools/fix(cloud): timestamp overflow, entry_idx duplicates, buffer sizes (#129)feat/issue-124Do NOT create a new PR — push to the existing branch.