fix(backend): prevent graph execution stuck + steer SDK away from bash_exec - #12548
Conversation
…sult files The model was using bash_exec (cd + cat) to read SDK tool-result files under ~/.claude/projects/.../tool-results/, which fails in E2B because the sandbox runs as /home/user and cannot access /root/. The Read tool handles these correctly by reading from the host filesystem. Changes: - Add "CANNOT read SDK tool-result files" warning to bash_exec description - Add tool-results mention to the Read tool description - Fix system prompt: replace stale "read_file" reference with "Read", explicitly warn that bash_exec cannot access host-side tool-results
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughUpdated copilot prompting and tool descriptions to require using the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
majdyz
left a comment
There was a problem hiding this comment.
🤖 Self-review Summary
All three changes are consistent and reinforce each other — system prompt, Read tool description, and bash_exec description all point the model in the right direction.
No blockers or should-fix issues found.
🟡 Nice to Have (pre-existing, not in diff): Line 187 of prompting.py says "SDK file tools (Read/Write/Edit/Glob/Grep) and bash_exec share one filesystem" — slightly misleading now since Read can also access host-side tool-result files that bash_exec cannot. Could add a qualifier in a follow-up.
Address self-review: the "Shell & filesystem" section listed Read alongside bash_exec as sharing one filesystem, which is misleading now that Read also accesses host-side SDK tool-result files.
Read shares the sandbox filesystem for regular files; it just additionally reads host-side tool-results. Removing it from the list was misleading. The tool-results section below already covers the distinction.
Prevents KeyError when node executions from non-standard blocks (e.g., OrchestratorBlock) don't include 'name' in input_data. The from_db fallback assumes all INPUT/OUTPUT block executions have a 'name' field, but this isn't guaranteed for all block types.
…m prompt only Remove redundant tool-results mentions from Read and bash_exec tool descriptions — the system prompt storage supplement already covers this clearly. Avoids wasting tokens on triple-repeated instructions.
Revert the early-continue refactor and logger.debug — debug logs aren't read in production. Keep the simple inline guard style from the original PR #12548.
Summary
Two backend fixes for CoPilot stability:
Steer model away from bash_exec for SDK tool-result files — When the SDK returns tool results as file paths, the copilot model was attempting to use
bash_execto read them instead of treating the content directly. Added system prompt guidance to prevent this.Guard against missing 'name' in execution input_data —
GraphExecution.from_db()assumed all INPUT/OUTPUT block node executions have anamefield ininput_data. This crashes withKeyError: 'name'when non-standard blocks (e.g., OrchestratorBlock) produce node executions without this field. Added"name" in exec.input_dataguards.Why
update_graph_execution_statsendpoint, causing graph executions to appear stuck (retries 35+ times, never completes)How
"name" in exec.input_dataguard in both input extraction (line 340) and output extraction (line 365) inexecution.pyChanges
backend/copilot/sdk/service.py— system prompt guidancebackend/data/execution.py— KeyError guard for missingnamefieldChecklist 📋
Test plan: