Skip to content

fix(self-heal): bounded-shell-probe emits bash one-liner, not prose (#581 Patch A)#585

Merged
kuro-agent merged 1 commit into
mainfrom
fix/581-patch-a-shell-oneliner
Jun 29, 2026
Merged

fix(self-heal): bounded-shell-probe emits bash one-liner, not prose (#581 Patch A)#585
kuro-agent merged 1 commit into
mainfrom
fix/581-patch-a-shell-oneliner

Conversation

@miles990

Copy link
Copy Markdown
Owner

Closes the Patch A scope of #581.

What

When middleware-failure-self-healing classifies a failed shell task as stall-or-timeout, the retry envelope's prompt was a multi-line markdown document (## headings + prose explanation). The shell lane execs prompt literally → Strategy:: command not found, Break: command not found, etc. — the storm documented in the issue (cmt-1779415517902-0014).

Now: for worker === 'shell', prompt = first commandSlice (a real bash one-liner). Framing stays in acceptance + notes. Non-shell workers still receive the prose prompt for LLM consumption.

Why both patches

  • Patch A (this PR) stops the current known caller from generating the prose envelope.
  • Patch B (miles990/agent-middleware#19) is the dispatch-boundary guard that makes any future caller fail loudly with shell_received_prose instead of silently storming command-not-found.

Pair shipped → freq counter on task-execution stage stops flapping for this class.

Test

Existing case routes offline and timeout failures into bounded recovery instead of blind retry extended with one assertion:

expect(followUps[0].payload?.retry_envelope?.prompt).toBe(
  'pnpm tsx scripts/kg-extract-chunks.ts --write',
);
✓ tests/middleware-failure-self-healing.test.ts (20 tests | 19 skipped) 48ms

Falsifier (5 cycles after merge)

grep -r 'Strategy:: command not found' agent-middleware/memory/state/ should stay at zero. If it reappears → a different caller is emitting prose to the shell lane; Patch B catches it as shell_received_prose.

— Filed by Kuro autonomous cycle.

…581)

Patch A from issue #581. The stall-or-timeout shell retry envelope was
sending the markdown framing (## headings + prose explanation) as the
prompt body — and shell lane execs the prompt literally, producing the
'Strategy:: command not found' storm documented in the issue.

Now: when worker==='shell', prompt = first commandSlice (real bash);
framing stays in acceptance + notes. Non-shell workers still get the
prose prompt for LLM consumption.

Pairs with Patch B (PR #19 on agent-middleware) which adds the
dispatch-boundary guard so any future caller fails loudly.

Test: extend existing 'routes offline and timeout failures' case to
assert prompt is the bash one-liner.

Co-Authored-By: Claude <noreply@anthropic.com>
kuro-agent added a commit that referenced this pull request Jun 29, 2026
…ate bypass (#581)

Complements PR #585 at a different layer:
- auto-executor.buildRetryEnvelopeDelegation: shell worker emits
  commandSlices.join(' && ') instead of prose "## Retry Task:" block
- delegation.ts: hoist RAW_PROMPT_TYPES to module scope; bypass the
  phantom-prompt gate for shell/graphify so a bare one-liner is not
  rejected as a thin prompt (the gap #585 does not cover)
- splitShellCommand keeps single-slice commands (>0, was >1)

Preserves real uncommitted work that was sitting dirty in worktree
forge-1. Tests green: auto-executor (5), middleware-self-healing (21),
delegation-phantom-prompt (6) = 32 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@kuro-agent kuro-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Internal multi-brain review consensus approved this PR.

Consensus: all required reviewers approved

File-truth source: memory/index/pr-review-claims.jsonl

@kuro-agent kuro-agent merged commit 9f6ce75 into main Jun 29, 2026
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