Skip to content

fix(core): propagate SHELL→TERMINAL_SHELL rename into direct-shell allowlists (follow-up to #12021) - #12052

Merged
lalalune merged 1 commit into
developfrom
fix/12021-terminal-shell-direct-allowlist
Jul 3, 2026
Merged

lalalune merged 1 commit into
developfrom
fix/12021-terminal-shell-direct-allowlist

Conversation

@lalalune

@lalalune lalalune commented Jul 3, 2026

Copy link
Copy Markdown
Member

The regression

PR #12021 renamed the terminal action SHELLTERMINAL_SHELL (packages/agent/src/actions/terminal.ts) but did not propagate the new name into two hardcoded shell-name allowlists in packages/core/src/services/message.ts:

  • WEAK_DIRECT_REPLY_OVERRIDE_ACTIONS
  • SHELL_DIRECT_ACTIONS

Both sets are built by mapping their raw entries through normalizeActionIdentifier (.toUpperCase().replace(/_/g, "")), so "TERMINAL_SHELL" normalizes to "TERMINALSHELL". Neither set listed it, so the renamed action was never a member.

Lean-chat repro

In a lean-chat deployment (ELIZA_PLUGIN_SET=lean-chat, no plugin-coding-tools), TERMINAL_SHELL is the only shell action. For a message like run df -h on this VPS:

  • inferDirectCurrentRequestCandidateActions still resolves TERMINAL_SHELL (via its RUN_IN_TERMINAL simile), so directCandidateActions = ["TERMINAL_SHELL"].
  • but shouldPreferDirectCurrentCandidateActions then does SHELL_DIRECT_ACTIONS.has("TERMINALSHELL")false (and the candidateActions.every(...) weak-override check also fails), so the turn is not promoted to the direct shell path and silently falls through to the general planner.

The fix

  • Add "TERMINAL_SHELL" to WEAK_DIRECT_REPLY_OVERRIDE_ACTIONS and SHELL_DIRECT_ACTIONS.
  • Also add it to the two findAvailableActionName shell-name lookup lists (in message.ts inferAckIntentCandidateActions and message/direct-action-heuristics.ts). These already resolved via simile; adding the canonical name is defensive and placed after "SHELL" so mixed deployments (coding-tools SHELL present) keep their existing priority.
  • Other candidates checked and left alone: prompt-compaction.ts already lists both SHELL and TERMINAL_SHELL; planner-loop.ts name === "SHELL" is the coding-tools trajectory summary (unrelated); the many "SHELL" env-var/$SHELL references are unrelated.

Test

Added a regression test in message-routing-live-regression.test.ts that drives the real seam with a lean-chat fixture (only TERMINAL_SHELL + REPLY): it asserts inference resolves ["TERMINAL_SHELL"] and shouldPreferDirectCurrentCandidateActions returns true. Verified it fails pre-fix (returned false) and passes after.

Verification

  • bun run --cwd packages/core typecheck → clean
  • message-routing-live-regression.test.ts → 41 passed; direct-action-heuristics.test.ts → 5 passed

…lowlists (follow-up to #12021)

PR #12021 renamed the terminal action SHELL → TERMINAL_SHELL but left the
hardcoded shell-name allowlists in message.ts still listing only the old
names. Both sets are normalized via normalizeActionIdentifier
(TERMINAL_SHELL → TERMINALSHELL), so the renamed action was never a member:

- WEAK_DIRECT_REPLY_OVERRIDE_ACTIONS
- SHELL_DIRECT_ACTIONS

Effect (lean-chat, ELIZA_PLUGIN_SET=lean-chat, no plugin-coding-tools, so
TERMINAL_SHELL is the only shell action): inference resolved the action via
its RUN_IN_TERMINAL simile, but shouldPreferDirectCurrentCandidateActions did
SHELL_DIRECT_ACTIONS.has("TERMINALSHELL") → false and the .every() weak-override
check also failed, so "run df -h on this VPS" no longer fast-pathed to the
shell action and fell through to the general planner.

Add "TERMINAL_SHELL" to both sets and to the two findAvailableActionName
lookup lists (defensive; they already matched via simile). Add a regression
test pinning the lean-chat path end-to-end (proven to fail pre-fix).

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

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33e99fbb-fbbe-4499-a511-a604f0700d51

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/12021-terminal-shell-direct-allowlist

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.

@lalalune
lalalune merged commit 1a5004c into develop Jul 3, 2026
38 of 61 checks passed
@lalalune
lalalune deleted the fix/12021-terminal-shell-direct-allowlist branch July 3, 2026 19:42
@claude

claude Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions github-actions Bot added the Tests label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants