Skip to content

feat(telemetry): record implementation forecast (#87) - #106

Merged
datacas merged 1 commit into
mainfrom
issue-87-implementation-forecast
Sep 28, 2026
Merged

datacas merged 1 commit into
mainfrom
issue-87-implementation-forecast

Conversation

@datacas

@datacas datacas commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Closes #87

Summary

Add a pre-edit, post-routing implementation forecast using the existing change-signal vocabulary. Record its bounded values only on the implement verdict and report forecast accuracy against the first review dispatch in the same cycle.

Diagnosis

Issue #87 is a feature request, so defect reproduction does not apply. The current driver records observed change signals only after implementation; the implement result had no forecast parser, telemetry fields, or accuracy report. This confirms the issue's description.

The invariant is temporal: a forecast is made after implement routing and remains outcome metadata. It must never enter PRE_ROUTING_SIGNALS or affect the routing that produced it.

The basic related-item search confirmed that #81's finding-count support is in merged PR #100 and #82's diagnosis step is in merged PR #101. Those provide the dependency and forecast timing; no matching active work item was found.

The fix adds nine typed, bounded forecast fields to implement verdict rows and compares them with the first review dispatch. cc-stats reports per-flag agreement and file/line error bands, with each measure unknown below ten observations. Forecasts do not affect routing.

Work units

ID Behaviour Files Tests Verification Rollback
WU-1 Capture bounded implementation forecasts and report sample-gated accuracy scripts/run_cycle.py, scripts/telemetry.py, scripts/stats.py, skills/cc-implement-issue/SKILL.md, docs/telemetry.md, docs/instrumentation.md tests/test_run_cycle.py, tests/test_telemetry.py, tests/test_stats.py, tests/test_cycle_outcomes.py 813 unit tests passed; package validation passed; run-cycle and stats CLI boundary flows passed with temporary fixtures independent

Verification

  • python3 -m unittest discover -s tests — 813 tests passed.
  • python3 scripts/validate-package.py — valid, 14 skills; manifests and shared sections aligned.
  • git diff --check — passed.
  • scripts/run_cycle.py CLI boundary — implemented forecast passed through a fake Codex executable and was recorded on the implement verdict; cycle completed with READY_FOR_MANUAL_MERGE (exit 0). The worktree, origin, credentials, and telemetry database were temporary; no external provider was contacted.
  • scripts/stats.py CLI boundary — JSON and Markdown output showed 10 paired cycles and the expected forecast agreement/error bands using temporary telemetry.

The local unit suite ran on this Linux/Python environment. The boundary fixtures used a fake executor and local bare remote; they did not exercise a live model or external provider.

Checks of pushed head

Head SHA: c8bf60ac4d7d5e2f233fb0c0aba2dcb97de67a8b

  • Skills, manifests, and Bash installer — pass (2 check runs)
  • PowerShell installer — pass (2 check runs)

All 4 check runs completed successfully; failed: 0, pending: 0.

@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · anthropic/claude-opus-5-5→? · high · schema:1

Initial review — PR #106 feat(telemetry): record implementation forecast (#87)

Verdict: APPROVED. Three low-severity findings, none of which blocks approval.

Summary and scope

  • Reviewed head: c8bf60ac4d7d5e2f233fb0c0aba2dcb97de67a8b, compared against merge-base 8bfcbe1 on main. It is one commit, 10 files, +366/−3. The whole accumulated diff was reviewed, including the tests.
  • Linked work item: [experimental] Record an implementation forecast (pre-edit, post-routing) and measure it against the observed change #87. Everything the issue asks for is present:
    • an additive forecast object in the cc-implement-issue result;
    • nine typed, bounded forecast_* fields added to OUTCOME_FIELDS["verdict"] only, never to PRE_ROUTING_SIGNALS;
    • SCHEMA_VERSION bumped to 10;
    • a cc-stats accuracy section that pairs each forecast with the first review dispatch in the same cycle_id and reports unknown below MINIMUM_SAMPLE.
  • The design constraints hold:
    • Separate forecast_ prefix.
    • Closed types, with bounds taken from FIELD_LIMITS.
    • Unknown values are left out, never zeroed.
    • A malformed forecast is refused as a whole and the cycle continues. _checks handles invalid input the same way.
    • Routing is not affected. jev_shadow.PAYLOAD_FIELDS is built only from PRE_ROUTING_SIGNALS, and the router takes no verdict outcomes.
  • Repository conventions applied: AGENTS.md, CONTRIBUTING.md and .code-cycle.yml. .code-cycle.yml sets trusted_authors: [datacas]. The PR had no earlier comments or reviews, so the finding record starts empty and numbering starts at REV-001.

Findings

[REV-001] · low · open · - · blocks:no — CHANGELOG has no Unreleased entry for schema 10 and the forecast

CHANGELOG.md:6

Recent feature PRs (#81, #82, #83, #84, #85, #86) each added an entry under ## [Unreleased], and #86 describes its telemetry schema bump there. This PR bumps SCHEMA_VERSION to 10, adds nine telemetry fields, and changes the cc-implement-issue result contract, but CHANGELOG.md is untouched. When the next release is cut, this change will be missing from the notes. Suggested fix: add an ### Added bullet stating that schema 10 records the implementation forecast on implement verdicts and that cc-stats reports forecast accuracy.

[REV-002] · low · open · - · blocks:no — SCHEMA_VERSION history comment stops at version 9

scripts/telemetry.py:45

Every earlier bump added a #: N: line to the version history above SCHEMA_VERSION, and that history goes up to 9:. The constant is now 10, but there is no 10: line. Anyone reading a row with schema_version = 10 cannot tell from the code what it adds. Suggested fix: add a line such as #: 10: implement verdicts may carry the forecast_* claim, a post-routing outcome, never a routing signal.

[REV-003] · low · open · - · blocks:no — Nothing stops the forecast from being revised after the edits

skills/cc-implement-issue/SKILL.md:222

The skill asks for the forecast "before the first edit", but it is emitted only in the final structured result. By then the implementer has its own diff in front of it. The text never says the forecast must stay as it was made before editing. An agent that "corrects" it from the diff would push accuracy towards 100%. That would undermine the reason #87 collects this data: deciding whether a pre-implementation estimate could be trusted for routing. The telemetry could not detect it afterwards. Suggested fix: say explicitly that the forecast is the pre-edit estimate as it stood, and must not be revised to match the implementation. The PR body could also optionally show the forecast next to the diagnosis, so it becomes visible before the diff exists.

Security triage

  • Rule half: .code-cycle.yml has no security_review.always_when, so the default triggers applied. The PR has no labels. No path touches auth, dependencies, CI workflows, migrations or public APIs. The rule did not fire.
  • Reviewer half: the audit was activated by the reviewer's own reading, because the change widens the telemetry (observability) store with values taken from untrusted agent output.
  • Result: no vulnerability or potential risk found.
    • Every new field goes through the single _checked gate as count or flag. Booleans are rejected as counts, containers are rejected, and counts are bounded to [0, 1_000_000].
    • No free text is stored.
    • A forecast with one invalid field is dropped entirely instead of being stored in part.
    • cc-stats outputs only aggregates.
    • The forecast cannot reach routing or Jev inputs.

Commands and observed results

Command Result
python3 -m unittest discover -s tests 813 tests, OK
python3 scripts/validate-package.py VALID: 14 skills, shared sections in sync, manifests aligned
git diff --check 8bfcbe1 c8bf60a clean
Scratch probe: real run_cycle driver with a forecast on the implement result, no change_bases the forecast is recorded on the implement verdict only; the review dispatch has no change signals, so _forecast_accuracy reports paired_cycles: 0, which is correct: unknown, not zero
Scratch probe: same driver with change_bases=("main",) and a mocked collect_change_signals (migrations diff) the review dispatch row carries the observed ChangeSignals under the same names; _forecast_accuracy(rows, 1) pairs the cycle: has_tests 1/1 agree, touches_database 1/1 agree, a 1-file forecast against 4 observed files falls in over_50_percent

The probes were runtime-observed through the real driver and recorder, with scripted executors. They confirm the pairing key and the field-name alignment, which the PR's test_stats fixtures only assume, since they write hand-built dispatch rows.

Not verified

  • No live model or provider run. Forecast quality from a real implementer cannot be observed until real cycles accumulate.
  • The accuracy report was exercised with scripted rows and the probes above, not with a production telemetry database.

CI

gh pr checks 106 exited 0. All checks are on the reviewed head:

Check State
Skills, manifests, and Bash installer (2 runs) pass
PowerShell installer (2 runs) pass

None is pending, failed, cancelled or skipped. No check that recent PRs normally run is missing. The PR is not a draft.

Residual risks

  • Accuracy measures stay unknown until at least ten paired cycles exist, by design.
  • If an implement stage is retried inside one cycle, the first forecast recorded is paired, not the last one. That is acceptable for a first-attempt estimate, but it is not documented.
  • When the observed count is 0 and the forecast is not, the error is undefined and falls into over_50_percent.
  • Until REV-003 is addressed, forecast accuracy may overstate how good pre-edit estimates are.

Project review verdict: APPROVED. Head c8bf60a was fully reviewed, all checks pass, and no open finding blocks approval. REV-001 to REV-003 are optional improvements.

@datacas
datacas merged commit ae36991 into main Sep 28, 2026
4 checks passed
@datacas
datacas deleted the issue-87-implementation-forecast branch October 6, 2026 07:53
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.

[experimental] Record an implementation forecast (pre-edit, post-routing) and measure it against the observed change

1 participant