Skip to content

fix(server): disable executable tools in Claude metadata generation - #247

Open
leoisadev1 wants to merge 2 commits into
mainfrom
fix/claude-metadata-generation
Open

fix(server): disable executable tools in Claude metadata generation#247
leoisadev1 wants to merge 2 commits into
mainfrom
fix/claude-metadata-generation

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

Claude background title and branch generation received the user's first prompt and started with permission bypass. A skill name in that prompt could therefore execute in the background. Verbose Claude CLI output also failed to parse, and titles that came back as JSON objects were saved with the wrapper intact.

Fix

Metadata generation now passes an empty tool set, disables slash commands, hooks, and inherited MCP, and uses dontAsk so it can run as root. Thread titles run in a temporary directory. Shared title cleanup unwraps a JSON object with a string title. Claude text generation accepts either a single result object or a verbose message array and reads structured_output from the last result.

Actual bot chats keep their tools. Subscription environment, MCP headers, and API-key connections are unchanged.

This is an Akeru adaptation of upstream T3 Code work.

Upstream

Verification

  • vp test run apps/server/src/textGeneration/ClaudeTextGeneration.test.ts apps/server/src/textGeneration/TextGenerationPrompts.test.ts — 41 passed
  • Targeted lint on the changed files — clean

The fake CLI fixture asserts empty tools, no permission bypass, disabled slash commands, strict MCP config, disableAllHooks, and dontAsk. Title generation is asserted not to run in the project cwd.

Model

Grok 4.6 High in Grok Build via Orca.

Claude title and branch generation used permission bypass, so a skill
name in the first prompt could run tools in the background. Verbose CLI
output also failed to parse, and JSON-wrapped titles were saved as-is.

Metadata runs now pass an empty tool set, disable slash commands, hooks,
and inherited MCP, and use dontAsk. Titles run in a temp directory.
Shared title cleanup unwraps a JSON title object, and Claude accepts
verbose result arrays.

Upstream: pingdotgg#4169 pingdotgg#10446 pingdotgg#10526

Grok 4.6 High in Grok Build via Orca.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
akeru-bot-landing Building Building Preview Sep 10, 2026 6:25pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

Summary

  • Hardened Claude-backed metadata generation by disabling inherited capabilities and running title generation outside the project directory.
  • Improved Claude response normalization for standard envelopes, verbose message arrays, JSON-formatted titles, and malformed output.
  • Added focused coverage for capability restrictions, temporary-directory isolation, response parsing, and error handling.

Confidence Score: 5/5

Safe to merge.

No outstanding findings require changes before merging.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/claude-meta..." | Re-trigger Greptile

@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent. Independent merge review found a reproducible executable-path regression on a97a52a.

runClaudeCommand changes title-generation cwd to a fresh temporary directory but passes claudeSettings.binaryPath through unchanged. On Linux, resolveSpawnCommand preserves explicit relative paths. A configured ./bin/claude that exists under the request cwd therefore fails to spawn with ENOENT for titles.

I added a throwaway focused test that creates an executable fixture under <request cwd>/bin/claude and calls the shipped generateThreadTitle entry point. It fails with TextGenerationError: Failed to spawn Claude CLI process in 14ms. The identical test passes when only the child's cwd is reverted to the request cwd in a control run. The production source was restored afterward. The existing 41 tests pass but do not cover this case.

Please resolve explicit relative executable paths against the original cwd before moving title generation into its isolated directory. Preserve ordinary PATH lookup, absolute paths, and the new capability restrictions. Add committed coverage and rerun the review-and-fix loop. The scoped request has been delivered to the existing worker; delivery is not a completed repair. Holding merge pending the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant