Skip to content

refactor(runtime): separate review tasks from the shared loop - #1887

Merged
lizhengfeng101 merged 2 commits into
mainfrom
refactor/reviewtask-phase-one
Nov 10, 2026
Merged

lizhengfeng101 merged 2 commits into
mainfrom
refactor/reviewtask-phase-one

Conversation

@lizhengfeng101

Copy link
Copy Markdown
Contributor

Description

Extract review-specific behavior from the shared LLM runtime without changing OCR's external behavior. This is phase one only: it prepares a reusable execution kernel but adds no Behavior agent, combined report, new command, or session format.

  • Move comment argument repair, deterministic/cross-file/LLM relocation, collection, worker pools, completion validation, and review-specific finalization into internal/reviewtask, shared by review and scan.
  • Give internal/llmloop generic task configuration and Continue / Complete / Fail tool outcomes. Inject the existing compression, retry guidance, and final-round messages/tools unchanged.
  • Keep completion independent of budget stop reasons, and preserve request identity, usage accounting, per-key asynchronous waits, CLI/JSON output, manifests, and resume behavior.
  • Add 18 fixed-response equivalence fixtures captured from the original implementation at 34517e30, plus non-review task and asynchronous lifecycle tests.

Evaluation gate

Real-model baseline/candidate quality evaluation is still pending. This PR is a phase-one candidate, not acceptance of the second phase. Do not add Behavior analysis or reporting until the maintainer completes that evaluation and explicitly accepts the result.

Type of Change

  • Refactoring (no functional changes)
  • Documentation update

How Has This Been Tested?

  • make check
  • make test (including the race detector)
  • make coverage: 91.5% overall; 93.7% for llmloop, 97.5% for reviewtask
  • All 18 original-runtime equivalence fixtures pass.
  • OpenCodeReview: all 13 selected production files completed, zero findings, zero failed or waived files; strict manifest validation passes. Tests, documentation, and JSON fixtures were not selected by that automated review's rules.
  • Real-model before/after quality evaluation

Verification artifacts ran from a Git-ignored project-local temporary directory to comply with host execution restrictions.

Checklist

  • The code passes the project's formatting, vet, license, and English-only checks.
  • The human author has reviewed all AI-generated code, tests, and documentation.
  • Relevant tests were added and existing tests pass.
  • Implementation and evaluation-gate documentation was added.
  • The human author has confirmed the CLA requirement.
  • The human author can explain the changes and will answer maintainer questions from their own understanding.

AI/LLM Disclosure

Codex CLI with gpt-6-astra was used for implementation, tests, documentation, and PR preparation. OpenCodeReview v1.13.6 with gpt-6-astra was used for automated code review. No AI/LLM attribution or co-author trailers are included in commits. Human-review and CLA items remain unchecked until confirmed by the author. No human reviewers are explicitly requested by this PR.

Related Issues

None.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review complete: 0 finding(s) across 13 selected item(s).

@lizhengfeng101
lizhengfeng101 force-pushed the refactor/reviewtask-phase-one branch from 98747a3 to a9c9e55 Compare November 9, 2026 12:25

@css521 css521 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MuoDoo MuoDoo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice architecture

@lizhengfeng101
lizhengfeng101 merged commit 40e9eed into main Nov 10, 2026
12 checks passed
@lizhengfeng101
lizhengfeng101 deleted the refactor/reviewtask-phase-one branch November 10, 2026 02:24
NoamFido added a commit to FidoMoney/open-code-review that referenced this pull request Nov 11, 2026
upstream moved the review task out of llmloop into reviewtask (alibaba#1887), so the
cost budget is re-applied on the shared loop: Deps.MaxCostBudget/Price, the
StopCostBudget stop and the cost check sit in llmloop, and reviewtask passes
them through.

Also makes the cost gate read a coherent usage snapshot: RecordUsage adds a
response's four counters under usageMu and TotalCost reads them under it, so a
cache-heavy response is never priced as uncached while it is being recorded.
The loop and grace round now record usage through RecordUsage. A regression
test pins the interleaving.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
NoamFido added a commit to FidoMoney/open-code-review that referenced this pull request Nov 13, 2026
upstream moved the review task out of llmloop into reviewtask (alibaba#1887), so the
cost budget is re-applied on the shared loop: Deps.MaxCostBudget/Price, the
StopCostBudget stop and the cost check sit in llmloop, and reviewtask passes
them through.

Also makes the cost gate read a coherent usage snapshot: RecordUsage adds a
response's four counters under usageMu and TotalCost reads them under it, so a
cache-heavy response is never priced as uncached while it is being recorded.
The loop and grace round now record usage through RecordUsage. A regression
test pins the interleaving.
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.

3 participants