Add post-session context generation#16
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds end-to-end source-context generation: new normalized status shape, metadata persistence and file-path derivation, generation gating and native invocation in the main process, IPC/preload handlers, frontend auto-generation, UI/status rendering with retry/open-agent-brief actions, and tests covering success and failure paths. ChangesSource Context Generation Feature
Sequence DiagramsequenceDiagram
participant App as App.tsx
participant Preload as preload.cjs
participant Main as main.cjs
participant Native as Native Layer
participant FS as File System
participant DB as SQLite DB
App->>App: detect eligible note (canAutoGenerateSourceContext)
App->>App: set generatingSourceContextId, save pending transcript (if manual)
App->>Preload: mirrorNote.generateSourceContext(noteId)
Preload->>Main: IPC "source-context:generate" {noteId}
Main->>Main: normalize status, check noteHasCompletedTranscriptForSourceContext
alt transcript incomplete
Main->>FS: write metadata.sourceContext = {state: failed, retryable: true}
Main->>DB: sync metadata from bundle
Main-->>Preload: respond with error
else transcript complete
Main->>FS: write metadata.sourceContext = {state: generating}
Main->>DB: sync metadata
Main->>Native: nativeCaptureRequest("generateSourceContext", ...)
alt native success
Native->>FS: write context packet files (agentBrief etc.)
Main->>FS: write metadata.sourceContext = {state: ready, paths, counts}
Main->>DB: sync metadata
Main-->>Preload: return updated status
else native fails
Main->>FS: write metadata.sourceContext = {state: failed, retryable: true, detail}
Main->>DB: sync metadata
Main-->>Preload: respond with error
end
end
Preload-->>App: return result or error
App->>NoteTab: update props (isGeneratingSourceContext, sourceContextError)
NoteTab->>NoteTab: render status pill + actions (open agent brief / retry)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Review rate limit: 1/3 review remaining, refill in 23 minutes and 53 seconds. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the "Source Context" feature, enabling the generation of agent briefs from note transcripts. It includes backend logic for state management and persistence, along with frontend updates to display status and handle auto-generation. Feedback highlights several improvement opportunities: including missing metadata fields (like packet IDs and counts) in normalization and type definitions, replacing synchronous file system checks in the note list path to avoid performance issues, and deriving paths dynamically instead of storing absolute paths to ensure data portability. It is also suggested to handle potential failures in prerequisite save operations before starting context generation.
Summary
Adds a post-session source context pipeline that generates agent-ready context packets once a completed transcript is available.
Why
The STT/session flow now needs a post-session artifact layer so completed recordings can become source-backed agent context without exposing internal ledger/debug files in the UI.
Changes
sourceContextStatusfrom metadata and existingcontext/agent-brief.md/context/project-context.mdfiles.Generating context,Ready,Failed,Retry, andOpen agent brief.Validation:
npm run renderer:checknode --check apps/desktop/main.cjsnode --check apps/desktop/preload.cjsnpm run desktop:test:mainSummary by CodeRabbit
New Features
Bug Fixes
Tests