Skip to content

fix(desktop): expose task-agent status to chat#8104

Open
Git-on-my-level wants to merge 4 commits into
BasedHardware:mainfrom
Git-on-my-level:fix/task-agent-status-awareness
Open

fix(desktop): expose task-agent status to chat#8104
Git-on-my-level wants to merge 4 commits into
BasedHardware:mainfrom
Git-on-my-level:fix/task-agent-status-awareness

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an in-memory macOS task-agent status registry for Omi task-chat agents
  • expose get_task_agent_status through both desktop tool surfaces so chat can inspect running/completed/failed/timed-out task agents
  • add prompt guidance so Omi interprets “your subagents” as Omi task agents instead of denying they exist

Why

The desktop chat can run task-chat agents, but the main/floating chat had no explicit awareness surface for them. When a user asked about “your subagents” after seeing a task-agent timeout, the assistant could plausibly answer that it had no subagents and could not diagnose the timeout.

This gives the assistant a small, local status surface it can query before answering those questions.

Testing

  • swiftc -parse desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskAgentStatusRegistry.swift desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskChatCoordinator.swift desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskChatState.swift desktop/macos/Desktop/Sources/Providers/ChatToolExecutor.swift desktop/macos/Desktop/Sources/Providers/ChatProvider.swift desktop/macos/Desktop/Sources/Chat/ChatPrompts.swift
  • git diff --check

Not fully run:

  • swift build started dependency resolution but timed out after 600s while downloading SwiftPM binary artifacts.
  • npm install && npm run build could not complete on this machine because the filesystem ran out of space while installing dependencies.

Review in cubic

@Git-on-my-level Git-on-my-level force-pushed the fix/task-agent-status-awareness branch from 138f237 to 6d88030 Compare June 22, 2026 00:16

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 138f237bde

ℹ️ 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".

},
},
{
name: "get_task_agent_status",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Forward get_task_agent_status in stdio handler

This advertises get_task_agent_status from the stdio MCP server, but the tools/call dispatcher below only forwards the existing local/onboarding/backend tool names and otherwise returns Unknown tool (checked the handler around lines 691-856). In ACP/stdio sessions, any model that follows the new prompt guidance and calls this listed tool will get a JSON-RPC -32601 error instead of the Swift registry result, so the subagent-timeout diagnosis still fails for that bridge mode. Add this tool name to a requestSwiftTool path just like get_daily_recap/search_tasks.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai 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.

4 issues found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread desktop/macos/agent/src/omi-tools-stdio.ts

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed the review feedback in 20a005fd7.

Summary:

  • Fixed the stdio MCP dispatcher so get_task_agent_status is not just advertised, but actually forwarded to Swift via requestSwiftTool(...).
  • Bounded task-agent status output: snapshotJSON() now returns the 20 most recent task-agent entries, and the registry prunes retained history to 100 entries.
  • Added explicit stopped status for user-stopped task-agent runs.
  • Moved terminal status ownership to TaskChatState; TaskChatCoordinator no longer infers completion from errorMessage == nil, which avoided incorrectly marking stopped runs as completed.

Verification:

  • git diff --check
  • swiftc -parse on the modified Swift files
  • npm run build in desktop/macos/agent
  • npm test in desktop/macos/agent — 74 tests passed

Thanks to cubic and Codex for catching the stdio forwarding gap; cubic also identified the unbounded snapshot and stopped-run status issues.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskAgentStatusRegistry.swift">

<violation number="1" location="desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskAgentStatusRegistry.swift:132">
P2: Retention cap is only enforced on update paths, not on task registration. This leaves `entries` effectively unbounded for tasks that are registered but never updated.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

entry.lastError = lastError
entry.updatedAt = Date()
entries[taskId] = entry
pruneIfNeeded()

@cubic-dev-ai cubic-dev-ai Bot Jun 22, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Retention cap is only enforced on update paths, not on task registration. This leaves entries effectively unbounded for tasks that are registered but never updated.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/TaskAgent/TaskAgentStatusRegistry.swift, line 132:

<comment>Retention cap is only enforced on update paths, not on task registration. This leaves `entries` effectively unbounded for tasks that are registered but never updated.</comment>

<file context>
@@ -121,5 +129,17 @@ final class TaskAgentStatusRegistry {
     entry.lastError = lastError
     entry.updatedAt = Date()
     entries[taskId] = entry
+    pruneIfNeeded()
+  }
+
</file context>
Fix with cubic

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20a005fd7b

ℹ️ 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".


activeTaskId = task.id
markAsRead(task.id)
TaskAgentStatusRegistry.shared.registerTask(taskId: task.id, title: task.description)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Register background agents with task titles

This registration only runs when the task chat panel is opened, but background investigations from the scheduler or Tasks page create a TaskChatState and call sendMessage without going through openChat. In that path the new markRunning/markFailed calls create the registry entry with title == nil, so get_task_agent_status reports only an opaque taskId for the background agents/timeouts this tool is meant to diagnose. Register the task in investigateInBackground as well, or pass the task title into the state before sending.

Useful? React with 👍 / 👎.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Follow-up for cubic's second-pass comment in 4ada41a4c:

  • The retention cap is now enforced on every registry write path:
    • registerTask(...)
    • updateStatus(...)
    • terminal updates via the existing shared update(...) helper
  • This means even tasks that are registered and never run/update cannot grow the in-memory registry past the retained-entry cap.

Verification:

  • git diff --check
  • swiftc -parse on the modified Swift files

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed Codex's follow-up comment in a3e65573e:

  • investigateInBackground(for:) now registers the task with TaskAgentStatusRegistry before creating/reusing the TaskChatState.
  • Background task-agent runs now have the task description/title available in get_task_agent_status, not just an opaque task id.

Verification:

  • git diff --check
  • swiftc -parse on the modified Swift files

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3e65573e2

ℹ️ 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".


isSending = true
errorMessage = nil
TaskAgentStatusRegistry.shared.markRunning(taskId: taskId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record bridge-start failures in the task-agent registry

When a task-chat bridge fails before streaming starts, such as a missing bridge process or an AgentBridge.start() initialization timeout, ensureBridgeStarted() sets errorMessage and returns at the guard above before this first registry update runs. The coordinator has already registered the task, so get_task_agent_status will report it as idle with no lastError instead of the startup failure/timeout this new tool is meant to diagnose; mark the registry failed on the ensureBridgeStarted() failure path before returning.

Useful? React with 👍 / 👎.

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