Skip to content

Comments

Remove CLI subprocess backend, pass disallowed_tools to SDK#59

Merged
RichardAtCT merged 2 commits intomainfrom
finding3/remove-cli-subprocess-backend
Feb 20, 2026
Merged

Remove CLI subprocess backend, pass disallowed_tools to SDK#59
RichardAtCT merged 2 commits intomainfrom
finding3/remove-cli-subprocess-backend

Conversation

@RichardAtCT
Copy link
Owner

Summary

  • Delete the legacy CLI subprocess fallback (integration.py 594 lines, parser.py 338 lines, test_parser.py 127 lines)
  • Simplify facade: remove _execute_with_fallback_execute (SDK-only), remove process_manager param, remove _sdk_failed_count
  • Remove use_sdk config flag — SDK is now the only backend
  • Pass disallowed_tools natively to ClaudeAgentOptions (Finding 5)
  • Update all imports across src/ and tests/ from integrationsdk_integration
  • Update docs to remove CLI fallback references and USE_SDK config option

Addresses Finding 3 (Dual Backend) and Finding 5 (disallowed_tools) from docs/SDK_DUPLICATION_REVIEW.md.

Net reduction: ~1,350 lines across 22 files.

Test plan

  • All 375 tests pass (poetry run pytest tests/ -v)
  • black/isort formatting clean
  • No remaining imports from deleted integration.py or parser.py
  • No remaining use_sdk references in src/ or tests/
  • disallowed_tools confirmed in ClaudeAgentOptions construction
  • CI passes

🤖 Generated with Claude Code

Delete the legacy CLI subprocess fallback (integration.py, parser.py) and
simplify the facade to use SDK-only execution. Pass disallowed_tools
natively to ClaudeAgentOptions instead of relying solely on runtime checks.

- Delete src/claude/integration.py (594 lines) and parser.py (338 lines)
- Delete tests/unit/test_claude/test_parser.py (127 lines)
- Remove _execute_with_fallback, rename to _execute (SDK-only)
- Remove process_manager param from ClaudeIntegration.__init__
- Remove use_sdk config flag from Settings
- Remove _sdk_failed_count fallback tracker
- Add disallowed_tools to ClaudeAgentOptions in sdk_integration.py
- Update all imports to use sdk_integration instead of integration
- Simplify session.py: remove CLI/SDK ClaudeResponse union type
- Update __init__.py exports (remove ProcessManager, OutputParser)
- Simplify main.py: remove use_sdk branching
- Update docs: CLAUDE.md, configuration.md, setup.md, README.md
- Mark Finding 3 and Finding 5 as COMPLETE in SDK_DUPLICATION_REVIEW.md

Net reduction: ~1,350 lines removed across 22 files.
@FridayOpenClawBot
Copy link

PR Review
Reviewed head: 710f176261bfe409dd1fbf329973117297697a3f

Summary

  • Removes the legacy CLI subprocess backend (integration.py + parser.py) and makes the SDK path the only execution path.
  • Cleans config/docs/tests to remove USE_SDK and backend-switching behavior.
  • Wires disallowed_tools directly into ClaudeAgentOptions so policy is enforced by the SDK.

What looks good

  • Big simplification win: deleting fallback complexity should reduce drift and debugging surface area.
  • The import cleanup is thorough across runtime code and tests.
  • Passing disallowed_tools at SDK options level is the right direction for preventive enforcement.

Issues / questions

  1. [Important] src/claude/facade.py (shutdown) — await self.sdk_manager.kill_all_processes() is still called, but with subprocess backend removed this risks becoming a misleading no-op unless ClaudeSDKManager actually manages killable resources. If it’s intentionally a no-op, consider renaming/documenting to reflect SDK lifecycle cleanup semantics (to avoid future maintainers assuming process cancellation coverage that no longer exists).
  2. [Important] src/claude/sdk_integration.py (ClaudeAgentOptions) — now that disallowed_tools is passed through, it would be good to add/adjust at least one unit test asserting this exact field is propagated (not just behavior elsewhere). This is a security-policy regression guard worth pinning directly.
  3. [Nit] docs/SDK_DUPLICATION_REVIEW.md — the progress row still lists PR as TBD for F3/F5 while this PR appears to be that implementation. Worth updating so the tracking doc remains a reliable source of truth.

Suggested tests (if needed)

  • Add a focused unit test on SDK option construction asserting disallowed_tools == config.claude_disallowed_tools.
  • Add a shutdown-path test confirming ClaudeIntegration.shutdown() behaves correctly with SDK-only manager semantics (no stale assumptions about subprocesses).

Verdict

  • ⚠️ Merge after fixes

…ols test

- Remove misleading kill_all_processes() call from shutdown() and delete
  the no-op method from ClaudeSDKManager
- Add test_disallowed_tools_passed_to_options to guard security policy
  propagation to the SDK
- Update progress table PR reference in SDK_DUPLICATION_REVIEW.md
@RichardAtCT RichardAtCT merged commit c3cb1fc into main Feb 20, 2026
1 check passed
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