Implement TokenJuice pipeline and policy primitives#7
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (103)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92fbb2e198
ℹ️ 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".
| path = "src/main.rs" | ||
|
|
||
| [[bin]] | ||
| name = "tinyjuice-hooks" |
There was a problem hiding this comment.
Keep hook entrypoints on the tinyjuice binary
With this bin rename, cargo install tinyjuice now exposes the existing hook installer/entrypoints as tinyjuice-hooks, while the hook templates, defaults, and docs still configure agents to run commands such as tinyjuice codex-post-tool-use, tinyjuice claude-code-post-tool-use, and tinyjuice install claude-code. Those commands now hit the new reducer CLI in src/main.rs, so existing Codex/Claude hooks break after upgrade and fresh Claude installs fail unless users manually discover and override the renamed binary.
Useful? React with 👍 / 👎.
| if !message_roles.is_empty() { | ||
| hints.push(PromptCacheHint { | ||
| provider: "anthropic".to_owned(), | ||
| message_index: Some(0), | ||
| ttl: PromptCacheTtl::Ephemeral, | ||
| placement: CacheMarkerPlacement::SystemPrompt, | ||
| }); |
There was a problem hiding this comment.
Only emit system cache hints for system messages
When the role list has no system message, this still emits a SystemPrompt hint for message_index: 0, and the last-three non-system pass can emit a second Message hint for that same user message. Adapters applying these hints can mark a user turn as the system-prompt cache carrier or attach duplicate cache controls to one message; gate this hint on the first role actually being system, otherwise let index 0 be handled by the message-carrier logic.
Useful? React with 👍 / 👎.
| report.duplicate_ids.len(), | ||
| report.shadowed_rules.len() | ||
| ); | ||
| failed |= !report.parse_errors.is_empty() || !report.duplicate_ids.is_empty(); |
There was a problem hiding this comment.
Fail verification when regex validation fails
In a rules-only verification run, invalid regexes are printed but do not set failed, so tinyjuice verify --rules exits successfully even when verify_rules found patterns the compiler will silently drop. That lets CI/PR checks accept a broken builtin rule set with disabled filters, counters, or output matches; include !report.invalid_regexes.is_empty() in this failure condition.
Useful? React with 👍 / 👎.
|
|
||
| for input in inputs { | ||
| inputs_seen += 1; | ||
| let classification = classify_execution(&input, rules, None); |
There was a problem hiding this comment.
Normalize command-only inputs before discovery classification
Discovery classifies the raw ToolExecutionInput, but runtime reduction first calls normalize_execution_input, so payloads that provide command without argv are misclassified here. For example command: "git status" will be reported as generic/fallback because rules like git/status require argv0/argvIncludes, even though production reduction handles the same input; normalize before classification (and use the normalized input for the discovery key) to avoid misleading rule-coverage reports.
Useful? React with 👍 / 👎.
Summary
API Or Behavior Changes
CompressedOutputexposes separatebodyandrecovery_footerfields while preserving compatibilitytext.CcrStoreimplementations are available for isolated tests and host adapters.Validation
cargo fmt --checkcargo clippy --all-targets -- -D warningscargo testcargo fmt --checkcargo check --libDocumentation
README.md/docs and implementation plans to reflect the implemented TokenJuice/TinyJuice surface without unsupported compression-percentage claims.