Skip to content

Declare routing strategy explicitly (#27) - #33

Merged
datacas merged 1 commit into
mainfrom
issue-27-declare-routing-strategy
Sep 23, 2026
Merged

datacas merged 1 commit into
mainfrom
issue-27-declare-routing-strategy

Conversation

@datacas

@datacas datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add code_cycle.routing.strategy, accepting fixed or measured and defaulting to fixed.
  • Reject malformed routing sections and unknown strategy values while loading configuration.
  • Record the active strategy with every run stage. Both strategies currently preserve the existing target selection, and fixed routing does not consult telemetry.
  • Add regression coverage and document the configuration contract.

Verification

  • rtk python3 -m unittest discover -s tests -v — 472 tests passed.
  • rtk python3 scripts/validate-package.py — passed.
  • rtk git diff --check — passed.

Closes #27

@datacas

datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Initial review — PR #33 · Declare routing strategy explicitly (#27)

Verdict: APPROVED — reviewed head 49f5b3f709caf41299af96a4ef7f8dfbdc2e96ec. No open finding blocks approval.

Summary and scope

I reviewed the full diff from merge-base 525fdfd to 49f5b3f. It touches 7 files: scripts/router.py, scripts/cycle.py, scripts/run_cycle.py, scripts/telemetry.py, tests/test_run_cycle.py, README.md and docs/instrumentation.md. I checked it against every acceptance criterion in #27:

Criterion Result
Unknown routing.strategy is refused by name at config load Met: load_config → load_routing_strategy, and the error names both the key and the value
A malformed code_cycle.routing is refused like profiles Met: added to the shape check in load_config
An absent key resolves to fixed Met
The run record includes the strategy Met for run_cycle.py: payload.routing_strategy on stage, dispatch, blocked and coordinate rows. See REV-001 for recorders built directly
Under fixed, populated telemetry doesn't change the targets Met: route() doesn't read telemetry, and a regression test covers this

The change stays within the issue's non-goals. Target selection is unchanged, measured has no behaviour yet, and nothing writes .code-cycle.yml.

Repository conventions came from CONTRIBUTING.md. There is no AGENTS.md or CLAUDE.md, and nothing required one.

Findings

[REV-001] · medium · open · blocks:no — A CycleRecorder built directly always records fixed, whatever the config says

scripts/cycle.py:127, skills/cc-orchestrator/SKILL.md:271

CycleRecorder.__init__ defaults routing_strategy to RoutingStrategy.FIXED. Only run_cycle.py reads the configured value and passes it in. cc-orchestrator tells agents to use run_cycle.py "or do exactly what it does", and its recorder snippet (CycleRecorder(telemetry, repo, task, signals, availability=...)) doesn't pass a strategy. A hand-driven orchestration of a repository that declares strategy: measured would therefore:

  • write payload.routing_strategy = "fixed" on every row. This is the "row that describes a policy nobody chose" that the README and Declare the routing strategy explicitly #27 warn against;
  • never validate code_cycle.routing, so an invalid value is not refused before the run.

Today measured routes exactly like fixed, so no target changes and the impact is limited to telemetry. Once measured gets behaviour, though, this path would record the wrong policy without warning. The snippet has the same pre-existing gap for profiles. Possible fixes:

  • have the recorder derive the strategy from the same config it receives, or require it explicitly with no default;
  • at minimum, add routing_strategy=load_routing_strategy(config) to the skill snippet.

[REV-002] · low · open · blocks:no — Unknown keys under code_cycle.routing are silently ignored

scripts/router.py:72

The strategy value is validated strictly, but the keys around it are not. A typo such as routing: {stratgy: measured} resolves to fixed without any error. I observed this at runtime (see below). An operator who meant to opt in gets the default and nothing tells them. Consider refusing keys other than strategy, as load_profiles does for the profile shapes, or at least naming the unknown key in an error.

[REV-003] · low · open · blocks:no — CHANGELOG.md not updated

CHANGELOG.md

The last three merged PRs (525fdfd, 8a802ae, 8f9bfaf) each added an [Unreleased] entry. This PR adds a user-facing configuration key (code_cycle.routing.strategy) and a new telemetry payload field (routing_strategy) but no changelog entry.

Security triage

This is not a sensitive change, so I skipped the security audit after triage. The diff adds an enum-validated key read from the operator's own local .code-cycle.yml and one closed-vocabulary telemetry token (fixed|measured, enforced by FIELD_SPECS). It doesn't touch authentication, authorization, secrets, external input, dependencies, CI workflows, the fail-closed permission rules or the workspace-policy filter. No PR labels are set.

Commands and observed results

Command / flow Result
python3 -m unittest discover -s tests 472 tests, OK
python3 -m unittest tests.test_run_cycle.RoutingStrategyTests -v 6/6 OK
python3 scripts/validate-package.py VALID: 12 skills (6 cycle, 6 supporting), shared sections in sync, cross-agent manifests aligned
load_routing_strategy({'code_cycle': {'routing': {'stratgy': 'measured'}}}) RoutingStrategy.FIXED, no error (REV-002, runtime evidence)
load_routing_strategy({... {'strategy': None}}) unknown code_cycle.routing.strategy value: None (expected 'fixed' or 'measured'), correctly refused
load_routing_strategy({... {'routing': {}}}) RoutingStrategy.FIXED
inspect.signature(CycleRecorder.__init__) routing_strategy defaults to FIXED (REV-001, runtime evidence)

Unverified items

  • REV-001: I didn't run the cc-orchestrator skill end to end. The finding comes from the skill text, backed by the observed recorder default.
  • I didn't run the installed-runtime check (tests/installed_stage_check.py) separately. It is covered by CI (Skills, manifests, and Bash installer).

CI

Check State
Validate package / Skills, manifests, and Bash installer ✅ success (×2, push + pull_request runs)
Validate package / PowerShell installer ✅ success (×2)

4 passed, 0 failed, 0 pending, 0 skipped. Every gate the repository defines ran. The PR is not a draft.

Residual risks

  • REV-001 matters as soon as measured gets behaviour. The fix is cheapest now, while both values are equivalent.
  • The "populated telemetry" test passes trivially, because route() has no telemetry dependency. It guards against a future regression, not current behaviour.

Verdict: APPROVED. All checks passed on the reviewed head. REV-001 to REV-003 are open but don't block approval.

@datacas
datacas merged commit 3360d6b into main Sep 23, 2026
4 checks passed
@datacas
datacas deleted the issue-27-declare-routing-strategy branch September 24, 2026 09:21
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.

Declare the routing strategy explicitly

1 participant