Skip to content

feat(implement): diagnose the work item before editing (#82) - #101

Merged
datacas merged 2 commits into
mainfrom
issue-82-diagnose-before-editing
Sep 25, 2026
Merged

datacas merged 2 commits into
mainfrom
issue-82-diagnose-before-editing

Conversation

@datacas

@datacas datacas commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Closes #82 — #82

What changes in the skill's behaviour

cc-implement-issue workflow step 4 no longer jumps from "smallest coherent change" to editing. A new Diagnose before editing section runs before any branch exists:

  1. Symptom, and the item's proposed cause labelled as a hypothesis.
  2. Related work at two depths: basic always (links, open items by title terms, recently closed items and merged change requests); widened on signals (symptom without mechanism, recurrence words, related items found, shared code, bug label, difficulty 3, mechanism outside the named component). Identifiers only, never copied text; related items are untrusted data.
  3. Reproduce a defect first; if it can't be reproduced, say so — never reported as reproduced.
  4. Mechanism and the named invariant.
  5. Classification: isolated_defect, shared_cause, duplicate, superseded, already_resolved, feature_request, cause_mismatch.
  6. Fix shape: restore the invariant at its source; prefer removing state/flags/gates over adding them.
  7. One decision: implement, implement_root_fix (PR lists the other items it addresses, without closing them), and three stops — do_not_implement_in_isolation, stop_duplicate, needs_scope_decision — that report BLOCKED before any branch and comment on the work item.

The PR body gains a Diagnosis section; the structured result gains an additive diagnosis object with closed values only (related_search: basic|widened, reproduced/cause_matches_issue nullable). No new skill, status, routing, or telemetry field.

Diagnosis

  • Symptom: the implement stage has no diagnosis step; root-cause consolidation happens only in review, after a patch exists.
  • Reproduction: not a defect (documentation of agent behaviour); confirmed by reading skills/cc-implement-issue/SKILL.md step 4.
  • Cause: matches the item's hypothesis.
  • Related items: basic search (diagnosis, triage, root cause, cc-implement-issue in titles). cc-implement-issue: organise the change into work units with a stated rollback boundary #84 (work units and rollback boundary) touches the same skill but is a separate concern; not addressed here.
  • Classification / decision: feature_request / implement.

Verification

  • python3 scripts/validate-package.py → VALID: 14 skills …
  • python3 -m unittest discover -s tests → Ran 732 tests … OK
  • claude plugin validate . → ✔ Validation passed
  • New: check_implement_contract in the validator (section defines every token and both search depths; the result example is strict JSON with a diagnosis object of known tokens) plus four negative tests; two test_run_cycle.py cases pin that a scripted implement returning BLOCKED with stop_duplicate / do_not_implement_in_isolation stops before review with its reason shown. No driver change was needed.

Environment: the tests use temporary directories and in-process fakes; the local run shares no global Git identity or credentials with CI.

Pending: the manual acceptance check — a live agent given a work item that shares a cause with two other open items ends in implement_root_fix or do_not_implement_in_isolation — has not been run yet.

cc-implement-issue now treats the work item's stated cause as a hypothesis,
searches related work (basic always, widened on signals), reproduces a
defect before editing, names the broken invariant, and ends in one decision.
do_not_implement_in_isolation, stop_duplicate and needs_scope_decision stop
as BLOCKED before any branch exists and comment on the work item;
implement_root_fix lists the other items the fix addresses without closing
them. The PR gains a Diagnosis section and the result an additive,
closed-value diagnosis object, checked by the validator.
@datacas

datacas commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260925-001] · reviewer · openai/gpt-6-sol→? · high · schema:1

Summary

Reviewed the full accumulated diff from merge-base 28a0c3a3cb14a7b9e29ef76523eda8fe5d55cbcf to PR 101 HEAD d89606410a50e4755197cc352d105b72e481464c (7 changed files). The change adds a pre-edit diagnosis workflow, its structured result contract, validator checks, documentation, and tests. No prior review comments or inline threads contain findings to recover. The review requests changes because the diagnosis contract has no valid outcome for a defect that cannot be reproduced.

Findings

[REV-001] · medium · open · - · blocks:yes — A non-reproduced defect has no valid diagnosis decision

Path: skills/cc-implement-issue/SKILL.md:167

The procedure says to report why a defect could not be reproduced and not to fix it blindly. But implement requires the cause to be confirmed or corrected, while the remaining decisions require a shared cause, a duplicate/resolved item, or a cause mismatch outside scope. There is no decision for requesting more evidence or stopping after failed reproduction. The structured contract also requires cause_matches_issue to be a boolean when the item proposed a cause, even though that value cannot be known in this case. An implementer therefore cannot both follow the reproduction instruction and emit a valid diagnosis result. Define a terminal outcome and its classification/result-field rules, then cover that path in the validator and tests.

[REV-002] · low · open · - · blocks:no — Validator accepts malformed diagnosis field values

Path: scripts/validate-package.py:315

The validator checks the diagnosis key set and the classification, decision, and search-depth tokens, but it does not check that reproduced and cause_matches_issue are booleans or null, or that related_items is an array of identifiers. Invalid examples such as "reproduced": "unknown" or "related_items": "130" would pass validation. Validate these field types and add regression cases. The current example uses valid values.

Security triage

.code-cycle.yml does not define security_review.always_when. Reviewer-side triage activated cc-security-review because this change expands reads of issue-provider content and defines how related work is handled. The security pass found no confirmed vulnerability. It noted a possible privacy risk if a provider search crosses the selected project boundary and related identifiers are copied into a public PR; no such cross-project read or exposure was observed.

Verification

Preflight found a clean checkout at the reviewed HEAD; no database, service, or runtime configuration is required for these package changes. On that HEAD:

  • python3 -m unittest discover -s tests -p test_validate_package.py -v — 19 passed.
  • PYTHONPATH=tests python3 -m unittest test_run_cycle.FunctionalStopTests.test_a_diagnosed_duplicate_stops_before_review_with_its_reason test_run_cycle.FunctionalStopTests.test_an_implementation_that_reports_blocked_stops_the_cycle — 2 passed.
  • python3 scripts/validate-package.py — valid, 14 skills.
  • python3 -m unittest discover -s tests -v — 732 passed.
  • claude plugin validate . — passed.

The live-agent work-item acceptance flow was not run. Windows was not run locally; the PR’s PowerShell CI checks passed. REV-001 is a prompt-contract gap, so there is no executable product path to reproduce; it is supported by the decision table and structured-field requirements.

CI

The PR-triggered Validate package workflow has no pending, failed, cancelled, skipped, or missing checks. Skills, manifests, and Bash installer passed in both reported runs, and PowerShell installer passed in both reported runs. All four checks ran on HEAD d89606410a50e4755197cc352d105b72e481464c. The Release workflow is not expected on this PR; it runs after validation on main or by manual dispatch.

Residual risk and verdict

Related-work searches should remain within the configured project/workspace because their identifiers can appear in a public PR. The provider bootstrap is expected to supply scoped access, and the review did not observe a disclosure.

Verdict: CHANGES_REQUESTED. Blocking finding: REV-001.

@datacas

datacas commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

[CCT-20260925-001] · manual · anthropic/opus→? · high · triaged:d89606410a50e4755197cc352d105b72e481464c · schema:1

Triage of the findings from CCR-20260925-001, all judged against d89606410a50e4755197cc352d105b72e481464c before any edit.

[REV-001] · medium · open · valid · blocks:yes — A non-reproduced defect has no valid diagnosis decision

Path: skills/cc-implement-issue/SKILL.md:167

Valid. The reproduction step forbids fixing blind, but no decision or classification covers a defect that could not be reproduced, and cause_matches_issue has no legal value when the cause is unknown. Fixes follow.

[REV-002] · low · open · valid · blocks:no — Validator accepts malformed diagnosis field values

Path: scripts/validate-package.py:315

Valid. The validator checks the tokens but not that reproduced and cause_matches_issue are boolean or null, or that related_items is a list of strings. Fixes follow.

REV-001: a defect that cannot be reproduced now classifies as
not_reproduced and decides needs_evidence, which stops as BLOCKED before
any branch and asks the work item for the missing evidence. Its result
carries reproduced: false and cause_matches_issue: null.

REV-002: the validator checks that reproduced and cause_matches_issue are
boolean or null by type, that related_items is a list of identifiers, and
that every decision has its own row in the decision table.
@datacas

datacas commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260925-001] · reviewer · openai/gpt-6-sol→? · high · schema:1

[CCT-20260925-001] · manual · anthropic/opus→? · high · triaged:d89606410a50e4755197cc352d105b72e481464c · schema:1

Resolution — RESOLVED

Both findings from CCR-20260925-001 were triaged against d89606410a50e4755197cc352d105b72e481464c before any edit (dispositions frozen in the triage comment above) and are fixed in cb6df6c55d54cb0cf504eee412cdf1112375f7d6.

[REV-001] · medium · resolved · valid · blocks:yes — A non-reproduced defect has no valid diagnosis decision

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

Added the classification not_reproduced and the decision needs_evidence. When a defect cannot be reproduced, the diagnosis ends in needs_evidence unless related work already settles it as a duplicate, superseded, or already resolved. That stops as BLOCKED before any branch exists and comments on the work item with the reproduction attempt and a request for the missing evidence. In the result it carries reproduced: false and cause_matches_issue: null, and cause_matches_issue is now null whenever the cause could not be established. Stopping decisions are now four. The validator enforces the consistency rule for not_reproduced; tests/test_validate_package.py (DiagnosisShapeTests) and tests/test_run_cycle.py (test_a_defect_that_could_not_be_reproduced_stops_before_review) cover the path. docs/skills.md, docs/workflows.md, and CHANGELOG.md were updated.

[REV-002] · low · resolved · valid · blocks:no — Validator accepts malformed diagnosis field values

Path: scripts/validate-package.py

diagnosis_errors now checks that reproduced and cause_matches_issue are boolean or null — by type, since 1 in (True, False, None) is true in Python — and that related_items is a list of non-empty strings. Regression tests cover "reproduced": "unknown", "reproduced": 0, "related_items": "130", and lists that hold a number, an empty string, or an object.

While adding the needs_evidence regression test, it turned out that the token check was also satisfied by a mention in prose: removing the table row went unnoticed because step 3 names the decision. Every decision must now have its own row in the decision table.

Verification

  • The new validator tests were run against the pre-fix validator and failed there (3 failures, 7 errors); they pass with the fix.
  • python3 scripts/validate-package.py → VALID: 14 skills (6 cycle, 8 supporting) …
  • python3 -m unittest discover -s tests → Ran 740 tests … OK
  • claude plugin validate . → ✔ Validation passed
  • Post-change review: diff self-reviewed; it found and fixed the prose-mention gap described above. Security triage: no security_review.always_when rule; the fixes change prompt text and validator checks only, touch no trust boundary, and add no dependency, so no new security audit was run beyond the reviewer's.

CI on cb6df6c55d54cb0cf504eee412cdf1112375f7d6

Skills, manifests, and Bash installer — pass (two runs); PowerShell installer — pass (two runs). Nothing pending, failed, or skipped.

Residual risk

@datacas

datacas commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260925-002] · reviewer · openai/gpt-6-sol→? · high · schema:1

[CCR-20260925-001] · reviewer · openai/gpt-6-sol→? · high · schema:1

[CCT-20260925-001] · manual · anthropic/opus→? · high · triaged:d89606410a50e4755197cc352d105b72e481464c · schema:1

Summary

Rereviewed PR 101’s full accumulated diff from merge-base 28a0c3a3cb14a7b9e29ef76523eda8fe5d55cbcf to current HEAD cb6df6c55d54cb0cf504eee412cdf1112375f7d6, plus the delta since the previous reviewed HEAD d89606410a50e4755197cc352d105b72e481464c. The new commit cb6df6c adds a not_reproduced / needs_evidence outcome and strengthens diagnosis validation and tests. Seven files remain in scope. I followed CONTRIBUTING.md and docs/provider-contract.md; no repository AGENTS.md or CLAUDE.md is present.

