Skip to content

Decompose tools_execution.py (924 lines)#2143

Merged
Trecek merged 11 commits into
developfrom
decompose-tools-execution-py-924-lines/2060
May 7, 2026
Merged

Decompose tools_execution.py (924 lines)#2143
Trecek merged 11 commits into
developfrom
decompose-tools-execution-py-924-lines/2060

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 7, 2026

Summary

Split src/autoskillit/server/tools/tools_execution.py (924 lines, 5 MCP tool handlers + helpers) into three cohesive modules:

  1. tools_execution.py (~510 lines) — retains run_cmd, run_python, run_skill (the three execution primitives)
  2. tools_fleet_dispatch.py (~240 lines) — dispatch_food_truck, record_gate_dispatch, and _get_food_truck_prompt_builder
  3. tools_execution_helpers.py (~190 lines) — _coerce_scalar, _import_and_call, _RUN_PYTHON_SENTINEL_KEYS

No behavioral changes. All existing tests pass with import path updates. Do not leave re-export shims, backward-compatibility aliases, or comments referencing this decomposition in the source code — the codebase is not a notepad.

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260506-230442-623894/.autoskillit/temp/make-plan/decompose_tools_execution_plan_2026-05-06_230900.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan claude-opus-4-6 1 86 14.7k 1.6M 71.3k 113 66.9k 10m 41s
verify claude-sonnet-4-6 1 46 9.3k 1.1M 76.8k 129 63.7k 6m 14s
implement* MiniMax-M2.7-highspeed 1 2.1M 21.8k 1.8M 57.4k 133 108.6k 8m 47s
prepare_pr* MiniMax-M2.7-highspeed 1 64.5k 3.3k 172.2k 28.7k 20 41.1k 1m 21s
compose_pr* MiniMax-M2.7-highspeed 1 79.3k 1.8k 284.1k 28.7k 24 15.0k 52s
review_pr claude-sonnet-4-6 2 747 72.5k 1.9M 98.6k 118 174.1k 17m 43s
resolve_review claude-sonnet-4-6 2 822 42.1k 6.2M 90.3k 242 145.0k 28m 15s
ci_conflict_fix claude-sonnet-4-6 1 147 5.4k 759.7k 66.8k 41 133.8k 2m 0s
Total 2.3M 170.7k 13.9M 98.6k 748.1k 1h 15m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
plan 0
verify 0
implement 964 1868.5 112.7 22.6
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 47 131870.1 3085.1 895.3
ci_conflict_fix 5698 133.3 23.5 0.9
Total 6709 2068.6 111.5 25.4

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
claude-opus-4-6 1 86 14.7k 1.6M 66.9k 10m 41s
claude-sonnet-4-6 1 46 9.3k 1.1M 63.7k 6m 14s
MiniMax-M2.7-highspeed 3 2.3M 26.8k 2.3M 164.7k 11m 1s

Copy link
Copy Markdown
Collaborator Author

@Trecek Trecek left a comment

Choose a reason for hiding this comment

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

AutoSkillit PR Review — Verdict: changes_requested

Comment thread src/autoskillit/server/tools/_execution_helpers.py
Comment thread src/autoskillit/server/tools/tools_fleet_dispatch.py Outdated
Comment thread tests/arch/test_tools_execution_decomposition.py
Comment thread src/autoskillit/server/tools/tools_execution_helpers.py Outdated
Comment thread src/autoskillit/server/tools/_execution_helpers.py
Comment thread src/autoskillit/server/tools/tools_fleet_dispatch.py
Comment thread src/autoskillit/server/tools/tools_fleet_dispatch.py Outdated
Copy link
Copy Markdown
Collaborator Author

@Trecek Trecek left a comment

Choose a reason for hiding this comment

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

AutoSkillit review: 2 blocking findings require changes before merge. See inline comments for details.

@Trecek Trecek closed this May 7, 2026
@Trecek Trecek reopened this May 7, 2026
Trecek and others added 11 commits May 7, 2026 06:51
Split src/autoskillit/server/tools/tools_execution.py (924 lines, 5 MCP tool handlers)
into three modules:

- tools_execution.py (~515 lines): retains run_cmd, run_python, run_skill
- tools_fleet_dispatch.py (~247 lines): dispatch_food_truck, record_gate_dispatch
- tools_execution_helpers.py (~191 lines): _import_and_call, _coerce_scalar

No behavioral changes. All tests pass with updated import paths.
Added structural guard test for decomposition boundaries.
Updated arch test caps (server/tools: 16→18) and layer enforcement scans.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…sult, ValueError fallback for FleetErrorCode
…py; add negative hasattr guards; update module count to 15
…port_and_call is not in tools_execution namespace
@Trecek Trecek force-pushed the decompose-tools-execution-py-924-lines/2060 branch from 1e08d49 to 58ea1fa Compare May 7, 2026 13:52
@Trecek Trecek added this pull request to the merge queue May 7, 2026
Merged via the queue into develop with commit 9e1c295 May 7, 2026
2 checks passed
@Trecek Trecek deleted the decompose-tools-execution-py-924-lines/2060 branch May 7, 2026 14:06
Trecek added a commit that referenced this pull request May 8, 2026
## Summary

Split `src/autoskillit/server/tools/tools_execution.py` (924 lines, 5
MCP tool handlers + helpers) into three cohesive modules:

1. **`tools_execution.py`** (~510 lines) — retains `run_cmd`,
`run_python`, `run_skill` (the three execution primitives)
2. **`tools_fleet_dispatch.py`** (~240 lines) — `dispatch_food_truck`,
`record_gate_dispatch`, and `_get_food_truck_prompt_builder`
3. **`tools_execution_helpers.py`** (~190 lines) — `_coerce_scalar`,
`_import_and_call`, `_RUN_PYTHON_SENTINEL_KEYS`

No behavioral changes. All existing tests pass with import path updates.
Do not leave re-export shims, backward-compatibility aliases, or
comments referencing this decomposition in the source code — the
codebase is not a notepad.

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260506-230442-623894/.autoskillit/temp/make-plan/decompose_tools_execution_plan_2026-05-06_230900.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->

## Token Usage Summary

| Step | Model | count | uncached | output | cache_read | peak_ctx |
turns | cache_write | time |

|------|-------|-------|----------|--------|------------|----------|-------|-------------|------|
| plan | claude-opus-4-6 | 1 | 86 | 14.7k | 1.6M | 71.3k | 113 | 66.9k |
10m 41s |
| verify | claude-sonnet-4-6 | 1 | 46 | 9.3k | 1.1M | 76.8k | 129 |
63.7k | 6m 14s |
| implement* | MiniMax-M2.7-highspeed | 1 | 2.1M | 21.8k | 1.8M | 57.4k
| 133 | 108.6k | 8m 47s |
| prepare_pr* | MiniMax-M2.7-highspeed | 1 | 64.5k | 3.3k | 172.2k |
28.7k | 20 | 41.1k | 1m 21s |
| compose_pr* | MiniMax-M2.7-highspeed | 1 | 79.3k | 1.8k | 284.1k |
28.7k | 24 | 15.0k | 52s |
| **Total** | | | 2.3M | 50.7k | 5.0M | 76.8k | | 295.2k | 27m 58s |

\* *Step used a non-Anthropic provider; caching behavior may differ.*

## Token Efficiency

| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| plan | 0 | — | — | — |
| verify | 0 | — | — | — |
| implement | 964 | 1868.5 | 112.7 | 22.6 |
| prepare_pr | 0 | — | — | — |
| compose_pr | 0 | — | — | — |
| **Total** | **964** | 5157.3 | 306.3 | 52.6 |

## Model Usage Breakdown

| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| claude-opus-4-6 | 1 | 86 | 14.7k | 1.6M | 66.9k | 10m 41s |
| claude-sonnet-4-6 | 1 | 46 | 9.3k | 1.1M | 63.7k | 6m 14s |
| MiniMax-M2.7-highspeed | 3 | 2.3M | 26.8k | 2.3M | 164.7k | 11m 1s |

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant