Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Fix activity log bloat causing 100% CPU and approval race condition - #13

Merged
shafty023 merged 2 commits into
mainfrom
AI-402
Mar 12, 2026
Merged

shafty023 merged 2 commits into
mainfrom
AI-402

Conversation

@shafty023

Copy link
Copy Markdown
Contributor

Truncate request/response bodies to 8KB in ActivityLogStore to prevent the persisted JSON from growing unbounded (was 100MB). On startup, migrate existing oversized bodies and trim excess entries.

Handle approval-not-found gracefully in IPC handlers instead of throwing, preventing errors when approvals expire between UI render and user action.

Truncate request/response bodies to 8KB in ActivityLogStore to prevent
the persisted JSON from growing unbounded (was 100MB). On startup,
migrate existing oversized bodies and trim excess entries.

Handle approval-not-found gracefully in IPC handlers instead of throwing,
preventing errors when approvals expire between UI render and user action.
@linear

linear Bot commented Mar 12, 2026

Copy link
Copy Markdown
AI-402 Fix ANR in electron app

Activity log is storing full log outputs and that's bringing our app to a halt. We'll truncate the responses.

Comment thread apps/desktop/src/main/app.ts Outdated
Comment thread apps/desktop/src/main/activity-log-store.ts Outdated
@closedloop-ai-stage

Copy link
Copy Markdown

Code Review Summary

Status: Approved

Reviewers: Bug Hunter A, Bug Hunter B, Unified Auditor, Premise Reviewer, persistence-expert

Findings

Severity Count
Blocking 0
High 0
Medium 2

MEDIUM Issues (consider)

  1. [P2] [apps/desktop/src/main/app.ts:731] Inconsistent return type in always-allow-approval early-exit path
  2. [P3] [apps/desktop/src/main/activity-log-store.ts:96] truncateBody reports JS character count as "bytes total" — inaccurate for multi-byte Unicode

Validation Stats

  • Agent failures: 0 partitions skipped
  • Cross-file grouped: 0 findings consolidated

Recommendation: Approve — no blocking or high-priority issues found. Two medium-severity correctness nits are worth considering but do not block merge.

Return consistent { pendingApprovals, settings } shape from the
always-allow-approval early-exit path. Also remove the second throw
for the same race condition. Change truncation label from "bytes" to
"chars" since body.length measures JS characters not UTF-8 bytes.
@shafty023
shafty023 merged commit 3912e9c into main Mar 12, 2026
1 check passed
@shafty023
shafty023 deleted the AI-402 branch March 12, 2026 23:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant