Skip to content

refactor(runtime): escalate surviving findings at max effort - #220

Merged
datacas merged 3 commits into
mainfrom
issue-175-resolve-high-effort
Oct 11, 2026
Merged

datacas merged 3 commits into
mainfrom
issue-175-resolve-high-effort

Conversation

@datacas

@datacas datacas commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

Resolve now runs at high effort by default. An explicit code_cycle.resolve.effort remains authoritative. When a finding survives its first resolution attempt and is still open after review, the next resolve attempt targets the same executor at max effort. Existing fallback effort settings are preserved. Known Codex model capability is checked before dispatch where available, while unsupported effort responses are classified conservatively and routed through the configured fallback behavior.

Telemetry schema 17 records escalation IDs and whether the executor accepted, rejected, or could not be checked for the escalated effort. Configuration, routing, telemetry, and orchestrator documentation are updated.

Diagnosis

Work units

Unit Scope Commit
WU-1 Resolve effort policy, escalation, capability/rejection handling, telemetry, docs, and tests 6c9ecddc80d5710c278e5ba48d5cbb4321bc6d89

Rollback is independent: revert WU-1.

Verification

  • rtk python3 scripts/validate-package.py — passed.
  • rtk python3 -m unittest discover -s tests — passed, 1,210 tests.
  • rtk python3 scripts/run_cycle.py --help — passed.
  • rtk python3 -m py_compile scripts/run_cycle.py scripts/cycle.py scripts/executors.py scripts/telemetry.py — passed.
  • rtk git diff --check — passed.

The installed-runtime suite exercises fake CLI subprocess boundaries. claude plugin validate . could not complete because the sandbox denied network access to api.anthropic.com. No actual recorded CLI effort-rejection fixtures were available; rejection classification is covered by unit tests using representative messages and structured errors.

Implementation run: profile cheap_coder, requested model openai/gpt-6-luna, resolved model ?, effort high.

Closes #175

@datacas

datacas commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261010-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:1

Initial review — PR #220 (work item #175)

Verdict: CHANGES_REQUESTED — head 6c9ecddc80d5710c278e5ba48d5cbb4321bc6d89, fully reviewed (accumulated diff, 859 lines, SHA-256 6b1d4c3b…dd04dd0fce, merge base 102ab541e8f02ac124fb1dc7c1760b6197cbeb3c, 15 files).

Resolve now pins its primary effort to code_cycle.resolve.effort (default high), and after a first claimed-fix survival the next resolve runs at max on the previous target. It adds a Codex catalog pre-check, unsupported_effort classification with fallback reroute, and telemetry schema 17. The design matches the stated scope. One safety gap blocks approval; three smaller findings do not.

[REV-001] · medium · open · - · blocks:yes — unsupported_effort reroute skips the start-state and reconcile guard

