Repository navigation
Use verified prompt work and observed rates for first-content admission - #1245
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review Please review this stacked implementation against #1233 and its requested follow-up. Signed candidate 5b58240 is frozen for dedicated M5 hardware qualification; six independently qualified prompt-count fallback records are included. Hardware deadline/serving catalog promotion remains draft pending real measurements. Please focus on accounting/provenance, original-deadline preservation, whole-Mac lifetime bounds, and cross-language applicability. |
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. |
|
@codex review Please review current signed head 6d91994. Independent review added executable-reported compile-time build flags/hash and explicit per-trial Low Power exclusion to hardware qualification; 66 Python cases and the real binary-identity Swift test pass. Production sources and SDK are unchanged from the initial candidate. Dedicated M5 qualification is restarting against this clean, attested build. |
|
Found 2 test failures on Blacksmith runners: Failures
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d919940ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5e8fbcf to
2aa3413
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf030c63b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jonathan308
left a comment
There was a problem hiding this comment.
Reviewed at bf030c63b against merge base d2a7b6431a, across coordinator api/protocol, coordinator registry, provider-swift sources, and scripts/tests/docs. I found no correctness or safety blockers: nothing understates prompt work, wire additions are optional and omitempty in both directions, reservation/allowance release paths are balanced, and the deadline catalog is [] in every Go/Swift/Python copy, so timing admission stays on the conservative fallback everywhere. The SDK pin 7167841 is the merge commit of mlx-swift-lm #173 and matches SDK main. CI is green apart from E2E Benchmarks, which is still pending.
Local verification: go vet ./... is clean. go test -race passes for api/promptwork, registry (including firstcontent and routingsim) and protocol. coordinator/api shows 4 failures (TestJSON*EncodedLen*, TestCacheBustSpliceMatchesReencode/canonical_raw_line_separators), and they fail the same way on the merge base with Go 1.27.1, so the toolchain causes them, not this PR. The Python suite passes 105 tests with 1 archive skip once LC_ALL is set (see item 5).
Follow-ups. None block this PR; items 1 and 2 are behavior changes worth addressing soon.
- Count-only sidecar call bypasses cache-activation sampling and the QPS throttle. In
api/promptwork/planner.go:31-39, whenPlanCacheRouteWithResultreturnsSidecarCalled=false(routing off, sampled out, or throttled),Planmakes its ownclient.Plancall. Operators who use routing-off ormaxQPSto shield the tokenizer sidecar still get a synchronous sidecar call (capped at 1s) per eligible text request and candidate model, limited only by the 16-slot gate. Suggestion: apply the activation throttle to count-only calls, or skip them when routing is explicitly off. - A saturated gate silently drops the cache plan, and the empty result is memoized.
Gate.Acquire(api/promptwork/planning.go:18-28) never waits, so with more than 16 planning bodies in flightAccountreturns the fallback with an emptyCache.Memo.Planthen stores that for the request's retries. On master,planCacheRoutealways reached the registry. Exact-cache routing therefore degrades exactly under load. It fails cold, but it is a regression. Suggestion: let cache planning proceed without a permit (as before) and gate only the count-only path, or skip memoizing gate-miss fallbacks. - The legacy forecast now uses qualified
PromptWorkeven with an empty deadline catalog (registry/first_content_forecast.go:82-84). This is intended, and exact counts are ground truth. For Qwen3.8-27B the calibrated fallback upper bound is about 3.5×estimate+117 in-domain, soMaxTTFTMs/RequireFreshFeasiblerequests that routed on master can now returnFirstContentPredictedLate. Please call this out in the CHANGELOG/release notes. Nit on the same line:IsQualifiedFor(..., pr.PromptWork.PromptContractID)compares the contract ID with itself, so only the artifact hash is bound on the legacy path. - Provider: (a)
Messages.swiftdecodeIfPresent(PromptWork.self, …)throws on a present-but-malformedprompt_work, which drops the whole inference frame. Consider(try? …) ?? nil, since the field is advisory. (b)deadlineWorkis populated and treated as a material heartbeat change on every slot, so SSD stage/donate/write edges now cause extra heartbeats on machines with no deadline profile. Consider sending it only for slots with a profile. (c) Once profiles ship, a request's own SSD staging bumpsactivityEpochafter the allowance proof, so calibration never engages whenminimumWholeMacQuiescenceMs > 0with the SSD prefix cache on. It fails safe, but qualification should cover it. - Tests:
monitoring/test_release_comparison.pyerrors insetUpClasson macOS (Homebrew PG16: "postmaster became multithreaded during startup" withoutLC_ALL) instead of skipping asdocs/developer/test.mdstates. It also hard-codes port 55432, and it probably skips silently on Ubuntu runners whereinitdb/pg_ctlare not onPATH. Relatedly,test_catalog_evidence.pyresolves promoted evidence relative to the repo, which conflicts with the local-archive policy once a profile is promoted.
|
@codex review Please review latest head |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Addressed the follow-ups in the human review in signed head
Validation: full coordinator tests and native/Linux builds; focused API/promptwork race tests and full vet; full provider build/tests and 16 focused Swift regressions; 115 Python tests with retained archive coverage and no skips; documentation impact/lint and whitespace checks. The PR description reflects the final scope. Fresh hosted checks will validate this head. @codex review Please review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67b0e77ea5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review latest signed, GitHub-verified head Seven focused Swift regressions (including the real tiny-model factory path), all 119 archive-enabled Python tests, documentation checks and whitespace checks pass. The full local provider suite is running in parallel with this head's hosted checks. The ordinary 50% rate reduction remains removed; the timing catalog remains empty, with no new hardware qualification or profile promotion. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa731637ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The two latest calibration findings are fixed in @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b650124a19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The latest three review findings are fixed in Focused validation passes 93 Swift tests and registry race checks; Go vet, native/Linux builds and documentation checks pass. The full coordinator suite, native/Linux builds, and full provider suite also pass: 3,467 main Swift tests, 208 XCTest cases and 12 isolated tests. Hosted checks and automatic review track this commit. No timing profile was promoted. |
Resolve changelog and documentation stamp conflicts while preserving both branches' entries and validation guidance.
Heuristic prompt counts and a fixed 50% throughput reduction can cause requests to be rejected before prompt processing even when the observed processing rate predicts that they fit. This PR shares verified prompt work across routing and provider admission, and removes the fixed rate reduction from both deadline forecasts. For example, 8,000 uncached tokens at an observed 800 tokens/s are priced as 10 seconds of prefill rather than 20, before queued work and other allowances.
It follows merged #1230 and #1233, targets
master, and pins merged mlx-swift-lm #173 at71678411330e37cb76d1a10134411433dfa5c9a9, including #172.Changes
prompt_work_identity. Missing or mismatched identity retains ordinary heuristic accounting. The provider reconcilesprompt_workagainst actual tokenization.api/promptwork/, pure forecast helpers inregistry/firstcontent/, and focused providerDeadline/modules.Before
%%{init: {"htmlLabels": false, "flowchart": {"htmlLabels": false, "nodeSpacing": 18, "rankSpacing": 24}, "themeVariables": {"fontSize": "14px"}}}%% flowchart TD R["Request + original deadline"] --> A["API heuristic / optional cache count"] A --> C["estimateFirstContent<br/>Rate x 0.5 for feasibility"] C --> P["Provider tokenizes actual prompt"] P --> D["Atomic deadline gate<br/>Observed rates x 0.5"] D -->|"fits"| S["Generate content"] D -->|"refused"| Q["Retry on remaining clock / 429"] classDef work fill:#dbeafe,stroke:#1d4ed8,color:#172554 classDef gate fill:#fef3c7,stroke:#a16207,color:#422006 classDef success fill:#dcfce7,stroke:#15803d,color:#14532d classDef failure fill:#fee2e2,stroke:#b91c1c,color:#450a0a class R,A,C,P work class D gate class S success class Q failureAfter
%%{init: {"htmlLabels": false, "flowchart": {"htmlLabels": false, "nodeSpacing": 18, "rankSpacing": 24}, "themeVariables": {"fontSize": "14px"}}}%% flowchart TD R["Request + same deadline"] --> A["api/promptwork<br/>Exact / validated count"] A --> I["Match provider artifact + template"] I --> C["estimateFirstContent<br/>Resolved rates without halving"] C --> P["Provider: reconcile actual tokens"] P --> D["Atomic queue / cache projection<br/>Observed rates without halving"] D --> V{"Memory + remaining time fit?"} V -->|"yes"| S["Generate content"] V -->|"no"| Q["Bounded retry / 429"] classDef work fill:#dbeafe,stroke:#1d4ed8,color:#172554 classDef gate fill:#fef3c7,stroke:#a16207,color:#422006 classDef success fill:#dcfce7,stroke:#15803d,color:#14532d classDef failure fill:#fee2e2,stroke:#b91c1c,color:#450a0a class R,A,C,P work class I,D,V gate class S success class Q failureBlue nodes prepare request estimates; amber nodes check identity, workload and admission; green/red are caller-visible outcomes. The optional reviewed timing path is omitted from the After figure because its catalog has no active entries.
Validation
Validation below covers the rate-factor removal, prompt-evidence fixes and human-review follow-ups. The review fixes pass shared Go/Swift confidence boundaries and focused Go race checks; 93 focused Swift tests cover the current qualification policy, applicability and factory regressions. All 9,000 archived corpus bodies retain their original numeric shapes and workload hashes after rendering-domain restrictions. The unchanged Python qualification suite previously passed all 119 tests. Hosted checks and automated review track the latest pushed commit.
make providerpasses ona8aa6bb33: source-matched build/metallibs, 3,467 Swift tests across 459 suites, 208 XCTest cases (8 expected skips), and 12 additional isolated tests. Sixteen earlier focused regressions cover advisory metadata, heartbeat work publication, SSD proof invalidation and the real scheduler's observed-rate admission; genuinely too-short and expired budgets still refuse. Factory regressions additionally exercise the actual production factory with validated fixture cache plumbing, rejecting absent/mismatched context and unqualified overrides. The test injects a synthetic hardware identity so virtual CI Macs do not need to advertise physical GPU cores; production hardware detection and validation remain strict.make coordinator-test coordinator-build coordinator-build-linuxpasses on the final changes. Focused API/promptwork race regressions andgo vet ./...pass. The new tests exercise actual registry sampling/QPS denials, recovery of memoized planning after saturation, measured rendering controls, confidence boundaries and malformed work-report fallback; earlier full registry/protocol and API race checks also pass as recorded in review.make docs-impact-check BASE=origin/masterandmake docs-checkpass. Nine PostgreSQL tests include the release comparison SQL and two simultaneous disposable clusters. The helper discovers versioned Linux installations, uses a safe locale/private socket/dynamic port, and reports startup failures.Hosted checks pass on
a8aa6bb33, including the blocking integration gate and provider SDK tests. Two informational results remain visible:TestIntegrationExactCacheRoutingfails while waiting for contiguous frozen-full cache advertisement from the paged Gemma e2b fixture. The latest run and current master baseline fail at the same assertion. The existing workflow explicitly marks this fixture expected red; this PR changes neither that test nor its gate.Limits and release integration
Observed rates can overpredict future speed under changing load or hardware conditions; removing the fixed factor trades fewer conservative refusals for less timing margin. Actual elapsed-deadline cancellation and physical admission stay enforced. A paired coordinator/provider release and provider adoption are necessary: old providers retain their own 0.5 factor.
Qualified prompt-count upper bounds apply without a timing profile and can exceed the previous heuristic. Some tight-budget requests can therefore become predicted late; exact tokenizer counts take precedence when available. This count correction remains independent of removing the fixed rate reduction.
The optional timing catalog remains empty. Future profile promotion requires independently validated prediction-error bounds and continuously sampled power evidence. Go and Swift independently recheck the stored counts against a one-sided 95% confidence test and the claimed tail target, bounded to 10,000 total calibration/validation samples per cell. Current compiled eligibility requires serial partial prefill, a mixed cap of nil/128/256/512, exactly 20 seconds of whole-Mac quiescence and 5 seconds of stable nominal posture, and consistent cell width/context/report identity. Broader or busy applicability needs separate qualification and a reviewed validator change; ordinary scheduler configuration remains independent of this timing eligibility. Its resolver rejects unqualified runtime overrides, including normal CLI-projected MLX controls. The supervised fixture's isolated-cache settings use an explicit validated context, checked before cache construction; ordinary production callers cannot gain an exemption through environment keys alone. This does not prevent ordinary rate admission from using the measured rates directly.
A request's SSD staging invalidates its earlier whole-Mac quiescence proof and retains ordinary admission. Future cooled-profile promotion must explicitly cover that staging interval; this PR does not relax the proof or restart hardware qualification.
All new reports and raw benchmark evidence remain outside the PR in a hash-verified local archive. The two actual prompt-corpus replay tests and historical-cohort rejection test are opt-in through
DARKBLOOM_QUALIFICATION_EVIDENCE_ROOT; ordinary CI retains coefficient, runtime guard and synthetic qualification checks. See the qualification and archive-replay procedure.No concurrency or chunk defaults, memory floors, billing rules, production deployment, release publication or merge are changed by this PR. Release validation should compare successful first content within budget, actual coordinator timeouts, provider decision diagnostics and cancellation/accounting under idle and contended requests. The provider wire reason
deadline_unreachablealso represents some elapsed expirations, so its raw rejection count cannot establish that a refusal was predictive or false.