Skip to content

fix(daemon): expose agent tools, fix scheduled tasks + MCP scope - #45

Merged
dvaJi merged 4 commits into
masterfrom
fix/agent-tools-scheduled-tasks-mcp-scope
Aug 10, 2026
Merged

dvaJi merged 4 commits into
masterfrom
fix/agent-tools-scheduled-tasks-mcp-scope

Conversation

@dvaJi

@dvaJi dvaJi commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Multiple fixes for Argos agent settings, scheduled tasks, and MCP scope — all discovered while configuring a new Argos agent.

Agent tools visibility

  • Root cause: daemon tools.listDefinitions route returned only MCP tools; the Argos agents settings page filters source === "agent", so the tools list was always empty.
  • Fix: wire orchestration runtime definitions + new piToolCatalog (read/bash/edit/write/grep/find/ls with real descriptions) into the daemon dispatcher route.
  • Redesigned the Tools section UI: collapsible group cards with per-tool descriptions, status dots, and gating for orchestration tools (disabled when orchestrationEnabled is off).

MCP scope panel — servers invisible

  • Root cause: AgentExtensionPolicyPanel fetched MCP servers via legacy desktop IPC presenter (Electron main store), but servers added through MCP settings live in the daemon store. Two different stores → empty list.
  • Fix: panel now uses createMcpClient().getMcpServers() — the same daemon store the agent sessions actually enforce against.

Scheduled task action type reverting to Notify

  • Root cause: commitTask(index) captured the stale tasks closure (or stale ref). Called synchronously after setSettings(next), it persisted the pre-update task, and the server response overwrote the local state.
  • Fix: commitTask now accepts an optional task override; all synchronous commit sites pass the freshly-built next.tasks[index].

Daily/weekly tasks firing in an infinite loop

  • Root cause: computeNextFireAt ignored lastFiredAt for daily/weekly triggers. After firing, the 60s drift tolerance made it return the same-day slot → delay=0 → immediate re-fire → infinite loop, each iteration creating a new session.
  • Fix: computeNextFireAt now uses lastFiredAt as a floor (effectiveAfter = max(after, lastFiredAt)), so fired slots are skipped.

Daemon prompt-draft crash

  • Root cause: DaemonScheduledTasksWindowPresenter.mainWindow was a fake { id: -1, isDestroyed: () => false } that passed the truthy check in runPromptDraft, then sendToWindow threw.
  • Fix: mainWindow = null so the draft path falls through to notification-only (correct headless behavior).

Error logging

  • Daemon route dispatch catch in transport/http.ts now console.errors the route name + full error (previously silently converted to JSON response).
  • All ScheduledTasksSettings catch blocks now console.error with context and include the error message in the toast description.

Misc

  • Fix hooksNotifications config warning on undefined store value (early return defaults before Zod parse).
  • Pi + Orchestration group labels in McpIndicator.

Test plan

  • Argos agents settings shows Pi + Orchestration tools with descriptions
  • Orchestration tools gated when orchestration disabled
  • MCP scope panel shows user-created MCP servers
  • Scheduled task action type can be switched to Prompt without reverting
  • Daily task fires exactly once, not in a loop
  • Run button on prompt task shows notification instead of crashing
  • Daemon logs errors on route failures

Summary by CodeRabbit

  • New Features

    • Added built-in Pi and orchestration tools with visibility and toggle controls in settings.
    • Added ACP agent update notifications with links to settings.
    • Added session-item menus for pinning, opening, and deleting sessions.
    • Added Windows native title-bar controls and theme-aware appearance syncing.
    • Added optional actions to toast notifications.
  • Bug Fixes

    • Improved scheduled-task timing, headless notifications, and save reliability.
    • Improved MCP server selection behavior and error messages.
    • Prevented duplicate agent update notifications.
  • Style

    • Refreshed sidebar, title-bar, and toast notification styling.

dvaJi added 2 commits August 7, 2026 12:19
- Wire orchestration + Pi built-in tools into daemon tools.listDefinitions
  route (previously only MCP tools were returned, leaving the Argos agent
  tools section empty)
- Add piToolCatalog exposing read/bash/edit/write/grep/find/ls with real
  descriptions and parameter schemas
- Redesign ArgosAgentsSettings Tools section: collapsible group cards
  with per-tool descriptions, gating for orchestration tools
- Fix MCP scope panel reading from wrong store: AgentExtensionPolicyPanel
  now uses daemon mcp.getServers route instead of legacy desktop IPC
  presenter (servers added via MCP settings were invisible)
- Fix scheduled task action type select reverting to notify: commitTask
  captured stale tasks closure, persisting the pre-update task; now passes
  the freshly-built task as override
- Fix daily/weekly tasks firing in an infinite loop: computeNextFireAt
  ignored lastFiredAt for recurring triggers, so the 60s drift tolerance
  caused same-slot re-fire after each dispatch