scripts/cycle.py:701. For a resolve failure with failure_code == "unsupported_effort", retry = True and the fallback is dispatched without checking result.start_state, process_exited, or reconcile(before, snapshot()). The capacity/transport/timeout/quota branch right below does all three before rerouting a writing or publishing stage (the #205 invariant). A genuine CLI effort rejection happens before the model starts, but the classifier (REV-002) also accepts free-text messages, so a stage that already started and changed the workspace can be rerouted blindly onto a dirty tree.

Observed: I ran ScriptedAdapter with error_code="unsupported_effort", start_state="started", process_exited=True through CycleRecorder.stage("resolve", …). The Claude fallback was dispatched (1 dispatch) although the first attempt reported started. Fix: reroute only when start_state == "not_started" and the process exited, or run reconcile as the other branch does; otherwise stop. Add a test for the started case.

[REV-002] · medium · open · - · blocks:no — Effort classifier runs before the auth/quota/transport markers and matches loosely

scripts/executors.py:306-310. The effort … (unsupported|not supported|invalid) patterns are checked before the existing marker table, and .{0,50} spans unrelated words. Observed with _error_class(None, msg), all returning unsupported_effort:

  • effort level high -- 401 unauthorized: invalid api key
  • unauthorized: effort max not supported on this plan
  • network error: connection reset while resolving reasoning effort, not supported region
  • Error: invalid value for --model (effort high)

Auth, transport and bad-model errors that mention the effort setting are therefore hidden behind a reroute-to-fallback. The PR describes classification as conservative; the tests cover only the happy cases plus one unrelated negative. Fix: evaluate the existing markers first, or require the effort keyword to be adjacent to the rejection phrase, and add negative cases for auth, transport and model errors.

[REV-003] · low · open · - · blocks:no — An explicit resolve.effort silently disables the max escalation, undocumented

scripts/run_cycle.py:2073 only escalates when resolve_effort is None. docs/configuration.md (resolve.effort … unset uses high), docs/routing.md and both orchestrator SKILL.md files state the escalation unconditionally. A repository that writes the documented default (effort: high) therefore loses escalation, while leaving it unset keeps it. Either document this or escalate regardless of the pinned primary effort.

[REV-004] · low · open · - · blocks:no — escalation_acceptance is overwritten with unknown when the fallback dispatch fails

scripts/cycle.py:690-700. After the catalog check sets unsupported, or a CLI rejection sets rejected, a failed fallback dispatch (for example capacity) satisfies the elif and resets the value to unknown, losing a definite signal. Found by reading, not executed. Fix: apply the unknown reset only to the escalated (max) dispatch.

Security triage

Deterministic rule (security_review.always_when absent from .code-cycle.yml, so built-in defaults): no changed path, file or label matched. My own reading found no change to authentication, authorization, user input handling, secrets or dependencies. Not a sensitive change: the security audit was skipped after triage.

Executed verification

  • python3 -I -m unittest discover -s tests: exit 0, 1210 tests OK (matches the PR description).
  • Probes in /tmp outside the repo: _error_class strings above (REV-002) and the started-state reroute (REV-001), both reproduced.
  • Not run: claude plugin validate . (the PR notes network denial). No recorded real-CLI rejection fixture exists, so the actual wording of an effort rejection is unverified.
  • Unverified: REV-004 (code reading only).

CI

gh pr checks 220: Validate package — "Skills, manifests, and Bash installer" pass (×2 runs), "PowerShell installer" pass (×2 runs). Nothing pending, failed or skipped.

Residual risks

Resumed runs have no survival history (#179, declared out of scope). Escalation depends on the Codex local model cache being present; a missing cache dispatches at max and relies on the classifier in REV-002.

Blocking findings: REV-001.

Resolves REV-001..REV-004 of PR #220: reroute unsupported_effort only through
the start-state/reconcile guard, classify auth/transport/quota markers before
effort rejections with adjacent matching, escalate to max regardless of the
pinned resolve effort, and keep definite escalation_acceptance on fallback failure.
@datacas

datacas commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

[CCT-20261011-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:02a68b6f927cfec5c1c55f739f1a7373c36498ed · schema:1

Triage against the current CR head. Frozen dispositions for the four findings in the trusted initial review are valid; the findings are judged as reported against the reviewed implementation, and the dispositions will not change after fixes.

[REV-001] · medium · open · valid · blocks:yes — unsupported-effort reroute must use the start-state/reconcile guard

scripts/cycle.py. The current head adds the common reroute gate and a regression case for a stage that already started. Verification remains pending.

[REV-002] · medium · open · valid · blocks:no — effort classification must not mask auth or transport errors

scripts/executors.py. The current head checks existing failure markers first, narrows effort-rejection matching, and adds negative cases. Verification remains pending.

[REV-003] · low · open · valid · blocks:no — explicit resolve effort and escalation policy must agree

Work item #175 explicitly says that code_cycle.resolve.effort pins the effort and disables automatic escalation. The current head escalates to max even when that key is explicit. I will restore the work-item behavior and document the exception.

[REV-004] · low · open · valid · blocks:no — preserve definite escalation acceptance on fallback failure

scripts/cycle.py. The current head preserves unsupported when the fallback fails. Verification remains pending.

@datacas

datacas commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner Author

[CCR-20261010-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:1

[CCT-20261011-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:02a68b6f927cfec5c1c55f739f1a7373c36498ed · schema:1

Resolve summary — CR #220 (work item #175)

Status: RESOLVED. All four findings from the trusted initial review were valid and are addressed on head 99af48740a15c69476707b10ca57e3949818e30c. REV-001, REV-002, and REV-004 were fixed in 02a68b6f927cfec5c1c55f739f1a7373c36498ed; REV-003 was fixed in 99af48740a15c69476707b10ca57e3949818e30c.

[REV-001] · medium · resolved · valid · blocks:yes — unsupported_effort reroute skips the start-state and reconcile guard

scripts/cycle.py. Unsupported-effort fallback now uses the common start-state/reconciliation gate. The started-stage regression test passed.

[REV-002] · medium · resolved · valid · blocks:no — Effort classifier runs before the auth/quota/transport markers and matches loosely

scripts/executors.py. Existing auth, transport, capacity, and quota markers take precedence; effort rejection matching is adjacent and has negative coverage. The classifier tests passed.

[REV-003] · low · resolved · valid · blocks:no — An explicit resolve.effort silently disables the max escalation, undocumented

scripts/run_cycle.py, docs/configuration.md, docs/routing.md, and both orchestrator skills. An explicit code_cycle.resolve.effort now pins every primary resolve round and disables automatic escalation, as work item #175 requires. Unset effort still defaults to high and permits escalation. Regression coverage checks both behaviors.

[REV-004] · low · resolved · valid · blocks:no — escalation_acceptance is overwritten with unknown when the fallback dispatch fails

scripts/cycle.py. A failed fallback preserves the definite unsupported signal; the fallback-failure regression test passed.

Verification

All command results below are agent-reported. Local checks ran on Linux with Python 3.10.12. They share the project tests and package validation with CI; Windows Python and PowerShell behavior is covered by the GitHub checks.

  • rtk python3 scripts/validate-package.py — exit 0; package valid.
  • rtk git diff --check — exit 0.
  • rtk git diff --check HEAD^ HEAD — exit 0.
  • rtk python3 -m unittest discover -s tests -p test_cycle.py -q — exit 0; 62 tests passed.
  • rtk python3 -m unittest discover -s tests -p test_dispatch_failures.py -q — exit 0; 27 tests passed.
  • rtk python3 -m unittest discover -s tests -p test_run_cycle.py -q — exit 0; 174 tests passed, including valid and malformed resolve-effort configuration.
  • rtk python3 -m unittest discover -s tests -q — exit 0; 1,213 tests passed.
  • rtk python3 -m unittest discover -s tests -p test_executors.py -k test_codex_json_child_events_cross_process_boundary_and_keep_exit_code -q — exit 0; 1 subprocess-boundary test passed, including a nonzero child exit.
  • rtk python3 scripts/run_cycle.py --help — exit 0.
  • rtk python3 -c 'import sys; from pathlib import Path; sys.path.insert(0, "scripts"); import run_cycle; print(run_cycle.load_config(Path(".code-cycle.yml"))["code_cycle"].get("resolve"))' — exit 0; the repository config loads with resolve unset.

Post-change review and security triage

The delegated cc-code-review pass found no issues. The deterministic security rule did not match the changed paths, filenames, or CR labels. My sensitivity triage triggered a security audit because the change touches runtime configuration and executor error handling; it found no confirmed vulnerability. Residual operational risk: if the local Codex model catalog lacks a model entry, max-effort support remains unknown and dispatch relies on the CLI rejection/fallback path.

Checks of pushed head

GitHub head SHA: 99af48740a15c69476707b10ca57e3949818e30c.

  • Skills, manifests, and Bash installer — pass (2 runs).
  • PowerShell installer — pass (2 runs).
  • Failed, cancelled, skipped, or missing expected checks: none.

Fix commit: 99af48740a15c69476707b10ca57e3949818e30c. The working branch was pushed to the existing CR; no merge was performed.

@datacas

datacas commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261010-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:1

[CCT-20261011-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:02a68b6f927cfec5c1c55f739f1a7373c36498ed · schema:1

[CCR-20261011-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:1

Rereview — PR #220 (work item #175)

Verdict: APPROVED — head 99af48740a15c69476707b10ca57e3949818e30c fully rereviewed (accumulated diff, 998 lines, SHA-256 6e6a6144…0da0dc, merge base 102ab541e8f02ac124fb1dc7c1760b6197cbeb3c, previous reviewed head 6c9ecddc80d5710c278e5ba48d5cbb4321bc6d89). All four previous findings are corrected and verified by execution; no new finding.

Changed since the previous review

  • 02a68b6: the unsupported_effort reroute now shares one start-state/reconcile gate (reroute_gate) with the capacity/transport/timeout/quota branch; the classifier checks the existing markers first and requires the effort keyword next to the rejection phrase; a failed fallback no longer resets escalation_acceptance.
  • 99af487: an explicit code_cycle.resolve.effort pins every primary resolve round and disables automatic escalation; docs and both orchestrator skills updated.

Previous findings

[REV-001] · medium · resolved · valid · blocks:yes — unsupported_effort reroute skips the start-state and reconcile guard

scripts/cycle.py. Reproduced the original scenario with a scripted adapter: unsupported_effort, start_state="started", process_exited=True now dispatches once on the primary, never on the fallback, and the result detail says reroute stopped. With start_state="not_started" the fallback is dispatched once and succeeds.

[REV-002] · medium · resolved · valid · blocks:no — Effort classifier runs before the auth/quota/transport markers and matches loosely

scripts/executors.py. The four original strings now classify as auth, auth, transport, executor_error; Selected model is at capacity; effort max is not supported is capacity; Error: effort 'max' is invalid and Unsupported reasoning effort: max are unsupported_effort. Negative cases are in tests/test_dispatch_failures.py.

[REV-003] · low · resolved · valid · blocks:no — An explicit resolve.effort silently disables the max escalation, undocumented

scripts/run_cycle.py, docs/configuration.md, docs/routing.md, both orchestrator skills. Behaviour and documentation now agree: explicit effort disables escalation, unset escalates. test_an_explicit_resolve_effort_disables_automatic_escalation and test_first_survival_escalates_at_max_on_the_previous_resolve_target pass (high,high versus high,max). Note for the record: the disposition valid is kept as published; the original finding read the work item's pinning rule as a gap, and the resolver restored that rule rather than the escalation. The outcome is consistent with work item #175.

[REV-004] · low · resolved · valid · blocks:no — escalation_acceptance is overwritten with unknown when the fallback dispatch fails

scripts/cycle.py. Executed: Codex catalog says max unsupported, fallback fails with capacity; the stored escalation_acceptance stays unsupported (also rejected after a CLI rejection followed by a fallback failure). Previously this was code reading only.

New findings

None.

Security triage

Deterministic rule (security_review.always_when absent, built-in defaults): no changed path, filename or label matched. My own reading: the change adds an enum-validated config key, bounded regexes over executor error text (no nested quantifiers), and a telemetry field validated as REV-[0-9]{3,} with a length cap; no change to authentication, authorization, secrets, dependencies or untrusted-input handling. Not a sensitive change: the security audit was skipped after triage.

Executed verification

  • python3 -I -m unittest discover -s tests: exit 0, 1213 tests OK.
  • python3 scripts/validate-package.py: exit 0, 15 skills valid.
  • git diff --check 102ab54 HEAD: exit 0.
  • Probes in /tmp outside the repo: classifier strings above and four CycleRecorder.stage("resolve", …) scenarios (not_started reroute, started stop, fallback also rejecting, fallback capacity failure).
  • Not run: claude plugin validate . (network denial noted in the PR). No recorded real-CLI effort-rejection fixture exists.

CI

gh pr checks 220: Validate package — "Skills, manifests, and Bash installer" pass (×2), "PowerShell installer" pass (×2). Nothing pending, failed or skipped; the checks ran on 99af487.

Residual risk (non-blocking)

  • The narrowed classifier is deliberately conservative. Wordings such as model … does not support reasoning effort max or Unsupported value: 'max' … for reasoning effort classify as executor_error, so a real CLI rejection with that wording stops instead of falling back (the cycle ends UNRESOLVED, not misrouted). Worth revisiting once a real rejection fixture exists.
  • When a fallback itself returns unsupported_effort, its row also records escalation_acceptance=rejected; the field then describes the escalation chain rather than only the escalated dispatch. Telemetry-only.
  • Resumed runs have no survival history (refactor(F0): keep claimed-fix history across resumed runs #179, out of scope); a missing Codex model cache dispatches at max and relies on the CLI rejection path.

Blocking findings: none.

@datacas
datacas merged commit e911f1f into main Oct 11, 2026
4 checks passed
@datacas
datacas deleted the issue-175-resolve-high-effort branch October 11, 2026 14:46
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.

refactor(F0): run resolve at high effort by default and escalate to max after a finding's first survival

1 participant