Skip to content

fix: grouped low-severity backend & frontend correctness fixes (lr-129b)#237

Open
akuehner wants to merge 1 commit into
mainfrom
fix/lr-129b-grouped-correctness-fixes
Open

fix: grouped low-severity backend & frontend correctness fixes (lr-129b)#237
akuehner wants to merge 1 commit into
mainfrom
fix/lr-129b-grouped-correctness-fixes

Conversation

@akuehner

Copy link
Copy Markdown
Member

Task: lr-129b

Eight independent low-severity correctness fixes across backend and frontend.

9a. daemon-projects periodic rescan broadcasts projectCount: 0

rescanWorktrees interval closure did not pass config, so config was always undefined and projectCount was always 0. Broadcast now uses relay.getProjects().length directly.

9b. loop_complete notification always reported sessionId: null

loopState.currentSessionId was cleared at line 693 before being read at the notification call. Captured into _lastSessionId before the clear, following the same pattern used for _loopOwnerUserId.

9c. cli.js printed literal "undefined" in the setfacl install hint

The ANSI table a had no cyan key. Added cyan: "\x1b[36m" so the a.cyan reference in the setfacl hint renders correctly.

9d. saveConfig fire-and-forget before process.exit(120) in spawnAndRestart

saveConfig is async; process.exit(120) frequently fired before the write flushed, leaving daemon.json with a stale PID. Now uses fs.writeFileSync on the exit path with a synchronous fallback to saveConfig on write error.

9e. worker shutdown resolved callbacks with Error objects

pendingAskUser[k] and pendingElicitations[k] were resolved with new Error(...) where the SDK expects shaped objects. Changed to { behavior: "deny", message: "Worker shutting down" } and { action: "reject" }.

9f. upload size limit enforced only after full body was buffered

parseJsonBody accumulated body += chunk unbounded; the size check ran only after full accumulation. Now tracks accumulated byte length per chunk and destroys the request once it exceeds MAX_UPLOAD_BYTES * 1.4, preventing large in-memory buffers before the limit fires.

9g. countdown timer never started after sessions loaded

startCountdownTimer() was called once at init when the schedule list was empty and returned early. Nothing re-invoked it when schedules later entered the 3-minute window. Added a call at the end of renderSessionList — it is a no-op when schedules are outside the window or the timer is already running.

9h. permission_request re-render duplicated a card on WS reconnect

renderPermissionRequest deduped against the in-memory pendingPermissions map only. On reconnect, pendingPermissions is cleared while the prior DOM node (carrying data-request-id) may survive, causing a duplicate card. Added a DOM query check before the append.

Test plan

  • npm test passes (exit 0)
  • Manual spot-check of each symptom path is per the task acceptance criteria

9a: daemon-projects rescan now broadcasts relay.getProjects().length instead of
    config.projects.length (config was always undefined in the interval closure)

9b: loop_complete notification captures currentSessionId into _lastSessionId
    before clearing loopState, so sessionId is no longer always null

9c: add cyan entry to ANSI table in bin/cli.js so the setfacl install hint
    renders correctly instead of printing literal "undefined"

9d: spawnAndRestart writes updated PID synchronously (fs.writeFileSync) before
    process.exit(120), preventing a race window with a concurrent CLI read

9e: worker shutdown resolves pendingAskUser with {behavior:"deny",...} and
    pendingElicitations with {action:"reject"} instead of Error objects

9f: parseJsonBody tracks accumulated byte length during streaming and destroys
    the request once it exceeds MAX_UPLOAD_BYTES*1.4, before full buffering

9g: renderSessionList calls startCountdownTimer() after each render so the
    countdown UI appears when schedules enter the 3-minute window post-init

9h: renderPermissionRequest checks DOM for an existing data-request-id node
    before appending, preventing duplicate cards on WS reconnect

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant