Skip to content

feat(resume): Resume Pipeline — "continue exactly where you left off"#51

Merged
BotCoder254 merged 1 commit into
mainfrom
feat/resume-pipeline
Jul 6, 2026
Merged

feat(resume): Resume Pipeline — "continue exactly where you left off"#51
BotCoder254 merged 1 commit into
mainfrom
feat/resume-pipeline

Conversation

@BotCoder254

@BotCoder254 BotCoder254 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Reopening a session now revalidates the repository against the state the session last saw and hands the agent a structured repository delta, so it resumes against verified repository reality instead of a stale transcript. The Claude Agent SDK persists the conversation (options.resume) but explicitly not filesystem/repository state; this platform service — owned by the app, like Memory and Search — closes that gap. Fully local, bounded argv-only git, and it never blocks session switching.

Deep dive: docs/architecture/subsystems/resume-pipeline.md.

What's included

Main process

  • ResumeManager + delta.ts — per-session repository snapshots (HEAD + branch + a content-free dirty hash via lstat), activation-time revalidation with a cheap short-circuit and a 10s deadline (degrades to "no delta" on any failure), and an argv-only repository delta: ahead/behind counts, capped commit list, --name-status merged with the dirty set, category flags (manifests/lockfiles/limboo.json/migrations), plus history-rewrite and root-change detection.
  • Schema v10session_snapshots + resume_deltas (persisted so a pending one-shot injection survives a restart).
  • Code intelligence (schema v11)search_files.content_hash skips unchanged files in incremental indexing (no FTS churn); a new parser-agnostic search_refs import-edge table powers importer counts; per-file symbol adds/removes are diffed across a reindex. No tree-sitter, no embeddings.
  • Memory revalidationmemory_links is now written on create/acceptProposal; memories whose linked files vanish are confidence-downgraded (×0.6, floor 0.1) and restored when the file returns.
  • InjectionAgentManager.resumeContextFor is a third context producer rendering a one-shot <repository-delta> block, cached on the run record so recovery retries re-inject the same block.
  • IPCresume:getState/getDelta/dismiss/revalidate (string session ids only; revalidate gated to the active session) + resume:state-changed; preload window.limboo.resume.

Renderer (existing UI idioms only, pure-black tokens)

  • ResumeBanner (missing-worktree-banner idiom), a "Revalidating…" header chip, ResumeDeltaDialog (hooks-confirm idiom), useResumeStore; settings under Memory & Search (settings.resume, RESUME_LIMITS).

Docs — deep subsystem doc, docs index + README updates, and a CLAUDE.md section.

Architecture notes

  • Wired in the composition root with the standard setter-injection pattern; the activation hook is a separate additive sessions.onActiveChanged listener, so the existing effective-root retarget path is untouched. Boot revalidation chains strictly after worktree recovery.
  • Zero interaction with options.resume or the corrupted-resume self-heal — the delta rides systemPrompt.append beside the memory/search blocks.

Verification

  • npm run lint clean; renderer vite build + main/preload esbuild bundles clean.
  • 25 delta-engine assertions against a real git repo (categorization, --porcelain=v1 -z parsing, ahead/behind, commit list, dirty-merge, manifest flags, fast-forward vs. history-rewrite, block budget, ref resolution incl. traversal rejection, symbol extraction).
  • DDL + queries validated against a live SQLite engine (new tables, content_hash, importer-count query, snapshot/delta upserts, memory-downgrade JOIN).
  • Not covered here: the full Electron GUI end-to-end run (banner/chip/dialog on screen) — needs a display; worth a manual smoke test on merge.

Security

Argv-only git (snapshot HEAD regex-validated before entering any argv), parameterized SQL only, isInsideRoot-guarded lstat, string-id-only IPC (no prototype-pollution surface), memory link paths validated/normalized, and no commit subjects/paths in logs.

🤖 Generated with Claude Code


Note

Medium Risk
Touches agent prompt composition, session activation git work, and DB schema v11 migrations; failures are designed to degrade to no delta and not block switching, but incorrect deltas could mislead the agent.

Overview
Introduces the Resume Pipeline so reopening a session compares the worktree to a persisted repository snapshot (HEAD, branch, content-free dirty hash) instead of relying only on SDK conversation resume.

Main process: New ResumeManager and delta.ts upsert session_snapshots and resume_deltas (schema v10), run deadline-bounded revalidation on session switch and post–worktree-recovery boot, and compute argv-only git deltas (commits, files, manifests/migrations, history rewrite / root change). AgentManager adds a third systemPrompt.append producer (<repository-delta>), one-shot per delta with run-level cache for recovery retries, plus snapshots at run end; GitManager re-anchors on checkpoints. Search gains content_hash skip-on-unchanged indexing, search_refs import edges, and APIs for symbol diff and importer counts (schema v11). Memory persists memory_links on create (with optional filePath / symbolRefs from IPC) and downgrades/restores confidence when linked files disappear or return.

Bridge & UI: window.limboo.resume, resume IPC handlers, useResumeStore, ResumeBanner, header “Revalidating…” chip, and ResumeDeltaDialog; Memory & Search settings for settings.resume and RESUME_LIMITS. Docs/README/CLAUDE updated for the subsystem.

Reviewed by Cursor Bugbot for commit 20375e3. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added a session resume flow that can detect repository changes after a pause and show a reviewable delta before continuing.
    • Introduced a new resume banner and detailed dialog in the app UI, plus a “Revalidating…” status indicator.
    • Added new settings to control resume revalidation and whether repository changes are injected into the next prompt.
  • Bug Fixes

    • Improved handling of memory/file links and repository reference tracking for more reliable resume and search results.

…eft off"

Reopening a session now revalidates the repository against the state the session
last saw and hands the agent a structured repository delta, so it resumes against
verified repository reality instead of a stale transcript. The Claude Agent SDK
persists the conversation (options.resume) but not filesystem/repository state;
this platform service (owned by the app, like Memory/Search) closes that gap.

Main process:
- ResumeManager + delta.ts: per-session repository snapshots (HEAD + branch +
  content-free dirty hash), activation-time revalidation with a cheap short-circuit
  and a bounded deadline, and an argv-only git delta (ahead/behind, capped commit
  list, name-status merged with the dirty set, category flags incl. limboo.json,
  history-rewrite and root-change detection). Never blocks session switching.
- Schema v10: session_snapshots + resume_deltas (persisted so a pending one-shot
  injection survives a restart).
- Code intelligence (schema v11): search_files.content_hash skips unchanged files
  in incremental indexing; new search_refs regex import-edge table (parser-agnostic)
  powers importer counts; per-file symbol adds/removes diffed across a reindex.
- Memory revalidation: memory_links now written on create/acceptProposal; memories
  whose linked files vanish are confidence-downgraded (x0.6, floor 0.1) and restored
  when the file returns.
- Injection: AgentManager.resumeContextFor is a third context producer rendering a
  one-shot <repository-delta> block, cached on the run record for recovery retries.
- IPC: resume:getState/getDelta/dismiss/revalidate (string ids only; revalidate
  gated to the active session) + resume:state-changed; preload window.limboo.resume.

Renderer (existing UI idioms only, pure-black tokens):
- ResumeBanner, a "Revalidating..." header chip, ResumeDeltaDialog, useResumeStore;
  settings under Memory & Search (settings.resume, RESUME_LIMITS).

Docs: deep subsystem doc (docs/architecture/subsystems/resume-pipeline.md), docs
index + README updates, and a CLAUDE.md section.

Verified: lint clean, renderer build + main/preload esbuild bundles clean, 25 delta
assertions against a real git repo, and DDL/queries against a live SQLite engine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR implements a comprehensive Resume Pipeline feature that enables developers to resume development sessions with full awareness of repository changes that occurred while the session was suspended. The implementation is well-architected with proper security controls and error handling.

Key Strengths:

  • Parameterized SQL queries throughout - all values are bound via placeholders, never concatenated
  • Git operations use argv-only invocations through the shared runner (no shell execution)
  • Proper input validation with regex guards before git commands
  • All data structures are bounded by RESUME_LIMITS constants
  • Graceful degradation on failures - never blocks session operations
  • Comprehensive database schema with appropriate indexes

The code follows all security best practices documented in CLAUDE.md §6 and is ready for merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a "Resume Pipeline" that snapshots per-session repository state, computes and persists structured repository deltas, enriches them via Search and Memory subsystems, injects a repository-delta block into agent prompts, and exposes IPC endpoints, a renderer store, UI (banner/dialog), settings, and documentation for the new subsystem.

Changes

Resume Pipeline

Layer / File(s) Summary
Shared contracts and schema
src/shared/types.ts, src/shared/constants.ts, src/shared/ipc-channels.ts, src/main/db/database.ts
Adds ResumeState/RepoDelta types, resume settings, RESUME_LIMITS, resume IPC channels, and DB migrations for session_snapshots, resume_deltas, search_refs, and search_files.content_hash.
Search reference extraction and indexing
src/main/managers/search/refs.ts, src/main/managers/search/SearchManager.ts
Extracts import/require references from source files and persists them into search_refs, with content-hash based skip logic and new symbolIdentitiesForPath/importerCount helpers.
Repository delta computation
src/main/managers/resume/delta.ts
Computes structured repo deltas (history rewrite, ahead/behind, file changes, categorization) and renders a <repository-delta> prompt block.
Memory link storage and revalidation
src/main/managers/memory/MemoryManager.ts, src/main/ipc/memoryHandlers.ts
Persists memory_links on creation and adds confidence downgrade/restore logic for memories linked to missing/present files.
ResumeManager core service
src/main/managers/resume/ResumeManager.ts
Implements snapshotting, revalidation, delta enrichment via Search/Memory, persistence, and prompt-time delta consumption.
Main-process wiring and IPC handlers
src/main/index.ts, src/main/ipc/index.ts, src/main/ipc/resumeHandlers.ts, src/main/managers/AgentManager.ts, src/main/managers/GitManager.ts, src/main/managers/SettingsManager.ts
Wires ResumeManager into the composition root, AgentManager prompt injection/recordStatus, GitManager checkpoint hooks, settings clamping, and registers resume IPC handlers.
Preload API and renderer store
src/preload/index.ts, src/renderer/stores/useResumeStore.ts
Exposes window.limboo.resume and a Zustand store hydrating/managing resume state and delta dialog.
Renderer UI and settings
src/renderer/features/resume/*, src/renderer/App.tsx, src/renderer/features/workspace/CenterWorkspace.tsx, src/renderer/features/settings/catalog.tsx, src/renderer/features/settings/panels/MemoryPanel.tsx
Adds ResumeBanner, ResumeDeltaDialog, a revalidating status pill, and settings fields for the Resume Pipeline.
Documentation
CLAUDE.md, README.md, docs/README.md, docs/architecture/subsystems/resume-pipeline.md
Documents the new subsystem's architecture, storage, workflows, IPC surface, UI, settings, and security boundaries.

Estimated code review effort: 4 (Complex) | ~75 minutes

Possibly related PRs

  • BotCoder254/limboo#39: Modifies the same SearchManager incremental indexing/reindex pipeline that this PR extends with content hashing and search_refs persistence.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Resume Pipeline for session continuation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/resume-pipeline

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BotCoder254 BotCoder254 merged commit e84dfbb into main Jul 6, 2026
3 of 11 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/index.ts (1)

262-293: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Defer resume revalidation until after worktree recovery

worktrees.recover() can broadcast session changes before resume.onBoot() runs, and ResumeManager.onActiveSessionChanged() will revalidate immediately while prevActiveId is still null. That can publish a delta against a worktree state that is still settling. Gate the listener until after boot, or initialize prevActiveId before recovery starts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/index.ts` around lines 262 - 293, The resume listener is
revalidating too early because sessions.onActiveChanged(() =>
resume.onActiveSessionChanged(active)) can fire during worktree recovery before
ResumeManager is bootstrapped. Update the boot sequence in src/main/index.ts so
ResumeManager.onActiveSessionChanged only runs after worktrees.recover() has
settled, or initialize the resume state (including prevActiveId) before recovery
starts; use the workspace/worktrees/sessions/resume hooks in the existing
startup flow to locate the change.
🧹 Nitpick comments (2)
src/main/managers/resume/ResumeManager.ts (1)

315-329: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Clear the timeout and note that the timed-out revalidation keeps running.

Promise.race leaves the setTimeout timer pending on the happy path (it fires up to revalidateTimeoutMs later for a promise nothing awaits). More importantly, losing the race does not cancel revalidateInner — after the catch sets phase 'idle', the still-running inner call can later setState('checking')publishDelta/setState('delta'), so a delta may surface after the "degraded to no-delta" state was already broadcast. At minimum clear the timer; true cancellation would require threading an AbortSignal into the git calls.

♻️ Clear the timer in a finally block
   async revalidate(sessionId: string): Promise<void> {
     const cfg = this.settings.getAll().resume;
     if (!cfg.enabled) return;
+    let timer: NodeJS.Timeout | undefined;
     try {
       await Promise.race([
         this.revalidateInner(sessionId, cfg.maxCommitsInDelta, cfg.staleThresholdDays),
-        new Promise<never>((_, reject) =>
-          setTimeout(() => reject(new Error('revalidate timeout')), RESUME_LIMITS.revalidateTimeoutMs),
-        ),
+        new Promise<never>((_, reject) => {
+          timer = setTimeout(
+            () => reject(new Error('revalidate timeout')),
+            RESUME_LIMITS.revalidateTimeoutMs,
+          );
+        }),
       ]);
     } catch (err) {
       logger.warn('resume: revalidation degraded to no-delta', err);
       this.setState({ sessionId, phase: 'idle' });
+    } finally {
+      if (timer) clearTimeout(timer);
     }
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/managers/resume/ResumeManager.ts` around lines 315 - 329, The
revalidation flow in ResumeManager.revalidate leaves the timeout pending and
allows revalidateInner to keep running after the race is lost. Update the
Promise.race setup so the timeout from setTimeout is always cleared in a finally
block, and make it clear in the code path that a timed-out revalidation is only
degraded, not canceled. Use the revalidate, revalidateInner, and
RESUME_LIMITS.revalidateTimeoutMs symbols to locate the fix.
src/renderer/features/resume/ResumeBanner.tsx (1)

17-32: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fragile text-parsing for severity styling.

warn is derived by regex-matching state.summary, a human-readable string. This silently breaks if the summary wording in the backend (delta/ResumeManager) ever changes, since there's no compile-time coupling between the two.

Consider adding a structured flag (e.g., severity: 'warning' | 'info' or mirroring historyRewritten/rootChanged) to ResumeState so the UI doesn't need to sniff free text.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/features/resume/ResumeBanner.tsx` around lines 17 - 32, The
severity styling in ResumeBanner is currently inferred by regex-matching
state.summary, which is fragile. Update ResumeState and the delta/ResumeManager
flow to carry a structured severity field (or explicit flags like
historyRewritten/rootChanged), then have ResumeBanner use that typed value
instead of parsing free text for the AlertTriangle/Info choice.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/db/database.ts`:
- Around line 199-229: Purge the resume state when a session is deleted:
`SessionManager.purge` currently removes the session row and agent data but
leaves `session_snapshots` and `resume_deltas` behind. Update the purge flow in
`SessionManager.purge` to also delete rows for the same session_id from both
tables, keeping all session-scoped resume data in sync with the session
lifecycle.

In `@src/main/managers/search/refs.ts`:
- Around line 42-46: The ref extraction loop in refs.ts is skipping every line
that starts with # before CFAMILY_RULES can match `#include` directives, so C/C++
include edges never get produced. Update the comment-filter logic in the loop
that scans lines so it still ignores shell/Python-style comments but allows
`#include` lines to reach the existing CFAMILY_RULES matching logic, keeping the
behavior in the search/ref extraction path aligned with C-family include
handling.

---

Outside diff comments:
In `@src/main/index.ts`:
- Around line 262-293: The resume listener is revalidating too early because
sessions.onActiveChanged(() => resume.onActiveSessionChanged(active)) can fire
during worktree recovery before ResumeManager is bootstrapped. Update the boot
sequence in src/main/index.ts so ResumeManager.onActiveSessionChanged only runs
after worktrees.recover() has settled, or initialize the resume state (including
prevActiveId) before recovery starts; use the
workspace/worktrees/sessions/resume hooks in the existing startup flow to locate
the change.

---

Nitpick comments:
In `@src/main/managers/resume/ResumeManager.ts`:
- Around line 315-329: The revalidation flow in ResumeManager.revalidate leaves
the timeout pending and allows revalidateInner to keep running after the race is
lost. Update the Promise.race setup so the timeout from setTimeout is always
cleared in a finally block, and make it clear in the code path that a timed-out
revalidation is only degraded, not canceled. Use the revalidate,
revalidateInner, and RESUME_LIMITS.revalidateTimeoutMs symbols to locate the
fix.

In `@src/renderer/features/resume/ResumeBanner.tsx`:
- Around line 17-32: The severity styling in ResumeBanner is currently inferred
by regex-matching state.summary, which is fragile. Update ResumeState and the
delta/ResumeManager flow to carry a structured severity field (or explicit flags
like historyRewritten/rootChanged), then have ResumeBanner use that typed value
instead of parsing free text for the AlertTriangle/Info choice.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dfb7225d-db3e-4f7f-b09e-d3b6f29de480

📥 Commits

Reviewing files that changed from the base of the PR and between daf1627 and 20375e3.

📒 Files selected for processing (28)
  • CLAUDE.md
  • README.md
  • docs/README.md
  • docs/architecture/subsystems/resume-pipeline.md
  • src/main/db/database.ts
  • src/main/index.ts
  • src/main/ipc/index.ts
  • src/main/ipc/memoryHandlers.ts
  • src/main/ipc/resumeHandlers.ts
  • src/main/managers/AgentManager.ts
  • src/main/managers/GitManager.ts
  • src/main/managers/SettingsManager.ts
  • src/main/managers/memory/MemoryManager.ts
  • src/main/managers/resume/ResumeManager.ts
  • src/main/managers/resume/delta.ts
  • src/main/managers/search/SearchManager.ts
  • src/main/managers/search/refs.ts
  • src/preload/index.ts
  • src/renderer/App.tsx
  • src/renderer/features/resume/ResumeBanner.tsx
  • src/renderer/features/resume/ResumeDeltaDialog.tsx
  • src/renderer/features/settings/catalog.tsx
  • src/renderer/features/settings/panels/MemoryPanel.tsx
  • src/renderer/features/workspace/CenterWorkspace.tsx
  • src/renderer/stores/useResumeStore.ts
  • src/shared/constants.ts
  • src/shared/ipc-channels.ts
  • src/shared/types.ts

Comment thread src/main/db/database.ts
Comment on lines +199 to +229
-- Resume Pipeline (schema v10) — one repository anchor per session,
-- upserted at meaningful moments (run end, checkpoint, deactivation).
-- head/branch are NULL when the effective root is not a git repo (or the
-- branch is detached). dirty_files is a capped JSON array of {path,status};
-- dirty_hash is a sha256 over the sorted dirty entries
-- (status|path|size|mtimeMs) so content drift in an already-dirty tree is
-- detected without ever reading file contents. All values bound.
CREATE TABLE IF NOT EXISTS session_snapshots (
session_id TEXT PRIMARY KEY,
workspace_id TEXT NOT NULL,
root TEXT NOT NULL,
head TEXT,
branch TEXT,
dirty_hash TEXT NOT NULL DEFAULT '',
dirty_files TEXT NOT NULL DEFAULT '[]',
reason TEXT NOT NULL,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);

-- The last computed repository delta per session, persisted so the
-- one-shot prompt injection survives an app restart between detection and
-- the next prompt. status: 'pending' | 'injected' | 'dismissed'.
-- delta is a JSON RepoDelta built entirely in the main process.
CREATE TABLE IF NOT EXISTS resume_deltas (
session_id TEXT PRIMARY KEY,
status TEXT NOT NULL,
delta TEXT NOT NULL,
created_at INTEGER NOT NULL
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Look for deletion/cleanup of the new resume tables across the codebase.
rg -nP "session_snapshots|resume_deltas" --type=ts -C3
# Locate the session hard-delete path to confirm it cascades to resume rows.
rg -nP "DELETE FROM sessions|deleteSession|purge|hardDelete" --type=ts -C3

Repository: BotCoder254/limboo

Length of output: 156


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map likely TypeScript files and search for session deletion/cleanup paths.
git ls-files 'src/**/*.ts' | sed -n '1,250p'

printf '\n## session_snapshots / resume_deltas references\n'
rg -n --hidden --glob '!**/dist/**' --glob '!**/build/**' --glob '!**/node_modules/**' 'session_snapshots|resume_deltas' src -C 3 || true

printf '\n## session deletion / trashing references\n'
rg -n --hidden --glob '!**/dist/**' --glob '!**/build/**' --glob '!**/node_modules/**' 'deleteSession|hardDelete|trash|purge|DELETE FROM sessions|FROM sessions' src -C 3 || true

Repository: BotCoder254/limboo

Length of output: 37931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '## SessionManager.purge and surrounding context\n'
sed -n '330,352p' src/main/managers/SessionManager.ts

printf '\n## sessionHandlers delete/purge paths\n'
sed -n '180,230p' src/main/ipc/sessionHandlers.ts

printf '\n## ResumeManager methods around snapshot/delta lifecycle\n'
sed -n '140,180p' src/main/managers/resume/ResumeManager.ts
sed -n '250,360p' src/main/managers/resume/ResumeManager.ts
sed -n '380,540p' src/main/managers/resume/ResumeManager.ts

Repository: BotCoder254/limboo

Length of output: 15119


Purge the resume tables with the session
SessionManager.purge deletes the session row and agent data, but session_snapshots and resume_deltas are left behind. Add matching deletes here so permanently removed sessions don't leave orphaned resume state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/db/database.ts` around lines 199 - 229, Purge the resume state when
a session is deleted: `SessionManager.purge` currently removes the session row
and agent data but leaves `session_snapshots` and `resume_deltas` behind. Update
the purge flow in `SessionManager.purge` to also delete rows for the same
session_id from both tables, keeping all session-scoped resume data in sync with
the session lifecycle.

Comment on lines +42 to +46
for (let i = 0; i < lines.length; i += 1) {
if (out.length >= SEARCH_LIMITS.maxRefsPerFile) break;
const raw = lines[i];
const trimmed = raw.trimStart();
if (trimmed.startsWith('//') || trimmed.startsWith('*') || trimmed.startsWith('#')) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

C/C++ #include directives are never extracted.

The comment guard at Line 46 skips any line that starts with # (to drop Python/shell comments), but CFAMILY_RULES (Line 99) matches exactly #include <...> / #include "...". Since those lines start with #, they are dropped before the rules run, so c/cpp include edges are silently never produced and CFAMILY_RULES is effectively dead code.

Narrow the # skip so include directives survive:

🐛 Proposed fix
-    if (trimmed.startsWith('//') || trimmed.startsWith('*') || trimmed.startsWith('#')) continue;
+    if (trimmed.startsWith('//') || trimmed.startsWith('*')) continue;
+    // `#` is a comment leader (Python/Ruby/shell) but also a C-family `#include`.
+    if (trimmed.startsWith('#') && !/^#\s*include\b/.test(trimmed)) continue;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for (let i = 0; i < lines.length; i += 1) {
if (out.length >= SEARCH_LIMITS.maxRefsPerFile) break;
const raw = lines[i];
const trimmed = raw.trimStart();
if (trimmed.startsWith('//') || trimmed.startsWith('*') || trimmed.startsWith('#')) continue;
for (let i = 0; i < lines.length; i += 1) {
if (out.length >= SEARCH_LIMITS.maxRefsPerFile) break;
const raw = lines[i];
const trimmed = raw.trimStart();
if (trimmed.startsWith('//') || trimmed.startsWith('*')) continue;
// `#` is a comment leader (Python/Ruby/shell) but also a C-family `#include`.
if (trimmed.startsWith('#') && !/^#\s*include\b/.test(trimmed)) continue;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/managers/search/refs.ts` around lines 42 - 46, The ref extraction
loop in refs.ts is skipping every line that starts with # before CFAMILY_RULES
can match `#include` directives, so C/C++ include edges never get produced. Update
the comment-filter logic in the loop that scans lines so it still ignores
shell/Python-style comments but allows `#include` lines to reach the existing
CFAMILY_RULES matching logic, keeping the behavior in the search/ref extraction
path aligned with C-family include handling.

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