[codex] Add local agent context server#17
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a new Rust daemon, MirrorNoteAgentServer, that accepts newline-delimited JSON over localhost TCP to run and persist asynchronous source-context generation jobs. Electron is updated to call the agent, derive job status from persisted files, auto-schedule generation after capture stops, and build/release scripts include the new binary. ChangesAgent Server & Electron Integration
Sequence DiagramsequenceDiagram
participant Electron as Electron (apps/desktop/main.cjs)
participant Agent as AgentServer (Rust)
participant Native as NativeHost (native-host-rust)
participant FS as Filesystem (context/)
participant Provider as External Provider (e.g., OpenAI)
Electron->>Electron: capture stops → scheduleAutomaticSourceContextGeneration()
Electron->>Agent: TCP connect & send generateContext (newline JSON)
Agent->>FS: create/read agent-jobs/generate-context.json (Queued)
Agent->>Agent: set JobState → Running, persist
Agent->>Native: call generate_source_context()
Native->>Provider: request embeddings/summaries
Provider-->>Native: response
Native->>FS: write packets/metrics
Native-->>Agent: return result
Agent->>FS: persist Succeeded/Failed job JSON
Agent-->>Electron: send AgentResponse (ok/payload)
Electron->>FS: read job status for UI derivation
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cc1baeb4b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request introduces a new Rust-based helper, MirrorNoteAgentServer, to handle local agent jobs such as source context generation. This offloads long-lived tasks from the native host and provides persistent job status tracking within meeting bundles. The Electron main process now includes an AgentServerBridge to manage communication with this daemon via a local TCP socket. Additionally, the context packet module was updated with new record types, and build scripts were adjusted to include the new binary. Feedback suggests simplifying numeric parsing in the job status logic and refactoring the increasingly complex build script in package.json into a separate file for better maintainability.
Summary
Adds a local
MirrorNoteAgentServerdaemon and routes source context generation through it so meeting context jobs can live outside the desktop UI process.Why
Agent context should be generated automatically as part of the meeting lifecycle, and longer-running agent work needs a local service boundary that can later survive desktop window restarts without introducing cloud-server assumptions.
Changes
native/agent-server-rustwith localhost JSON-line IPC, daemon lifecycle commands,generateContext,jobStatus, and persisted job status undercontext/agent-jobs/.MirrorNoteAgentServerfor source context generation and automatically enqueue context generation after recording completion.MirrorNoteAgentServerinto native build, release staging, macOS binary signing metadata, and helper boundary docs.Validation:
node --check apps/desktop/main.cjsnpm run native:buildnpm run desktop:test:mainnpm run renderer:testCARGO_TARGET_DIR=target cargo test --test context_packet_contractinnative/native-host-rustCARGO_TARGET_DIR=target cargo testinnative/agent-server-rustcapabilities,shutdown, and failedgenerateContextjob persistenceSummary by CodeRabbit
New Features
Tests
Documentation
Chores