Accept bounded external token proposals in local Skippy generation - #1081
Conversation
|
This pull request is currently a draft. Reviews will not take place until the PR is marked as ready for review. |
📝 WalkthroughWalkthroughAdds linear proposal ingress contracts, validation, local execution and repair, telemetry receipts, generation-loop integration, runtime token accounting, public exports, and embedded-serving configuration. ChangesLinear proposal serving
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant LocalGeneration
participant LinearProposalIngress
participant StageOpenAiBackend
participant RuntimeState
LocalGeneration->>LinearProposalIngress: Query committed-token context
LinearProposalIngress-->>LocalGeneration: Return LinearProposal
LocalGeneration->>StageOpenAiBackend: Execute proposal
StageOpenAiBackend->>RuntimeState: Verify and update tokens
RuntimeState-->>StageOpenAiBackend: Return predicted tokens
StageOpenAiBackend-->>LocalGeneration: Return LinearProposalReceipt
LocalGeneration->>LinearProposalIngress: Report receipt
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
crates/skippy-server/src/frontend/linear_proposal.rs (1)
558-599: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the repair block into a named helper.
execute_local_linear_proposal_inneris ~140 lines and mixes verification, callback commit, and suffix repair/retire. The repair closure (Lines 568-599) is self-contained —trim_session, position re-check, and session retirement — and would read better as e.g.trim_branch_suffix_or_retire(...)returning the timing tuple, keeping the outer function within the configured Clippy complexity limits.As per coding guidelines: "Do not add Rust methods or functions over the configured Clippy line-count or cognitive-complexity limits; split complex logic into semantically named helpers."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/skippy-server/src/frontend/linear_proposal.rs` around lines 558 - 599, Extract the self-contained repair closure in execute_local_linear_proposal_inner into a semantically named helper such as trim_branch_suffix_or_retire, passing the runtime, session ID, and canonical position it needs. Have the helper perform trim_session, validate the repaired token count, retire the session on failure or mismatch, and return the repair timing values; update the caller to apply those results while preserving existing error messages and behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/skippy-server/src/frontend/linear_proposal.rs`:
- Around line 283-312: Make the deadline behavior explicit in
LinearProposalIngressConfig::new documentation by stating that deadline is
advisory and source::propose is responsible for honoring it. Add distinct
telemetry for proposals that return after deadline, alongside the existing
LinearProposalDiscardReason::DeadlineExceeded discard path, using the measured
proposal_elapsed_us and preserving the current discard and return behavior.
- Around line 396-407: Remove the #[allow(clippy::too_many_arguments)]
attributes from both affected functions, including
StageOpenAiBackend::execute_local_linear_proposal and the second function near
the same change. Introduce a small parameter struct for the coherent
session/decode values (session_id, current, base_position, generated_len, and
max_new_tokens), update callers and function bodies to use it, and preserve
existing behavior without warning suppression.
In `@crates/skippy-server/src/frontend/local_generation.rs`:
- Around line 606-609: Update the receipt-reporting call in the local generation
flow around config.source().report(&receipt) so reporting failures are non-fatal
after tokens have been committed and streamed: log the error and continue, or
pass the failure through the existing terminal-discard handling path. Do not
propagate the report error with ?, and preserve the source decision’s
receipt/discard contract.
---
Nitpick comments:
In `@crates/skippy-server/src/frontend/linear_proposal.rs`:
- Around line 558-599: Extract the self-contained repair closure in
execute_local_linear_proposal_inner into a semantically named helper such as
trim_branch_suffix_or_retire, passing the runtime, session ID, and canonical
position it needs. Have the helper perform trim_session, validate the repaired
token count, retire the session on failure or mismatch, and return the repair
timing values; update the caller to apply those results while preserving
existing error messages and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 44909aa2-acd8-4f5d-9704-a1bca8ee96e0
📒 Files selected for processing (12)
crates/mesh-llm-host-runtime/src/inference/skippy/mod.rscrates/mesh-llm-host-runtime/src/inference/skippy/resolver/translation.rscrates/skippy-server/src/binary_transport/binary_messaging.rscrates/skippy-server/src/frontend.rscrates/skippy-server/src/frontend/generation/server.rscrates/skippy-server/src/frontend/generation/types.rscrates/skippy-server/src/frontend/linear_proposal.rscrates/skippy-server/src/frontend/local_generation.rscrates/skippy-server/src/frontend/native_mtp/mod.rscrates/skippy-server/src/frontend/tests/multimodal.rscrates/skippy-server/src/lib.rscrates/skippy-server/src/runtime_state.rs
efebe1e to
50d6086
Compare
|
Reviewed this — overall low risk to A few things I'd want addressed before this stops being inert: 1. The risky code is exactly the untested code. The 10 new tests all cover pure helpers via a fake ingress. 2. Position mismatch fails the request instead of falling back. Each guard returns 3. 4. Tokens stream before the KV repair. 5. The deadline is unenforceable. 6. 7. Merge ordering. Please confirm this lands after #1078 — out of order risks wrong Metal results for the batched verification call, and per (1) no test would catch it. Minor: Merging as-is is defensible because it's inert, but I'd treat it as unvalidated until something in-tree constructs an ingress — at which point 1–3 become blocking. |
50d6086 to
63b6681
Compare
|
Follow-up status after stacking this PR on #1080 (
Merge ordering is now explicit: #1078 is already on The feature remains inert by default. A fixture-backed real-model test covering full accept / first mismatch / callback stop is still best treated as an activation prerequisite because the repository does not carry a hermetic model fixture; the existing optional native-runtime smoke fixtures cannot make that coverage run in normal CI. Likewise, changing the already-public |
* origin/main: Hand npm publishing to mesh-packaging feat(runtime): add daemon model lifecycle reconciliation (#1082) Accept bounded external token proposals in local Skippy generation (#1081) Expose target-authoritative local generation receipts (#1080) # Conflicts: # crates/mesh-llm-host-runtime/src/runtime/model_lifecycle.rs
Embedded Skippy consumers can now attach any in-process source of causal, width-one token proposals and have the target runtime verify, commit, repair, and report each decision authoritatively.
The source receives only committed token history plus a strict deadline and bounded proposal budget. Skippy owns acceptance classification, emits the exact target-authoritative committed prefix, trims branch-conditioned suffix rows after a mismatch or callback stop, and reports timing and position evidence back against the source's opaque decision ID.
Architecture
LinearProposalIngresstrait and bounded configuration.Protocol
This is an additive in-process API. It does not change the mesh wire protocol or the Skippy ABI.
Dependency
The diff is independent of #1078, but canonical Metal behavior for its batched target-verification call depends on #1078. This draft should merge after #1078.
Validation
cargo fmt --all -- --checkcargo test -p skippy-server --lib(309 passed)cargo check -p skippy-servercargo check -p mesh-llmcargo clippy -p skippy-server --all-targets -- -D warningscargo clippy -p mesh-llm --all-targets -- -D warningsSummary by CodeRabbit