Skip to content

feat(native-chat): teach chat agents to keep long-running work visible - #34306

Open
YangNuoCheng wants to merge 3 commits into
stablyai:mainfrom
YangNuoCheng:feat/chat-background-work-skill
Open

YangNuoCheng wants to merge 3 commits into
stablyai:mainfrom
YangNuoCheng:feat/chat-background-work-skill

Conversation

@YangNuoCheng

Copy link
Copy Markdown
Contributor

ELI5

When an agent in an Orca chat starts a long job on a server and walks away, Orca shows the chat as done even though the job is still running, and nobody notices if the job dies. This teaches chat agents to keep such jobs visible, so the chat shows "monitoring" until the job ends and then notifies you.

What Changed

Before: an agent that starts work with setsid nohup over ssh, tmux, or a background codex exec ends its turn and the chat shows done. The job is invisible to Orca: no monitoring state, no task row, no notification when it ends or fails.

After: chat agents get a new bundled skill, orca-chat-background-work, telling them to:

  • run long work as their own background command when they can (Orca already tracks those);
  • when work must be detached or runs on another machine, start a watcher as their own background command that lives exactly as long as the work (ssh HOST 'while kill -0 PID 2>/dev/null; do sleep 30; done; tail -n 20 LOG'), so the chat stays in working · monitoring and turns done with a notification when the work ends;
  • take the pid from the starting command (& echo $!), since pgrep -f through ssh can match its own remote shell;
  • check that the process exists and its log grows before saying it started, and look before reporting progress.

Mechanism: the skill lives in resources/native-chat-visuals/skills/, the plugin Orca already hands to every chat agent (Claude loads the plugin directory; Codex and ACP agents get its skills root). No code changes. The plugin description now mentions the new skill.

Why

Agents routinely say "I'll report back" about detached jobs, and the user cannot tell from the chat whether anything is still running. Orca's existing monitoring state already does the right thing for work the agent tracks itself, so the smallest fix is to make agents keep detached work tracked. Registering external work in Orca directly (polled checks, progress in the task row) is a larger change to the child-work model and is left for a follow-up described in the issue.

Linked Issue

Fixes #34305

Visual Proof

N/A: no UI change. Observed with Orca 1.4.240 and a Codex chat, reading the state from orca worktree ps --json, while the agent followed this skill for a detached 9-step job on a remote Linux host:

15:17:45 working                 agent starting the job and the watcher
15:18:26 working · monitoring    turn ended; job running (log: step 4)
15:19:21 working · monitoring    job running (log: step 9)
15:20:01 done                    job ended ~15:19:26; watcher exited on its next check

Without the watcher the same chat shows done as soon as the turn ends. In this run the agent's first watcher exited at once because pgrep -f over ssh matched its own shell; the skill's "check before saying it started" step made it notice and fix this. The skill now steers the agent to echo $! instead.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Manual: the run above, plus a Codex background-terminal sleep 150 (monitoring for ~150 s, then done) to confirm the existing tracking the skill relies on.

  • No new tests: the change is a skill file and a plugin description. Existing suites that load this plugin pass (codex-structured-visuals, claude-structured-launch-visuals, native-chat-visuals*: 34 tests), and pnpm lint passes. The skill keeps its description under 1024 characters with no angle-bracket placeholders.

  • Tested with Codex on macOS against a Linux server. Not tested with Claude Code or ACP agents, which receive the same plugin.

AI Disclosure

Written with an AI coding agent (Claude, claude-opus-5-5) under my direction; I reviewed the change and ran the manual tests.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: the skill adds no capability; it changes how agents use commands they can already run. Cost: a watcher polls once every 30 s. Limitation: if the watcher's ssh connection drops, the chat shows done while the job may still run; the skill tells the agent to recheck the host before reporting the job stopped.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2db54941-8169-4da7-8f5d-f4e8305597ec
Commits

Reviewing files that changed from the base of the PR and between c64e824 and bb67464.

Files selected for processing: 1
  • resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md
Files skipped from review as they are similar to previous changes: 1
  • resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

The plugin description now says that the agent can keep long-running work visible. A new skill instructs Orca agents to run trackable work in the background or use a watcher for detached or remote work. It specifies process and log checks before reporting that work started, progressed, or completed. The artifact list and delivery test now include the skill.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to bb674

The skill now keeps tracking remote work through connection failures and is included in ORCAD delivery. No identified issue blocks merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: teaching native chat agents to keep long-running work visible.
Description check Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, platform coverage, security considerations, and checklis…
Linked Issues check Passed Issue #34305 requires guidance that keeps detached or remote long-running work visible through Orca tracking. resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md directs agents t…
Out of Scope Changes check Passed The changes are limited to the background-work skill, the plugin description, the Orca artifact manifest, and the delivery test. The skill implements issue #34305. The description, manifest entry, and…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, platform coverage, security considerations, and checklist status. It should correct the statement that there are no code changes because the artifact registry and test expectations were updated.

Full details: Linked Issues check

Explanation

Issue #34305 requires guidance that keeps detached or remote long-running work visible through Orca tracking. resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md directs agents to use their own background command when possible, or a local watcher for detached or remote work. It requires PID capture from the start command, process and log-growth checks before reporting a start, and process and log checks before reporting progress. The skill includes POSIX, PowerShell, and retrying SSH guidance. src/shared/orcad-artifacts.ts includes the skill, and src/main/native-chat/native-chat-visuals-delivery.test.ts verifies the bundled artifact list. The issue leaves built-in external-work registration as a follow-up, so this PR does not need to implement it.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the background-work skill, the plugin description, the Orca artifact manifest, and the delivery test. The skill implements issue #34305. The description, manifest entry, and test support discovery and delivery of that skill. The Windows and SSH retry guidance supports detached or remote work. No unrelated change is established.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76706100-fcc2-4834-b27e-1dcaec420d06
Commits

Reviewing files that changed from the base of the PR and between cbbaa2d and ec765b4.

Files selected for processing: 2
  • resources/native-chat-visuals/.claude-plugin/plugin.json
  • resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

…its watchers

- register orca-chat-background-work/SKILL.md in ORCAD_NATIVE_CHAT_VISUALS_ARTIFACTS
  so headless and remote agents also receive it, and extend the exact-list test
- add a PowerShell watcher for Windows hosts
- run the ssh watcher locally and retry failed checks so a dropped connection
  no longer ends the watcher while the remote work is alive
@YangNuoCheng

Copy link
Copy Markdown
Contributor Author

All three points addressed in c64e824:

  • The skill is now registered in ORCAD_NATIVE_CHAT_VISUALS_ARTIFACTS (with the exact-list test updated), so headless and remote ORCAD agents receive it too.
  • Added a PowerShell watcher variant for Windows hosts alongside the POSIX one.
  • The ssh watcher now runs locally and loops until a successful check reports the remote pid gone; failed ssh checks are retried instead of ending the watcher, so a dropped connection no longer makes the chat show done while the work is still running.

Lint, typecheck, and the visuals-delivery tests pass locally.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0191f5f6-ad82-4117-866f-f354d9be97a2
Commits

Reviewing files that changed from the base of the PR and between ec765b4 and c64e824.

Files selected for processing: 3
  • resources/native-chat-visuals/skills/orca-chat-background-work/SKILL.md
  • src/main/native-chat/native-chat-visuals-delivery.test.ts
  • src/shared/orcad-artifacts.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@YangNuoCheng

Copy link
Copy Markdown
Contributor Author

Cross-linking #37407 — an umbrella issue for super-agent workflows; this PR covers the verify-and-close step (telling whether a job an agent detached is still alive).

This branch has not been deployed

No deployments
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.

[Feature]: Long-running work an agent detaches (nohup/tmux/ssh) leaves the chat showing done

1 participant