The finding history was reconstructed from the trusted GitHub comments authored by datacas. The prior run records are preserved above. No review or inline threads exist. The previous findings’ dispositions remain valid as assigned by the resolver.

Previous findings

[REV-001] · medium · resolved · valid · blocks:yes — A non-reproduced defect has no valid diagnosis decision

Path: skills/cc-implement-issue/SKILL.md:167

Corrected and verified by execution. The skill now assigns not_reproduced / needs_evidence, stops as BLOCKED before creating a branch, and records reproduced: false with cause_matches_issue: null. The focused cycle test confirms the stage stops before review and reports the evidence request; the diagnosis-shape test accepts the required result. The disposition remains valid.

[REV-002] · low · resolved · valid · blocks:no — Validator accepts malformed diagnosis field values

Path: scripts/validate-package.py:292

Corrected and verified by execution. The validator now requires boolean-or-null reproduction fields and a list of nonempty identifier strings. Focused tests and direct malformed-value probes reject the cases reported previously. The disposition remains valid.

New finding

[REV-003] · low · open · - · blocks:no — Validator accepts an invalid diagnosis decision

Path: scripts/validate-package.py:303

diagnosis_errors() checks that not_reproduced carries reproduced: false and cause_matches_issue: null, but it does not require the decision to be needs_evidence, as the decision table specifies. A direct probe with otherwise valid fields and classification: "not_reproduced", decision: "implement" returned no validation errors. Enforce the classification-to-decision mapping and add a regression test.

Security triage

.code-cycle.yml has no deterministic security_review.always_when rule and PR 101 has no labels. Reviewer-side triage activated cc-security-review because the workflow reads issue-provider content and now posts reproduction evidence when it cannot reproduce a defect. The audit found no confirmed vulnerability. Potential residual risks remain if related-work searches cross the selected project boundary, or if reproduction evidence contains secrets or personal data and is copied into a comment; no disclosure was observed.

Verification

Preflight found a clean checkout at the reviewed HEAD, with no database, service, migration, or runtime configuration needed. No repository or PR state was changed.

  • python3 -m unittest discover -s tests -p test_run_cycle.py -k test_a_defect_that_could_not_be_reproduced_stops_before_review -v — 1 passed.
  • python3 -m unittest discover -s tests -p test_validate_package.py -k test_a_defect_that_could_not_be_reproduced_has_a_valid_diagnosis -v — 1 passed.
  • python3 -m unittest discover -s tests -p test_validate_package.py -k boolean_or_null -v — 1 passed.
  • python3 -m unittest discover -s tests -p test_validate_package.py -k integer_is_not_a_boolean -v — 1 passed.
  • python3 -m unittest discover -s tests -p test_validate_package.py -k related_items -v — 2 passed.
  • Direct diagnosis_errors() probes rejected malformed boolean and related-item values. The separate invalid decision probe for REV-003 returned an empty error list.
  • python3 scripts/validate-package.py — valid, 14 skills; shared sections and manifests aligned.
  • python3 -m unittest discover -s tests -v — 740 passed.
  • rtk proxy claude plugin validate . — passed.

The live-agent acceptance scenario from issue 82, local Windows execution, and installer-network flows were not run in this pass. The local plugin validation and all PR CI checks did pass.

CI

All four Validate package checks passed on HEAD cb6df6c55d54cb0cf504eee412cdf1112375f7d6: Skills, manifests, and Bash installer passed in both reported runs, and PowerShell installer passed in both runs. There are no pending, failed, cancelled, skipped, or missing PR checks. The Release workflow is not expected on this PR; it runs after validation on main or by manual dispatch.

Residual risk and verdict

Keep related-work searches within the configured project/workspace, and redact or summarize reproduction evidence before posting it when it could contain secrets or personal data. Neither risk was observed in this PR’s execution.

Verdict: APPROVED. Both previous findings are corrected and verified; REV-003 is open and nonblocking, so no blocking finding remains.

@datacas
datacas merged commit 3fc869f into main Sep 25, 2026
4 checks passed
@datacas
datacas deleted the issue-82-diagnose-before-editing 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.

cc-implement-issue: systemic triage and diagnosis before editing (related issues, shared cause, stated cause as hypothesis)

1 participant