Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
Ingwannu
left a comment
There was a problem hiding this comment.
Approved for the PF-05 layer on exact head 243fd58eb06567879c215b7099090259294a3cad, relative to its PF-03 base.
The extracted send-budget, attempt, final-log, and response-identity primitives preserve the existing ownership boundaries. Native Chat still owns its spend tracker, active attempt, first-wins final row, retries, failover, relay, and usage; the split exposes execution without silently creating a second final-log owner.
Focused validation under a 2-CPU / 4 GiB cgroup passed: 80 tests, 0 failures across all four new primitive suites and the relevant native Chat policy, spend, image, role, finish, and eligibility suites.
This approval is not merge-readiness for the stack. The PR still targets the PF-03 branch, and current CI fails because PF-03 added /api/protocols and /api/protocols/plan without adding their headless CLI parity disposition. PF-01 through PF-03 also have active changes-requested reviews; PF-05 must remain behind those corrected bases and obtain a green exact-head run before merge.
리뷰 · 우선순위 50 / 80이 PR은 세 입구가 각자 복사해 쓰던 준비 동작을 한곳으로 모은다. Responses, 채팅 완성, Messages가 요청 로그를 끝내는 코드가 같았고, 그 코드를 네이티브 채팅은 둘로 나뉜다. 클라이언트 회선 표시도 만들어 두었다. 아직 호출하는 곳이 없다. 계획의 PF-07과 PF-09가 쓸 자리다. 베이스는 #5810의 라인 - CI 라인 - 메인테이너의 판단이 필요한 지점
계획 표는 네이티브 채팅의 예산도 콤보 자식의 시도 열기는 이 PR이 안 건드린다. 계획 표에는 들어 있고, 본문은 PF-07이 가져간다고 적었다. 너의 추천 방향은 유지해라. 닫을 중복 PR은 없다. 베이스를 이 댓글은 grok-bot이 작성했습니다 |
The ingress-owned send holder is built in one place: default guarded policy and this request's spend tracker as observer. Responses core and later native lanes share it.
Three ingress files hand-roll the same once-flag around addFinalRequestLog. One owner lets a native attempt hand its final row to whichever caller owns the request.
Opening an attempt is four ordered writes on the log context plus identity sealing; the handle keeps them together so a new lane cannot skip or reorder one.
Lets an ingress tell a body already in its own client wire from a Responses body it still has to convert. Nothing marks responses yet.
…context Same construction, same short-circuit on an inherited holder. core.ts no longer imports request-spend directly, so the owner inventory drops it: the import graph from core.ts is what the module-boundary test compares against.
…tLog Same once-claim, same fields, same call sites; the local flag and its closure go.
Both the caller-forward passthrough and the routed replay used the same once-flag closure; the shared owner keeps their fields and call order unchanged.
The four context writes and the identity seal run in the original order, before any effort normalization or send.
The native finishLog still records the redacted failure text before the row, once; only the once-flag moves to the shared owner.
…apper The wrapper opens the attempt and owns the final log row; runNativeChatAttempt runs the effort normalization, send loop, key failover, 429 replay, relay and usage and reports every outcome through the finishLog it is given. A combo child can then run a native attempt whose final row belongs to the parent. Statement order is unchanged.
Same names from the same owners, one statement per module. core.ts sits at its size cap and the native Chat combo work needs headroom there.
243fd58 to
70c2c84
Compare
|
Maintainer triage: Criteria (P3): Low: new provider/client integration, large or experimental feature (>2000 LOC or >50 files), RFC/roadmap, or long-stale branch. Related / overlapping PRs:
|
Summary
PF-05 of the protocol-first-class unit (
devlog/_plan/260924_protocol_first_class/020_engine_and_codecs.md#pf-05-shared-inference-primitives). Stacked on #5810 (PF-03).Behavior-preserving refactor: the execution primitives that the Responses pipeline, native Chat and Messages each rebuilt by hand move into
src/server/inference/, so the native lanes in later packets reuse one owner instead of copying it.context.ts—createInferenceSendBudget(req, logCtx), the single construction of the ingress send budget with its spend tracker. Still only built when no budget is inherited (options.sendBudget ?? …), so a combo child keeps the parent's holder.final-log.ts—createFinalRequestLog(logIds, logCtx), finish-once ownership of the final request row; replaces thefinalizeNativeLog/finalize/nativeLoggedclosures in Chat, native Chat and Messages.attempt.ts—beginInferenceAttempt, wrapping attempt opening, identity sealing and finishing in their original order; adopted by native Chat.client-wire.ts—markClientWire/clientWireOf(unused until PF-07/PF-09).handleNativeChatCompletionssplits intorunNativeChatAttempt(send loop, key failover, 429 replay, relay, usage) and the wrapper that opens the attempt and owns the final log, so a combo child can later run a native attempt whose log belongs to the parent.src/server/responses/core.tsshrinks 210 → 198 (cap 210): one line from the budget import, eleven from grouping its compatibility re-exports per owner module (same exported names).Deliberately not converted: the combo child attempt (different shape — own child log, parent attempt list, late seal; PF-07 owns it) and native Chat's send budget (it only attaches a spend tracker; switching would add budget behavior).
Reviewer notes on ordering: the final-log once-flag now settles even without
logIds(nothing reads it; rows written are unchanged); native ChatfinishLogwritesupstreamErrorafter thefinished()check and beforefinish(equivalent — the redaction cannot throw).Verification
bun x tsc --noEmit: exit 0 on this head.bun run structure:check: passed.Tests (
tests/server/inference-*.test.ts) were written and registered, andtests/helpers/responses-core-source.tsupdated for the changedcore.tsimports, but run in the full local suite below.Full local run on the stack head (feat(protocols): protocol paths as a first-class concern — PF-01..PF-12 #5820, which contains this change):
bun run test— the only failures are Lab CL-03/CL-07/CL-08/SEC-02 andrelease helpertimeouts, which fail identically on a checkout without this stack (local environment), plus service/toggle cases that pass when run alone;cd gui && bun test --isolate tests— 2398 pass, 0 fail.CI on this head: all required checks pass.
Checklist