Hard-stop agent workflows when shell spawn returns exit_code -1 #258

Closed
opened 2026-07-06 12:09:24 -05:00 by jcwalker3 · 1 comment
Owner

Problem

When the Cursor/Grok shell executor fails to spawn (exit_code: -1, no stdout/stderr), agents currently retry indefinitely. In session 019f382e this caused 100+ tool calls and multi-minute stalls on a trivial encode+commit task.

Proposal

  • After the first spawn failure on a trivial probe (echo, pwd), mark shell unavailable for the session.
  • After N consecutive spawn failures (e.g. 2), hard-stop further Shell tool use and return a recovery report.
  • Recovery report should mention: restart session, kill hung background terminals, use MCP-native paths.

Acceptance

  • Documented operator/agent behavior when shell spawn is broken.
  • Tests or harness guardrails prevent retry spirals.

Context

Blocked #152 doc commit on 2026-07-06; hung pytest in terminal 5 (pid 23337) suspected contributor.

## Problem When the Cursor/Grok shell executor fails to spawn (`exit_code: -1`, no stdout/stderr), agents currently retry indefinitely. In session `019f382e` this caused 100+ tool calls and multi-minute stalls on a trivial encode+commit task. ## Proposal - After the first spawn failure on a trivial probe (`echo`, `pwd`), mark shell unavailable for the session. - After N consecutive spawn failures (e.g. 2), hard-stop further Shell tool use and return a recovery report. - Recovery report should mention: restart session, kill hung background terminals, use MCP-native paths. ## Acceptance - Documented operator/agent behavior when shell spawn is broken. - Tests or harness guardrails prevent retry spirals. ## Context Blocked #152 doc commit on 2026-07-06; hung pytest in terminal 5 (`pid 23337`) suspected contributor.
jcwalker3 added the status:in-progress label 2026-07-06 13:44:52 -05:00
Author
Owner

Claimed. Branch: docs/issue-258-shell-spawn-hard-stop. Worktree: branches/docs-issue-258-shell-spawn-hard-stop. Lock taken via gitea_lock_issue (fail-closed check passed).

Scope for this slice (per acceptance criteria):

  • Documented operator/agent behavior for shell-spawn failure (exit_code: -1, empty stdout/stderr): probe once, mark shell unavailable, hard-stop after 2 consecutive spawn failures, emit recovery report (restart session, kill hung background terminals, prefer MCP-native paths)
  • Rule text in docs/llm-workflow-runbooks.md and the portable skill doc
  • Doc-contract tests so the guardrail text cannot silently regress
Claimed. Branch: `docs/issue-258-shell-spawn-hard-stop`. Worktree: `branches/docs-issue-258-shell-spawn-hard-stop`. Lock taken via `gitea_lock_issue` (fail-closed check passed). Scope for this slice (per acceptance criteria): - Documented operator/agent behavior for shell-spawn failure (`exit_code: -1`, empty stdout/stderr): probe once, mark shell unavailable, hard-stop after 2 consecutive spawn failures, emit recovery report (restart session, kill hung background terminals, prefer MCP-native paths) - Rule text in `docs/llm-workflow-runbooks.md` and the portable skill doc - Doc-contract tests so the guardrail text cannot silently regress
sysadmin removed the status:in-progress label 2026-07-07 01:18:52 -05:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#258