Skip to content

fix: clarify background command timeouts - #140022

Merged
steipete merged 2 commits into
mainfrom
codex/exec-background-timeout-description
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/exec-background-timeout-description

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves unclear exec guidance for agents starting background services: a short timeout still terminates the process after the tool has returned a running session.

Why This Change Was Made

Clarifies that timeoutSeconds limits total command lifetime, while background and yieldMs control when the tool returns. Documents the existing zero-timeout option and how to stop a persistent service explicitly. Shared timeout guidance remains valid for node-only and completion-only surfaces; background-service examples are scoped to gateway or sandbox execution.

User Impact

Agents and operators can distinguish a process deadline from an output wait and choose the appropriate lifetime for a background service. Runtime behavior and configured defaults are unchanged.

Evidence

  • Real exec/process proof on macOS with Node 26.8.1: the same two-second command returned a background session in both cases. A one-second deadline produced overall-timeout and SIGTERM; timeoutSeconds: 0 bypassed the configured one-second default and completed with exit code 0.
  • Actual Code Mode catalog.search("exec")[0].describe() exposed the corrected parameter guidance. The same probe failed its missing-lifetime-guidance assertion before the change and passed afterward; process behavior stayed the same.
  • All 84 existing tests passed across agent-tools.schema.test.ts, bash-tools.schemas.test.ts, bash-tools.exec-timeout-seconds.test.ts, and bash-tools.exec.background-abort.test.ts.
  • CI caught an initial description-budget regression at 788 characters. The revised schema is 547 characters under the unchanged 550-character limit; the exact failing test was reproduced locally and now passes. Existing environment, PTY, elevation, approval, and other parameter constraints remain documented.
  • node scripts/check-changed.mjs passed, including formatting, core and core-test typechecks, lint, and repository guards. Fresh independent review of the complete staged candidate found no actionable P0–P2 issues.

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 10:16
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 7:07 AM ET / 11:07 UTC.

ClawSweeper review

What this changes

Clarifies exec tool descriptions and documentation so agents distinguish background return timing from process lifetime and know how to disable the existing timeout.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused clarification absent from current main and the latest release. No actionable correctness findings remain; the maintainer-authored PR is also protected from automatic closure.

Priority: P3
Reviewed head: ef23ec6d4eed47547bef7adf1819743c5543714f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent clarification that preserves schema constraints and fits the existing description budget.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor proof gate does not apply to this MEMBER-authored PR. Its body nevertheless reports macOS exec/process timeout observations and a before/after OpenClaw Code Mode description probe covering the changed guidance.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor proof gate does not apply to this MEMBER-authored PR. Its body nevertheless reports macOS exec/process timeout observations and a before/after OpenClaw Code Mode description probe covering the changed guidance.
Evidence reviewed 11 items Verified review scope: The supplied complete merge-base-to-head patch introduces only documentation and parameter-description changes. Local name-only comparison confirms the same three paths; the checkout remained clean.
Existing lifetime ownership: Exec preserves an explicit zero with nullish default selection and passes the resulting timeout into process startup. Background return changes caller waiting, while the supervisor retains the deadline.
Zero disables the process timer: The runtime converts nonpositive process timeouts to an absent timer; positive values become milliseconds passed to the supervisor. Its overall deadline requests cancellation on expiry.
Findings None None.
Security None None.

How this fits together

OpenClaw’s exec tool starts shell commands and can return a background session for later process-tool interaction. A separate supervisor enforces the command’s lifetime after exec returns.

flowchart TD
  A[Agent command and options] --> B[Exec tool]
  B --> C[Process supervisor]
  B --> D[Background session returned]
  C --> E{Lifetime limit enabled?}
  E -->|Expires| F[Terminate process]
  E -->|Disabled| G[Run until completion or explicit stop]
  D --> H[Process tool polls or stops session]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Docs +1. Total +5 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 5 +4
Tests 0 0 0 0
Docs 2 5 4 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 14 9 +5

Review metrics

Metric Value Why it matters
Model-facing description budget 547 characters; existing limit <550 The revised guidance fits the unchanged budget while retaining the existing parameter constraints.

Technical review

Best possible solution:

Keep the existing execution semantics and make process lifetime, return timing, explicit stopping, and host lifecycle limits clear at the tool and documentation surfaces.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a runtime defect: this PR clarifies existing behavior, which source inspection confirms; the body also reports a matching real exec/process run.

Is this the best way to solve the issue?

Yes. Updating the existing schema descriptions and documentation is a narrow solution that preserves defaults and avoids introducing another execution mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 873f424585af.

Labels

Label justifications:

  • P3: This improves documentation and model-facing guidance without changing runtime behavior or defaults.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor proof gate does not apply to this MEMBER-authored PR. Its body nevertheless reports macOS exec/process timeout observations and a before/after OpenClaw Code Mode description probe covering the changed guidance.

Evidence

What I checked:

  • Verified review scope: The supplied complete merge-base-to-head patch introduces only documentation and parameter-description changes. Local name-only comparison confirms the same three paths; the checkout remained clean. (src/agents/bash-tools.schemas.ts:43, ef23ec6d4eed)
  • Existing lifetime ownership: Exec preserves an explicit zero with nullish default selection and passes the resulting timeout into process startup. Background return changes caller waiting, while the supervisor retains the deadline. (src/agents/bash-tools.exec-run.ts:567, ef23ec6d4eed)
  • Zero disables the process timer: The runtime converts nonpositive process timeouts to an absent timer; positive values become milliseconds passed to the supervisor. Its overall deadline requests cancellation on expiry. (src/agents/bash-tools.exec-runtime.ts:87, ef23ec6d4eed)
  • Node execution remains separately bounded: Node execution maps a zero process timeout to zero while retaining a finite invocation deadline. The proposed persistent-service examples appropriately name gateway and sandbox execution, and the node-only schema does not expose background controls. (src/agents/bash-tools.exec-host-node-phases.ts:99, ef23ec6d4eed)
  • Description budget preserved: Read-only extraction of the 12 description strings, including the shared title description, totals 547 characters. The existing test requires fewer than 550 and checks that units, PTY, elevation permission, and approval constraints remain discoverable. (src/agents/agent-tools.schema.test.ts:46, ef23ec6d4eed)
  • Clarification is not already on main: The fetched main revision still describes background as immediate return and timeoutSeconds as 'Timeout in seconds'; its exec documentation lacks the new explicit post-return lifetime explanation. (src/agents/bash-tools.schemas.ts:43, 873f424585af)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Omar Shahine: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T10:22:02.103Z sha e830858 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 902774c into main Sep 6, 2026
301 of 303 checks passed
@steipete
steipete deleted the codex/exec-background-timeout-description branch September 6, 2026 12:03
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc pushed a commit to gaoanze888/openclaw that referenced this pull request Sep 6, 2026
* commit '3ed964c8ca6206d26ecc0b6567ccd1389d9948fc': (36 commits)
  refactor(plugins): unify install config snapshot preparation (openclaw#140081)
  fix: cloud provisioning stays failed after temporary storage recovers (openclaw#140021)
  fix(ci): preflight job outputs exceed 1 MiB on full-plan pull requests (openclaw#140018)
  refactor: consolidate command and provider helpers (openclaw#140072)
  fix(doctor): replace unavailable TUI cleanup advice (openclaw#140074)
  fix(plugins): avoid scoped pack failures and missing runtime entries (openclaw#140016)
  fix: clarify background command timeouts (openclaw#140022)
  fix(workboard): refresh board navigation while retaining drafts (openclaw#139952)
  fix: preserve newer chat drafts when rewind completes (openclaw#140066)
  feat(transcripts): browse and export saved meeting archives (openclaw#139875)
  fix(cron): complete timeout test observation phase (openclaw#140076)
  fix(macos): show the full automation count (openclaw#139692)
  fix: native worker turns fail to load WebSocket transport (openclaw#140071)
  fix(cli): complete quoted Bash option values (openclaw#140034)
  fix(chat): show command instructions while pending (openclaw#140041)
  refactor(cli): use canonical resume result schema (openclaw#140056)
  fix: restore package acceptance across install runtimes (openclaw#140062)
  refactor(auto-reply): keep model-selection fixtures in tests (openclaw#140069)
  fix(plugins): remove owned aliases before uninstalling files (openclaw#140065)
  fix: completed replies hang when context-engine cleanup stalls (openclaw#140023)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
* fix(exec): clarify timeouts for background services

* fix(exec): fit timeout guidance within description budget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant