Skip to content

feat: enable SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, TOKEN_BUDGET#140

Merged
claude-code-best merged 2 commits intoclaude-code-best:mainfrom
amDosion:feat/enable-safe-feature-flags
Apr 5, 2026
Merged

feat: enable SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, TOKEN_BUDGET#140
claude-code-best merged 2 commits intoclaude-code-best:mainfrom
amDosion:feat/enable-safe-feature-flags

Conversation

@amDosion
Copy link
Copy Markdown
Contributor

@amDosion amDosion commented Apr 5, 2026

Summary

Enable 3 verified compile-only feature flags in default build/dev configuration:

  • SHOT_STATS — shot distribution statistics in /stats panel (zero external deps)
  • PROMPT_CACHE_BREAK_DETECTION — internal prompt cache key change diagnostics (debug-only visibility)
  • TOKEN_BUDGET+500k / spend 2M tokens syntax for minimum output token targets with live progress bar

Verification Process

  1. Original audit report (docs/feature-flags-audit-complete.md) claimed 22 flags as "COMPLETE"
  2. 6 parallel sub-agents verified actual source code — found only 3 truly compile-only
  3. Independent Codex CLI (v0.118.0, 240K tokens) review confirmed the 3 flags are safe
  4. All code paths verified: no missing dependencies, no crash risk, graceful error handling

Changes

File Change
build.ts Add 3 flags to DEFAULT_BUILD_FEATURES
scripts/dev.ts Add 3 flags to DEFAULT_FEATURES
package.json / bun.lock Add openai dependency (for OpenAI compat layer)
docs/features/feature-flags-audit-complete.md Mark all enabled flags with [build: ON] / [dev: ON]
docs/features/feature-flags-codex-review.md Full Codex review report with corrected classifications

Test Plan

  • bun run build passes (475 files bundled)
  • bun test — zero new test failures (23 pre-existing failures unchanged)
  • SHOT_STATS: verified extractShotCountFromMessages, shotDistribution aggregation, Stats.tsx rendering
  • TOKEN_BUDGET: verified parseTokenBudget, checkTokenBudget auto-continuation loop, Spinner progress bar
  • PROMPT_CACHE_BREAK_DETECTION: verified recordPromptState, checkResponseForCacheBreak, diff file writing with try-catch

Summary by CodeRabbit

  • New Features

    • Enabled SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, and TOKEN_BUDGET in build and dev flows.
  • Documentation

    • Added comprehensive feature-flag audit, a focused codex review of compile-time flags, and a DEV log entry documenting the verification and changes.
  • Chores

    • Updated OpenAI dev dependency version.

…eature flags

Enable 3 verified compile-only feature flags in build.ts and dev.ts defaults:

- SHOT_STATS: local shot distribution statistics in /stats panel
- PROMPT_CACHE_BREAK_DETECTION: internal cache key change diagnostics
- TOKEN_BUDGET: support +500k syntax for minimum output token targets

All 3 flags verified by 6 parallel sub-agents + independent Codex CLI review.
Build passes (475 files), zero new test failures.

Also adds:
- docs/features/feature-flags-codex-review.md: Codex review findings
- Marks all enabled flags in feature-flags-audit-complete.md
- Adds openai dependency (needed for OpenAI compat layer)
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b54d7581-81fb-4606-b0a9-a9d6e725cae7

📥 Commits

Reviewing files that changed from the base of the PR and between 96f6d2c and 5916ecf.

📒 Files selected for processing (1)
  • DEV-LOG.md

📝 Walkthrough

Walkthrough

Adds three compile-time feature flags (SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, TOKEN_BUDGET) to default build/dev configurations, bumps the OpenAI devDependency to ^6.33.0, and introduces comprehensive feature-flag audit documentation (multiple new docs).

Changes

Cohort / File(s) Summary
Build & Dev Configuration
build.ts, scripts/dev.ts
Added SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, and TOKEN_BUDGET to default feature arrays; build.ts also has formatting/style edits (quoting/semicolons) and preserves existing build, patch, and native-addon copy steps.
Documentation (feature-flags audit)
docs/feature-flags-audit-complete.md, docs/features/feature-flags-audit-complete.md, docs/features/feature-flags-codex-review.md, DEV-LOG.md
Added three large audit/review documents and a DEV-LOG entry detailing the audit, classifications, and the decision to enable the three flags; extensive new content only (no code changes).
Dependency
package.json
Bumped devDependencies.openai from ^4.73.0 to ^6.33.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • KonghaYao

Poem

🐰 I hopped through flags of compile-time cheer,

Shot stats, token budgets, and cache-break near,
Docs stacked tall like carrots in a row,
OpenAI bumped for the dev-time show,
A rabbit’s clap — build safely, let features grow!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly identifies the main change: enabling three specific feature flags (SHOT_STATS, PROMPT_CACHE_BREAK_DETECTION, TOKEN_BUDGET) in the build/dev configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Document the SHOT_STATS, TOKEN_BUDGET, PROMPT_CACHE_BREAK_DETECTION
enablement process including verification methodology, Codex review
findings, and key discoveries about audit report accuracy.
@claude-code-best claude-code-best merged commit 2782529 into claude-code-best:main Apr 5, 2026
2 checks passed
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.

2 participants