Skip to content

refactor: move the effort-levels route out of agents.py under the line cap - #32123

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/agents-line-cap
Nov 7, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/agents-line-cap

Conversation

@buluoray

@buluoray buluoray commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring src/kiro_crew/dashboard/handlers/agents.py back under the 2,000-line cap, so the line-cap ratchet stops failing every pull request into main.

agents.py is 2,002 lines on main since #31569 added two lines. scripts/check_file_line_cap.py fails on every PR, so Backend Ratchets & Boundaries and Frontend Ratchets & i18n are red on PRs that never touch the file.

Why it matters

Every PR into main shows two red required lanes it did not cause, and the 0.12.1 backport of #31569 (#32112) carries the same two lines to release/0.12.0. This split lets both pass the cap.

Not a goal

  • No behavior change to GET /api/effort-levels or any other route.
  • No wider split of agents.py; only enough to get back under the cap.
  • No change to .github/file-line-cap-baseline.txt.

What changed (motivation → approach → change)

agents.py is over the cap → AGENTS.md says to move whole definitions into a sibling module and keep the path callers import → GET /api/effort-levels (api_effort_levels) moves unchanged into handlers/agents_effort_levels.py. That is a plain module outside the owner composition, like agents_cc_model_rows and agents_harness_effort. agents.py binds the same object, so the route table, the handlers package and every import keep working. agents.py goes from 2,002 to 1,979 lines.

This route is the same on main and on release/0.12.0, so the commit cherry-picks cleanly there.

test/test_dashboard_agents_composition_contract.py records the move. _SIBLING_DEFS names the plain-module definition, so "the base file's 120 definitions, each in one place" and "31 served handlers" still hold. A new test checks that the facade and the handlers package bind the sibling's own object. The owner spec (learn-cron-dashboard.md) and docs/feature-map/README.md name the new module.

Backwards compatibility

Compatible: kiro_crew.dashboard.handlers.agents.api_effort_levels and kiro_crew.dashboard.handlers.api_effort_levels are still bound, to the same function, and the route still serves the same body.

Reader: src/kiro_crew/dashboard/routes/agents.py:register -- chat -- GET /api/effort-levels registers handlers.api_effort_levels, the same object; test_the_routes_and_the_package_reach_the_facade_objects
Reader: src/kiro_crew/dashboard/handlers/init.py:api_effort_levels -- chat -- the package re-export is the sibling's object; test_a_sibling_definition_is_the_facade_binding
Reader: test/test_acp_dynamic_config.py:api_effort_levels -- chat -- imports it from handlers.agents, still bound there; test_api_effort_levels_per_slot
Reader: src/kiro_crew/dashboard/handlers/agents.py:api_effort_levels -- release -- the move cherry-picks cleanly onto release/0.12.0 (git merge-tree, no conflict); the function is byte-identical on both branches

Tests

  • test_a_sibling_definition_is_the_facade_binding: the facade and the handlers package bind the sibling module's own api_effort_levels. A mutation that binds a copy in agents.py instead turns it red, and also test_every_base_definition_is_in_exactly_one_place.
  • Ran: test_dashboard_agents_composition_contract.py, test_agents_endpoints_owner_auth.py, test_agent_import_hoist.py, test_remote_crew_capabilities.py, test_acp_dynamic_config.py, test_chat_handlers_composition_contract.py, test_chat_persistence_composition_contract.py, test_facade_mirror_guards.py, test_config_api.py: 679 passed.
  • scripts/check_file_line_cap.py: 0 failures. isort, black, flake8, mypy, docs-lint, feature-map, comment-history, brand, harness-parity and flake-pattern ratchet pass.

Manual verification

N/A — a move with no behavior change; the contract tests pin the binding and the route walk.

Related Issues

Closes #32122

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

…e cap

agents.py reached 2,002 lines on main, over the 2,000-line cap, so the
line-cap ratchet fails every PR. GET /api/effort-levels moves whole into
handlers/agents_effort_levels.py, a plain module outside the owner
composition; agents.py binds the same object, so routes, the handlers
package and callers keep their import path. No behavior change.
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 7, 2026 05:26
@buluoray
buluoray requested a review from tim-finnigan November 7, 2026 05:26
@buluoray
buluoray enabled auto-merge (squash) November 7, 2026 05:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the route moves whole, and both old import paths still point to the same function. No test or caller patches agents.get_reasoning_effort_ordered or agents._history_key_for to change this route, so taking those names off the facade breaks no patch.

[DESIGN-REVIEWED] 5ed5d14

Description read

[DESCRIPTION-READ] a7f07943f2281b167b3b758b78d75689abda04e6a49a6014c8f903f02f7218dd

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: this split is required by the AGENTS.md 2,000-line cap. It moves one route unchanged, keeps its import paths, and adds no new behaviour or settings.

What this change ships

Inventory (4 items) — 4 justified

Intent: get the line-cap check passing again on every PR into main, by moving one route out of agents.py. This is a FIX.

  1. GET /api/effort-levels code now lives in handlers/agents_effort_levels.py, and agents.py drops to 1,979 lines. — justified
  2. agents.py keeps its get_reasoning_effort_ordered import with # noqa: F401, because the facade's public-name inventory still lists that name. — justified
  3. The composition contract test now counts the definition held in the sibling module, and a new test checks that the facade and the handlers package point at the same function object. — justified
  4. The owner spec and the feature map now name the new module. — justified

[FIRST-PRINCIPLES-REVIEWED] 5ed5d14

Description read

[DESCRIPTION-READ] 31418dfdf5917df856735c29f6a4b5899f97ac28c812cff2a2af4028a7e90c85

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5ed5d14

Verdict parsed from the review's SHA-scoped output markers for commit 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5ed5d14

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5ed5d14f449d5357b1a58b034f9f9eb1c373d36a false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026

@bolichen97 bolichen97 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.

Approving 5ed5d14. The change moves api_effort_levels out of agents.py into the new agents_effort_levels.py, so agents.py drops under the line cap. I read the diff: the function body and docstring are the same on both sides, the facade imports the moved name (# noqa: F401, as its neighbours do) so agents.api_effort_levels is the same object, and the composition contract test now lists the sibling module and checks that binding. The feature map and the system spec paragraph are updated to name the new module.

No regex and no new restriction. Of the two checks that showed red, PR Hygiene failed at 05:27 and passed in a later run at 05:29, and the GPT 6.1 review was cancelled as an older duplicate and passed in its later run; the other 104 pass.

@buluoray
buluoray merged commit a3fb5af into main Nov 7, 2026
106 of 108 checks passed
@buluoray
buluoray deleted the crew/slack/agents-line-cap branch November 7, 2026 06:45
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray added a commit that referenced this pull request Nov 7, 2026
…e cap (#32123)

agents.py reached 2,002 lines on main, over the 2,000-line cap, so the
line-cap ratchet fails every PR. GET /api/effort-levels moves whole into
handlers/agents_effort_levels.py, a plain module outside the owner
composition; agents.py binds the same object, so routes, the handlers
package and callers keep their import path. No behavior change.

(cherry picked from commit a3fb5af)
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.

main: agents.py is 2,002 lines, over the 2,000-line cap

2 participants