- Fix daemon prompt-draft crash: DaemonScheduledTasksWindowPresenter
  had a fake mainWindow that passed truthy checks but threw on
  sendToWindow; now null so draft falls through to notification
- Add error logging to daemon route dispatch catch and all
  ScheduledTasksSettings catch blocks
- Fix hooksNotifications config warning on undefined store value
Copilot AI lite review requested due to automatic review settings August 9, 2026 02:21
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dvaJi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5bb46799-f91f-4cc4-bb2b-992908845724

📥 Commits

Reviewing files that changed from the base of the PR and between 3199426 and 96f1a9d.

📒 Files selected for processing (1)
  • packages/ui/settings/components/ScheduledTasksSettings.tsx
📝 Walkthrough

Walkthrough

The PR adds Pi and orchestration tool discovery, updates agent tool controls, synchronizes Windows title-bar overlays with themes, centralizes scheduled-task logic, improves task persistence, adds ACP update notifications, and updates desktop shell interactions and styling.

Changes

Tool discovery and agent tool settings

Layer / File(s) Summary
Pi tool catalog
apps/daemon/src/host/piToolCatalog.ts
Defines seven Pi tools and converts them to MCP function definitions with provider metadata.
Daemon tool-definition aggregation
apps/daemon/src/dispatch/daemonDispatcher.ts, apps/daemon/src/index.ts
Combines MCP, Pi, and optional orchestration definitions in the daemon response.
Tool discovery validation and diagnostics
apps/daemon/test/daemonToolDefinitions.test.ts, apps/daemon/src/transport/http.ts, apps/daemon/src/host/daemonScheduledTasks.ts
Tests aggregated definitions, logs route errors, and uses a null scheduled-task window value.
Agent tool policy and controls
packages/ui/settings/components/AgentExtensionPolicyPanel.tsx, packages/ui/settings/components/ArgosAgentsSettings.tsx, packages/ui/src/components/chat-input/McpIndicator.tsx
Updates MCP selection semantics and adds grouped orchestration and Pi tool controls.

Desktop window presentation

Layer / File(s) Summary
Windows title-bar overlay configuration
apps/desktop/src/main/presenter/windowPresenter/index.ts, packages/shared/src/types/presenters/legacy.presenters.d.ts, apps/desktop/test/main/eventbus/eventbus.test.ts
Adds Windows overlay settings and a method to synchronize active managed windows.
Theme-driven overlay synchronization
apps/desktop/src/main/presenter/configPresenter/index.ts
Synchronizes native title-bar appearance after system or explicit theme changes.
Presenter configuration defaults
apps/desktop/src/main/presenter/hooksNotifications/config.ts
Returns default hook settings for null or undefined input.

Scheduled task correctness

Layer / File(s) Summary
Next-fire calculation and shared normalization
packages/backend-core/src/scheduled/normalize.ts, apps/desktop/src/main/presenter/scheduledTasks/normalize.ts, apps/desktop/test/main/presenter/scheduledTasks.test.ts
Uses lastFiredAt as a lower bound and re-exports the canonical backend scheduling helpers.
Headless scheduled-task behavior
apps/daemon/src/host/daemonScheduledTasks.ts, apps/daemon/test/daemonScheduledTasks.test.ts
Publishes notifications instead of creating sessions for non-auto-send prompt tasks.
Current task persistence
packages/ui/settings/components/ScheduledTasksSettings.tsx
Serializes updates per task and persists newly computed task values.
Task operation error reporting
packages/ui/settings/components/ScheduledTasksSettings.tsx
Logs failures and includes error messages in task operation toasts.

Desktop UI shell

Layer / File(s) Summary
Platform-specific window controls
packages/ui/src/components/AppBar.tsx
Adjusts custom controls for Windows, macOS, Linux, and browser mode.
Sidebar shell and icon updates
packages/ui/src/components/WindowSideBar.tsx, packages/ui/src/components/sidepanel/ChatSidePanel.tsx, packages/ui/src/routes/_main.tsx
Applies sidebar backgrounds, updates icons, and removes the connection indicator.
Session action menus
packages/ui/src/components/WindowSideBarSessionItem.tsx
Adds dropdown and context-menu actions for session operations.

ACP update notifications

Layer / File(s) Summary
Toast action support
packages/ui/src/components/use-toast.ts, packages/ui/src/assets/style.css
Adds optional toast actions and Sonner action styling.
ACP update detection and layout integration
packages/ui/src/composables/useAcpAgentUpdateNotifications.ts, packages/ui/src/routes/_main.tsx
Checks agent versions, suppresses duplicate notices, and shows update toasts from the main layout.

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

Sequence Diagram(s)

sequenceDiagram
  participant DaemonStartup
  participant DaemonDispatcher
  participant PiToolCatalog
  participant OrchestrationRuntime
  DaemonStartup->>DaemonDispatcher: pass orchestrationRuntime
  DaemonDispatcher->>PiToolCatalog: getPiToolDefinitions()
  DaemonDispatcher->>OrchestrationRuntime: definitions()
  DaemonDispatcher-->>DaemonStartup: return combined tool definitions
