Skip to content

refactor(tools): fold background jobs into executeCommand - #1892

Merged
zhanba merged 3 commits into
mainfrom
codex/stage2-execute-command-background
Aug 13, 2026
Merged

refactor(tools): fold background jobs into executeCommand#1892
zhanba merged 3 commits into
mainfrom
codex/stage2-execute-command-background

Conversation

@zhanba

@zhanba zhanba commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a background flag to executeCommand and remove the standalone startBackgroundJob / readBackgroundJobOutput tools. A background call starts the job and returns its ID plus the output file path, which the model reads with readFile; killBackgroundJob still stops it.
  • Wire the flag through all three hosts: VS Code creates a TerminalJob, the CLI delegates to the background job manager, and the WebUI renders background commands via BackgroundJobPanel (job ID travels in output._meta, stripped before reaching the LLM).
  • Update tool policies, batching, readonly constraints, fork-task rewriting, settings/stories, browser agent prompt, and custom-agent docs to the single executeCommand surface — startBackgroundJob(...) policy entries are gone, so background commands are governed by executeCommand(...) patterns.

Test plan

  • bun check
  • bun tsc
  • bun run test (includes new packages/tools and updated CLI/VS Code/WebUI tests)
  • Manual: run a background command in VS Code, confirm the tool card shows the job, output file is readable with readFile, and killBackgroundJob stops it
  • Manual: run a background command in the CLI and confirm the "Running in background" renderer line and output file
  • Manual: verify a custom agent restricted with executeCommand(npm run dev) can start that background command and is blocked from others

🤖 Generated with Pochi | Task

Collapse startBackgroundJob and readBackgroundJobOutput into a single
executeCommand tool with a background flag, so agents use one command
surface and read job output through readFile instead of a dedicated
polling tool.

🤖 Generated with [Pochi](https://getpochi.com) | [Task](https://app.getpochi.com/share/p-694b5ff250b14ffd8725893807e3dce0)

Co-Authored-By: Pochi <noreply@getpochi.com>
@codecov-commenter

codecov-commenter commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.74860% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.62%. Comparing base (a5c28be) to head (93d81b7).

Files with missing lines Patch % Lines
.../src/features/tools/components/execute-command.tsx 6.89% 27 Missing ⚠️
...eatures/tools/__stories__/tool-gallery.stories.tsx 0.00% 19 Missing ⚠️
...c/features/chat/lib/use-background-job-display.tsx 0.00% 9 Missing ⚠️
packages/tools/src/utils/tool-batch.ts 22.22% 7 Missing ⚠️
...i/src/features/tools/components/tool-call-lite.tsx 28.57% 5 Missing ⚠️
packages/cli/src/tools/execute-command.ts 87.50% 2 Missing ⚠️
...rc/features/chat/lib/batched-tool-call-adapters.ts 0.00% 2 Missing ⚠️
...ebui/src/features/chat/lib/tool-call-life-cycle.ts 0.00% 2 Missing ⚠️
...scode-webui/src/lib/vscode-running-task-adaptor.ts 0.00% 2 Missing ⚠️
packages/vscode/src/tools/execute-command.ts 93.75% 2 Missing ⚠️
... and 4 more

❌ Your patch status has failed because the patch coverage (54.74%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1892      +/-   ##
==========================================
- Coverage   36.43%   30.62%   -5.81%     
==========================================
  Files         775      770       -5     
  Lines       81332    81084     -248     
  Branches     3646     4128     +482     
==========================================
- Hits        29630    24831    -4799     
- Misses      51589    56135    +4546     
- Partials      113      118       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-13 09:10 UTC

@zhanba
zhanba added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit cd6fa09 Aug 13, 2026
4 checks passed
@zhanba
zhanba deleted the codex/stage2-execute-command-background branch August 13, 2026 09:01
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