Loading
sequenceDiagram
  participant MainLayout
  participant ACPNotifications
  participant ACPConfig
  participant AgentRegistry
  participant Sonner
  MainLayout->>ACPNotifications: start update checks
  ACPNotifications->>ACPConfig: verify ACP is enabled
  ACPNotifications->>AgentRegistry: compare installed agent versions
  AgentRegistry-->>ACPNotifications: return changed versions
  ACPNotifications->>Sonner: show update toast with settings action
Loading

Possibly related PRs

  • dvaJi/argos#35: Shares daemon dispatcher and runtime integration changes.
  • dvaJi/argos#36: Also changes daemon dispatcher construction and startup wiring.
  • dvaJi/argos#41: Provides the orchestration runtime used by the daemon and UI tool integration.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 changes: daemon tool visibility, scheduled-task fixes, and MCP scope handling.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agent-tools-scheduled-tasks-mcp-scope

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.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 96f1a9d.

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

The recurring-task fix should be completed in the desktop scheduler before merging because desktop daily and weekly tasks remain able to refire the same occurrence.

The daemon scheduler now advances recurring tasks using lastFiredAt, but the desktop runtime imports a separate unchanged calculation while retaining the same drift-tolerant scheduling behavior, leaving the reported infinite-refire failure reachable on desktop.

Files Needing Attention: packages/backend-core/src/scheduled/normalize.ts and apps/desktop/src/main/presenter/scheduledTasks/normalize.ts

Important Files Changed

Filename Overview
packages/backend-core/src/scheduled/normalize.ts Adds a lastFiredAt floor for daemon recurrence calculations, but the equivalent active desktop implementation remains unchanged.
apps/desktop/src/main/presenter/scheduledTasks/normalize.ts Important unchanged sibling implementation still permits the recurring-task refire behavior that this PR intends to fix.
packages/ui/settings/components/ScheduledTasksSettings.tsx Passes freshly constructed tasks to synchronous persistence sites and improves operation error reporting.
apps/daemon/src/dispatch/daemonDispatcher.ts Extends daemon tool-definition responses with Pi and orchestration catalogs.
apps/daemon/src/host/piToolCatalog.ts Defines UI-facing metadata and schemas for Pi built-in tools.
packages/ui/settings/components/AgentExtensionPolicyPanel.tsx Loads MCP servers from the daemon-backed client and preserves undefined as allow-all scope.
apps/desktop/src/main/presenter/windowPresenter/index.ts Adds Windows native window-controls overlay creation and theme synchronization.

Fix All in Codex

Prompt To Fix All With AI
### Issue 1
packages/backend-core/src/scheduled/normalize.ts:170-173
**Desktop recurrence remains unfixed**

When a daily or weekly task fires in the desktop application, its scheduler still uses the separate unchanged `apps/desktop` recurrence calculation, so the 60-second drift window can select the consumed occurrence again and repeatedly create notifications or prompt sessions. Apply the `lastFiredAt` fix to the desktop implementation as well, or consolidate both runtimes onto one implementation.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(daemon): expose agent tools, fix sch..." | Re-trigger Greptile

Comment on lines +170 to +173
const effectiveAfter = task.lastFiredAt != null ? Math.max(after, task.lastFiredAt) : after;
let candidate = buildWallClockToday(effectiveAfter, trigger.hour, trigger.minute, 0);
if (candidate <= effectiveAfter) {
candidate = buildWallClockToday(effectiveAfter, trigger.hour, trigger.minute, 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Desktop recurrence remains unfixed

When a daily or weekly task fires in the desktop application, its scheduler still uses the separate unchanged apps/desktop recurrence calculation, so the 60-second drift window can select the consumed occurrence again and repeatedly create notifications or prompt sessions. Apply the lastFiredAt fix to the desktop implementation as well, or consolidate both runtimes onto one implementation.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/backend-core/src/scheduled/normalize.ts
Line: 170-173

Comment:
**Desktop recurrence remains unfixed**

When a daily or weekly task fires in the desktop application, its scheduler still uses the separate unchanged `apps/desktop` recurrence calculation, so the 60-second drift window can select the consumed occurrence again and repeatedly create notifications or prompt sessions. Apply the `lastFiredAt` fix to the desktop implementation as well, or consolidate both runtimes onto one implementation.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

Copilot AI 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.

Pull request overview

This PR fixes multiple configuration and runtime issues spanning agent settings (tool visibility + MCP scope), scheduled tasks (UI persistence + next-fire computation), and Windows desktop window chrome (native titlebar overlay syncing). It aligns the UI with the daemon-backed stores that actually enforce agent/session behavior and improves observability via better error logging.

Changes:

  • Expose first-party agent tool definitions (Pi + orchestration) via the daemon tools route and update the agent tools UI to show grouped, descriptive tool cards with orchestration gating.
  • Fix MCP scope panel to load MCP servers from the daemon store and improve selection handling semantics.
  • Fix scheduled task persistence (stale closure) and prevent daily/weekly triggers from refiring in a loop by respecting lastFiredAt; plus Windows titlebar overlay behavior + logging/toast enhancements.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/ui/src/routes/_main.tsx Hooks ACP agent-update notifications into the main layout; aligns main surface styling with sidebar tone.
packages/ui/src/composables/useAcpAgentUpdateNotifications.ts Adds daemon-backed ACP registry update checks with toast notifications and settings deep-link action.
packages/ui/src/components/WindowSideBarSessionItem.tsx Reworks session item interactions to include context/dropdown menus for actions.
packages/ui/src/components/WindowSideBar.tsx Updates sidebar styling and icon set; removes connection indicator from sidebar.
packages/ui/src/components/use-toast.ts Extends toast wrapper to support Sonner actions (label + callback).
packages/ui/src/components/sidepanel/ChatSidePanel.tsx Aligns side panel surface color with the sidebar theme token.
packages/ui/src/components/chat-input/McpIndicator.tsx Adds new tool group ordering/labels for orchestration and Pi.
packages/ui/src/components/AppBar.tsx Adds Windows detection and hides custom window buttons when native overlay is used; updates styling.
packages/ui/src/assets/style.css Adds custom Sonner toast “dropdown-glass” styling.
packages/ui/settings/components/ScheduledTasksSettings.tsx Fixes stale-closure persistence by using a ref + override-based commit; improves error logging/toasts.
packages/ui/settings/components/ArgosAgentsSettings.tsx Adds orchestration/Pi tool groups and redesigns the Tools section into collapsible, described group cards with gating.
packages/ui/settings/components/AgentExtensionPolicyPanel.tsx Switches MCP server fetching to daemon client and updates selection semantics/UX.
packages/shared/src/types/presenters/legacy.presenters.d.ts Extends window presenter typing with syncWindowTitleBarAppearance().
packages/backend-core/src/scheduled/normalize.ts Prevents daily/weekly scheduled tasks from looping by flooring with lastFiredAt.
apps/desktop/src/main/presenter/windowPresenter/index.ts Implements Windows Window Controls Overlay (WCO) setup and a resync method for theme changes.
apps/desktop/src/main/presenter/hooksNotifications/config.ts Fixes undefined/null config normalization by returning defaults early.
apps/desktop/src/main/presenter/configPresenter/index.ts Reapplies Windows titlebar overlay options when theme changes.
apps/daemon/test/daemonToolDefinitions.test.ts Updates/extends tests to validate orchestration + Pi tool definitions are included.
apps/daemon/src/transport/http.ts Adds route-name + error logging on daemon route dispatch failures.
apps/daemon/src/index.ts Passes orchestration runtime into the daemon dispatcher wiring.
apps/daemon/src/host/piToolCatalog.ts Introduces Pi tool catalog definitions for UI/tool discovery.
apps/daemon/src/host/daemonScheduledTasks.ts Fixes headless scheduled-task presenter by making mainWindow null to avoid draft-path crashes.
apps/daemon/src/dispatch/daemonDispatcher.ts Appends Pi + orchestration definitions to tool definition listing route output.
Suppressed comments (1)

apps/daemon/src/host/piToolCatalog.ts:38

  • The edit tool claims edits[].oldText/edits[].newText are required, but the JSON schema for edits.items is just { type: "object" } with no properties/required. This makes the tool definition internally inconsistent and prevents consumers from reliably constructing valid edit calls.
      edits: {
        type: "array",
        items: { type: "object", description: "A single replacement: oldText to find and newText to replace it with." },
        description: "The edits to apply.",
      },

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +3 to +7
type CatalogEntry = {
description: string;
properties: Record<string, { type: string; items?: { type: string; description?: string }; description: string }>;
required?: string[];
};
Comment on lines 171 to 174
<p className="text-xs text-muted-foreground">
Leave this unset to allow every configured MCP server. An empty list blocks MCP tools entirely.
Checked servers are available to this agent. Uncheck when everything is allowed to create an explicit
blocklist.
</p>

@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: 8

🧹 Nitpick comments (2)
apps/daemon/test/daemonToolDefinitions.test.ts (1)

59-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover every Pi tool definition.

The test checks only the first Pi tool. A regression in bash, edit, write, grep, find, or ls will pass. Assert the complete Pi tool-name set and the required schema fields for each tool.

🤖 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 `@apps/daemon/test/daemonToolDefinitions.test.ts` around lines 59 - 113, Expand
the assertions in the toolsListDefinitionsRoute test around the piTool lookup to
validate every expected Pi tool: read, bash, edit, write, grep, find, and ls.
Assert each definition has source "agent" and includes the required function
schema fields, including the tool name and its parameters definition, rather
than checking only the read tool.
packages/backend-core/src/scheduled/normalize.ts (1)

170-185: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for the recurrence boundary.

Cover lastFiredAt values before, equal to, and after the daily or weekly occurrence. Also cover both earlier and later after values. Assert that each returned candidate is later than the effective boundary.

As per coding guidelines, tests must use Vitest and filenames must end in .test.ts, .test.tsx, or .spec.ts.

🤖 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 `@packages/backend-core/src/scheduled/normalize.ts` around lines 170 - 185, Add
Vitest regression tests in a .test.ts, .test.tsx, or .spec.ts file for the daily
and weekly recurrence logic around the normalization function. Cover lastFiredAt
before, equal to, and after the scheduled occurrence, combined with both earlier
and later after values, and assert every returned candidate is strictly later
than the effective boundary.

Source: Coding guidelines

🤖 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 `@apps/desktop/src/main/presenter/windowPresenter/index.ts`:
- Around line 53-61: Update getTitleBarOverlayOptions() to preserve native
caption-button contrast when nativeTheme.inForcedColorsMode is true. In that
mode, omit symbolColor from the returned TitleBarOverlayOptions; retain the
existing explicit dark/light symbol colors for normal Windows themes.
- Around line 44-63: Update the Windows title-bar overlay layout associated with
getTitleBarOverlayOptions so the AppBar’s drag/content region uses the
titlebar-area-width CSS environment value instead of assuming full width;
preserve the existing overlay colors, height, and non-Windows undefined
behavior.

In `@packages/shared/src/types/presenters/legacy.presenters.d.ts`:
- Line 300: Update the IWindowPresenter partial mock in eventbus.test.ts to
include a syncWindowTitleBarAppearance() method matching the required shared
presenter contract, while preserving the existing mock behavior.

In `@packages/ui/settings/components/AgentExtensionPolicyPanel.tsx`:
- Around line 172-173: Update the explanatory text in AgentExtensionPolicyPanel
to describe enabledMcpServerIds as an explicit allowlist, replacing “explicit
blocklist” with “explicit allowlist” while preserving the existing unchecked and
newly added server behavior.

In `@packages/ui/settings/components/ArgosAgentsSettings.tsx`:
- Around line 1015-1017: Remove the redundant sr-only labels in
ArgosAgentsSettings.tsx: delete the hidden “Unnamed Agent” span near lines
1015-1017 and the hidden Vision model and Image generation model spans near
lines 1217-1223, while preserving the visible labels.

In `@packages/ui/settings/components/ScheduledTasksSettings.tsx`:
- Around line 148-153: The task mutation callback around persistTask currently
allows concurrent writes and out-of-order responses to overwrite newer settings.
Serialize mutations for each task before invoking persistTask, or add
revision/conditional-write protection so responses are applied only when
current; preserve the settingsRef lookup while ensuring every field-blur and
select-change snapshot is ordered.

In `@packages/ui/src/components/AppBar.tsx`:
- Line 21: Track whether platform detection has completed in the AppBar
component and gate the custom-controls rendering near lines 75-77 on that
readiness state. Keep controls hidden until getDeviceInfo() resolves, then
render the appropriate Windows/macOS controls without changing the detected
platform behavior.

In `@packages/ui/src/composables/useAcpAgentUpdateNotifications.ts`:
- Around line 22-24: Update checkForAgentUpdates so requests received while
checkInFlight is true set a pending-check flag instead of being discarded. In
the function’s finally path, clear the active state and run exactly one
follow-up check when that flag is set, preserving the existing behavior for
requests that arrive when no check is active.

---

Nitpick comments:
In `@apps/daemon/test/daemonToolDefinitions.test.ts`:
- Around line 59-113: Expand the assertions in the toolsListDefinitionsRoute
test around the piTool lookup to validate every expected Pi tool: read, bash,
edit, write, grep, find, and ls. Assert each definition has source "agent" and
includes the required function schema fields, including the tool name and its
parameters definition, rather than checking only the read tool.

In `@packages/backend-core/src/scheduled/normalize.ts`:
- Around line 170-185: Add Vitest regression tests in a .test.ts, .test.tsx, or
.spec.ts file for the daily and weekly recurrence logic around the normalization
function. Cover lastFiredAt before, equal to, and after the scheduled
occurrence, combined with both earlier and later after values, and assert every
returned candidate is strictly later than the effective boundary.
🪄 Autofix

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 Plus

Run ID: 98b36193-baba-4f26-af88-7f09dd88445b

📥 Commits

Reviewing files that changed from the base of the PR and between ff45a7d and 385a668.

📒 Files selected for processing (23)
  • apps/daemon/src/dispatch/daemonDispatcher.ts
  • apps/daemon/src/host/daemonScheduledTasks.ts
  • apps/daemon/src/host/piToolCatalog.ts
  • apps/daemon/src/index.ts
  • apps/daemon/src/transport/http.ts
  • apps/daemon/test/daemonToolDefinitions.test.ts
  • apps/desktop/src/main/presenter/configPresenter/index.ts
  • apps/desktop/src/main/presenter/hooksNotifications/config.ts
  • apps/desktop/src/main/presenter/windowPresenter/index.ts
  • packages/backend-core/src/scheduled/normalize.ts
  • packages/shared/src/types/presenters/legacy.presenters.d.ts
  • packages/ui/settings/components/AgentExtensionPolicyPanel.tsx
  • packages/ui/settings/components/ArgosAgentsSettings.tsx
  • packages/ui/settings/components/ScheduledTasksSettings.tsx
  • packages/ui/src/assets/style.css
  • packages/ui/src/components/AppBar.tsx
  • packages/ui/src/components/WindowSideBar.tsx
  • packages/ui/src/components/WindowSideBarSessionItem.tsx
  • packages/ui/src/components/chat-input/McpIndicator.tsx
  • packages/ui/src/components/sidepanel/ChatSidePanel.tsx
  • packages/ui/src/components/use-toast.ts
  • packages/ui/src/composables/useAcpAgentUpdateNotifications.ts
  • packages/ui/src/routes/_main.tsx

Comment on lines +44 to +63
// Window Controls Overlay (WCO): on Windows the native caption buttons are drawn by
// Chromium into the top-right of the web contents. The overlay height matches the AppBar
// (h-9 = 36px); the overlay color is effectively transparent so the buttons float directly
// on the sidebar-toned AppBar surface. Symbol colors mirror the sidebar-foreground token.
const TITLEBAR_OVERLAY_HEIGHT = 36;
const TITLEBAR_OVERLAY_COLOR = "#01000000"; // "#00000000" renders black on some platforms
const TITLEBAR_OVERLAY_SYMBOL_LIGHT = "#43434c"; // sidebar foreground (light) oklch(0.38 0 0)
const TITLEBAR_OVERLAY_SYMBOL_DARK = "#b9b9c0"; // sidebar foreground (dark) oklch(0.78 0 0)

function getTitleBarOverlayOptions(): Electron.TitleBarOverlayOptions | undefined {
if (process.platform !== "win32") {
return undefined;
}
return {
color: TITLEBAR_OVERLAY_COLOR,
height: TITLEBAR_OVERLAY_HEIGHT,
symbolColor: nativeTheme.shouldUseDarkColors ? TITLEBAR_OVERLAY_SYMBOL_DARK : TITLEBAR_OVERLAY_SYMBOL_LIGHT,
};
}

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 | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 4 'titlebar-area-(x|y|width|height)|-webkit-app-region|app-region|AppBar' packages/ui apps/desktop

Repository: dvaJi/argos

Length of output: 6559


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== AppBar outline =="
ast-grep outline packages/ui/src/components/AppBar.tsx --view expanded || true

echo "== AppBar excerpt =="
sed -n '1,260p' packages/ui/src/components/AppBar.tsx

echo "== _main AppBar layout excerpt =="
sed -n '480,535p' packages/ui/src/routes/_main.tsx

echo "== focus on titlebar-area / WCO env variables and custom caption button classes =="
rg -n -C 4 '--(titlebar-area-|-webkit-app-region|-apple|webkit-app|app-region)|titlebar-area|AppBar|window-drag-region|window-no-drag-region|no-drag' packages/ui apps/desktop

Repository: dvaJi/argos

Length of output: 7593


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== AppBar styles/classes in packages/ui/src/assets/style.css =="
sed -n '880,955p' packages/ui/src/assets/style.css

echo "== AppBar styles/classes in package css files excluding asset =="
rg -n -C 3 'window-drag-region|window-no-drag-region|titlebar-area|app-region|webkit-app-region' packages/ui -g '*.css' -g '*.scss'

echo "== TypeScript definitions/usages for titlebar-area =="
rg -n -C 3 'titlebar-area-(x|y|width|height)' .

Repository: dvaJi/argos

Length of output: 2141


🌐 Web query:

Electron titleBarOverlay titlebar-area-width titlebar-area-x CSS environment variables drag region default area

💡 Result:

In Electron, the titleBarOverlay feature enables the Window Controls Overlay API, which allows developers to customize the title bar area while maintaining native window control buttons [1][2]. When this feature is enabled, you must use CSS environment variables to ensure your custom content does not overlap with the native window controls [1][2][3]. CSS Environment Variables The following environment variables are available to define the dimensions and position of the title bar area: - env(titlebar-area-x, 0px): The horizontal offset of the available title bar area [1][3]. - env(titlebar-area-y, 0px): The vertical offset of the available title bar area [4][3]. - env(titlebar-area-width, 100%): The width of the available title bar area [1][3]. - env(titlebar-area-height, 30px): The height of the available title bar area [4][3]. These variables help you position your custom title bar container so it stays adjacent to the native window controls [3][5]. A typical implementation looks like this: #title-bar { position: fixed; left: env(titlebar-area-x, 0); top: env(titlebar-area-y, 0); height: env(titlebar-area-height, 50px); width: env(titlebar-area-width, 100%); } Drag Regions To make your custom title bar draggable, you apply the -webkit-app-region: drag CSS property [6][7]. When using titleBarOverlay, the native window controls (close, minimize, maximize) are automatically non-draggable [1][2]. You must ensure that any interactive elements within your custom title bar (such as buttons) are explicitly set to -webkit-app-region: no-drag [6]. Important Considerations: - Default Area: When titleBarOverlay is enabled, the area occupied by the native buttons is reserved by the OS [1][2]. Your CSS content should not be placed in this reserved region, which is why the environment variables are used to provide the safe "available" width and position [1][3]. - Compatibility: Ensure you are using a modern version of Electron (v18.0.0 or later recommended), as earlier versions had issues where titleBarOverlay could interfere with drag regions on Windows [8][7]. - Integration: This API is based on the web standard Window Controls Overlay API, meaning it behaves consistently with how it is implemented in Progressive Web Apps (PWAs) [1][9][4].

Citations:


🌐 Web query:

WICG window-controls-overlay titlebar-area-x default CSS environment variables width titlebar-area-width titlebar-area-x 0px

💡 Result:

The CSS environment variables titlebar-area-x, titlebar-area-y, titlebar-area-width, and titlebar-area-height are part of the Window Controls Overlay API, which allows Progressive Web Apps (PWAs) to customize their title bar area [1][2][3]. These variables define the rectangular region that would typically be occupied by the browser's title bar and window control buttons (minimize, maximize, and close) [4][5]. Because these variables are only defined when the window-controls-overlay display mode is active, it is standard practice to provide fallback values within the CSS env() function for environments where the feature is unsupported or disabled [4][6][5]. Commonly used fallback values for these variables include: - titlebar-area-x: 0px [1][4] - titlebar-area-y: 0px [4][6] - titlebar-area-width: 100% [1][4] - titlebar-area-height: A static pixel value (e.g., 33px or 50px), representing the height of a standard title bar [4][6] Example usage in CSS: #title-bar { position: fixed; left: env(titlebar-area-x, 0px); top: env(titlebar-area-y, 0px); width: env(titlebar-area-width, 100%); height: env(titlebar-area-height, 50px); } Using these variables ensures that your custom content correctly aligns with the system's window controls when the overlay is active, while providing a reasonable layout fallback when it is not [4][5].

Citations:


Avoid using AppBar width for Windows controls layout.

On Windows, titleBarOverlay reserves the native caption button region and exposes it via CSS environment variables. AppBar is rendered at 100% width with buttons in the top-right drag region, so its layout should use env(titlebar-area-width, ...), rather than the current full-width drag behavior.

🤖 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 `@apps/desktop/src/main/presenter/windowPresenter/index.ts` around lines 44 -
63, Update the Windows title-bar overlay layout associated with
getTitleBarOverlayOptions so the AppBar’s drag/content region uses the
titlebar-area-width CSS environment value instead of assuming full width;
preserve the existing overlay colors, height, and non-Windows undefined
behavior.

Comment thread apps/desktop/src/main/presenter/windowPresenter/index.ts
Comment thread packages/shared/src/types/presenters/legacy.presenters.d.ts
Comment thread packages/ui/settings/components/AgentExtensionPolicyPanel.tsx Outdated
Comment thread packages/ui/settings/components/ArgosAgentsSettings.tsx Outdated
Comment thread packages/ui/settings/components/ScheduledTasksSettings.tsx Outdated
Comment thread packages/ui/src/components/AppBar.tsx Outdated
Comment thread packages/ui/src/composables/useAcpAgentUpdateNotifications.ts
Consolidate desktop scheduled-task normalize onto backend-core so the
daily/weekly lastFiredAt floor applies on desktop too (was a separate,
unfixed copy -> still infinite-looped). Omit WCO symbolColor in Windows
forced-colors mode. Serialize per-task upserts in ScheduledTasksSettings.
Queue ACP recheck when an event arrives mid-flight. Gate AppBar custom
controls on platform detection to avoid a duplicate-control flash.
Remove manual useMemo (React Compiler) and redundant sr-only labels,
add a session-row keyboard handler, broaden piToolCatalog schema
(edit.edits[] + recursive property type), fix MCP scope allowlist
wording, and align the eventbus test mock with the presenter contract.
Add recurrence-boundary + full Pi-tool regression tests.

@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

🧹 Nitpick comments (1)
apps/desktop/test/main/presenter/scheduledTasks.test.ts (1)

155-197: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact next-fire timestamp for the daily cases.

Both daily tests use inequality assertions only. An implementation that returns any far-future timestamp passes them. The weekly test at Line 199 already asserts an exact value. Apply the same precision to the daily cases so a regression in the day-advance arithmetic is caught.

♻️ Proposed exact assertions
     const next = computeNextFireAt(task, reference.getTime());
-    expect(next).not.toBeNull();
-    expect(next!).toBeGreaterThan(reference.getTime());
-    // Must not be the same-day slot that already fired.
-    expect(next).not.toBe(slotToday.getTime());
+    // Must be the next-day slot, not the same-day slot that already fired.
+    const slotTomorrow = new Date(slotToday);
+    slotTomorrow.setDate(slotTomorrow.getDate() + 1);
+    expect(next).toBe(slotTomorrow.getTime());
     const next = computeNextFireAt(task, after.getTime());
-    expect(next).not.toBeNull();
-    expect(next!).toBeGreaterThan(lastFired.getTime());
+    const slotTomorrow = new Date();
+    slotTomorrow.setHours(9, 30, 0, 0);
+    slotTomorrow.setDate(slotTomorrow.getDate() + 1);
+    expect(next).toBe(slotTomorrow.getTime());
🤖 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 `@apps/desktop/test/main/presenter/scheduledTasks.test.ts` around lines 155 -
197, Update the two daily tests around computeNextFireAt to assert the exact
expected next-fire timestamp, matching the precision of the weekly test. For the
09:30:05 same-day case and the 09:29 effectiveAfter case, construct the expected
next-day 09:30 timestamp and compare next exactly against it, while retaining
the non-null assertion.
🤖 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 `@packages/ui/settings/components/ScheduledTasksSettings.tsx`:
- Around line 134-152: Replace the single isSaving boolean tracking around the
task upsert flow with a pending-operation counter or task-ID set,
incrementing/adding before each mutation and decrementing/removing in every
completion path, including errors and finally cleanup. Keep the Saving indicator
active until all concurrent upserts have finished, and update the relevant state
logic around the task persistence handler.
- Around line 130-160: The current per-task persistChain does not serialize
complete settings-snapshot updates across different task operations. Update the
settings mutation flow around persistChainRef and the toggle, remove, and
fireNow handlers so every upsert or operation that applies response.settings
uses one shared ordered queue, ensuring older snapshots cannot overwrite newer
mutations.

---

Nitpick comments:
In `@apps/desktop/test/main/presenter/scheduledTasks.test.ts`:
- Around line 155-197: Update the two daily tests around computeNextFireAt to
assert the exact expected next-fire timestamp, matching the precision of the
weekly test. For the 09:30:05 same-day case and the 09:29 effectiveAfter case,
construct the expected next-day 09:30 timestamp and compare next exactly against
it, while retaining the non-null assertion.
🪄 Autofix

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 Plus

Run ID: 9ff4a214-8eee-4f13-9569-1d7e59158eab

📥 Commits

Reviewing files that changed from the base of the PR and between 385a668 and 3199426.

📒 Files selected for processing (13)
  • apps/daemon/src/host/piToolCatalog.ts
  • apps/daemon/test/daemonScheduledTasks.test.ts
  • apps/daemon/test/daemonToolDefinitions.test.ts
  • apps/desktop/src/main/presenter/scheduledTasks/normalize.ts
  • apps/desktop/src/main/presenter/windowPresenter/index.ts
  • apps/desktop/test/main/eventbus/eventbus.test.ts
  • apps/desktop/test/main/presenter/scheduledTasks.test.ts
  • packages/ui/settings/components/AgentExtensionPolicyPanel.tsx
  • packages/ui/settings/components/ArgosAgentsSettings.tsx
  • packages/ui/settings/components/ScheduledTasksSettings.tsx
  • packages/ui/src/components/AppBar.tsx
  • packages/ui/src/components/WindowSideBarSessionItem.tsx
  • packages/ui/src/composables/useAcpAgentUpdateNotifications.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/daemon/src/host/piToolCatalog.ts
  • packages/ui/src/composables/useAcpAgentUpdateNotifications.ts
  • apps/daemon/test/daemonToolDefinitions.test.ts
  • packages/ui/settings/components/AgentExtensionPolicyPanel.tsx
  • packages/ui/settings/components/ArgosAgentsSettings.tsx
  • packages/ui/src/components/WindowSideBarSessionItem.tsx
  • apps/desktop/src/main/presenter/windowPresenter/index.ts
  • packages/ui/src/components/AppBar.tsx

Comment thread packages/ui/settings/components/ScheduledTasksSettings.tsx Outdated
Comment thread packages/ui/settings/components/ScheduledTasksSettings.tsx Outdated
Replace the per-task upsert chain and isSaving boolean with a single
ordered mutation queue that covers every settings-mutating operation
(upsert, toggle, remove, fireNow) and a pending-operation counter for
the Saving indicator. Out-of-order responses across different tasks or
operations can no longer restore older fields, and concurrent saves no
longer flip the indicator off early. Uses promise chaining instead of
try/finally so React Compiler can still optimize the component.
@dvaJi
dvaJi merged commit b94299c into master Aug 10, 2026
5 checks passed
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.

2 participants