Fix #290: discover harness instruction chains for overhead - #534
Fix #290: discover harness instruction chains for overhead#534willwashburn wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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 Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe overhead system now discovers active Claude Code, Codex, and OpenCode instruction chains. It records user, ancestor, and project scopes, supports configurable harness homes, enforces discovery rules, and exposes scope data through the SDK, CLI, and Node API. ChangesHarness-aware overhead discovery
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant LedgerHandle
participant gather_overhead
participant find_overhead_files
participant InstructionFiles
CLI->>LedgerHandle: overhead or overhead_trim with harness_home
LedgerHandle->>gather_overhead: forward options
gather_overhead->>find_overhead_files: discover active instruction chains
find_overhead_files->>InstructionFiles: resolve, order, deduplicate, and limit files
InstructionFiles-->>gather_overhead: scoped overhead files
gather_overhead-->>LedgerHandle: scoped summaries or trim recommendations
LedgerHandle-->>CLI: render scope and overhead data
Poem
🚥 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/relayburn-sdk/src/analyze/overhead.rs (1)
454-463: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider tolerating read failures for individual discovered files.
Discovery now returns user-home and ancestor files.
load_overhead_filepropagates anyio::Error, andgather_overheadincrates/relayburn-sdk/src/query_verbs/overhead.rs(lines 170-173) uses?. If one discovered file is deleted or becomes unreadable between discovery and load, the wholeoverheadandoverhead trimcall fails. Skipping the affected file keeps the report usable.🤖 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/relayburn-sdk/src/analyze/overhead.rs` around lines 454 - 463, Update gather_overhead to tolerate per-file I/O failures from load_overhead_file: skip files whose loading fails, including files deleted or unreadable after discovery, while continuing to process the remaining discovered files. Preserve successful parsing and the existing report behavior, and avoid propagating an individual load error through the overall overhead and overhead trim commands.
🤖 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/relayburn-sdk/src/query_verbs/overhead.rs`:
- Around line 14-16: Add a public configuration option alongside harness_home to
bound Claude ancestor discovery, and have DiscoveryRoots::for_harness_home pass
it to find_overhead_files_with_roots instead of leaving claude_ancestor_stop
unset. Update crates/relayburn-sdk/src/query_verbs/overhead.rs#L14-L16 to
document the behavior, then update the fixture assertions in
crates/relayburn-sdk/src/query_verbs/tests.rs#L908-L908 and
crates/relayburn-sdk/tests/integration.rs#L197-L197 (including assertions at
lines 197, 206, 216, and 225) to use the bound or filter results to created
fixture paths.
In `@packages/sdk-node/CHANGELOG.md`:
- Line 5: Update the changelog bullet to name both public APIs, overhead() and
overheadTrim(), and describe their practical effects: discovering and labeling
instruction-chain files by scope, and including scope in trim recommendations
while supporting the harness-home option.
In `@packages/sdk-node/src/index.d.ts`:
- Around line 230-233: Update the OverheadTrimOptions interface to declare the
optional harnessHome string property, matching the Rust overhead_trim binding
and the existing OverheadOptions API so TypeScript callers can configure the
harness home for trim operations.
---
Nitpick comments:
In `@crates/relayburn-sdk/src/analyze/overhead.rs`:
- Around line 454-463: Update gather_overhead to tolerate per-file I/O failures
from load_overhead_file: skip files whose loading fails, including files deleted
or unreadable after discovery, while continuing to process the remaining
discovered files. Preserve successful parsing and the existing report behavior,
and avoid propagating an individual load error through the overall overhead and
overhead trim commands.
🪄 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: fb93264d-cf2f-411a-9871-371cb52c21cf
📒 Files selected for processing (14)
CHANGELOG.mdcrates/relayburn-cli/src/commands/overhead.rscrates/relayburn-sdk-node/src/lib.rscrates/relayburn-sdk/src/analyze.rscrates/relayburn-sdk/src/analyze/overhead.rscrates/relayburn-sdk/src/lib.rscrates/relayburn-sdk/src/query_verbs/mod.rscrates/relayburn-sdk/src/query_verbs/overhead.rscrates/relayburn-sdk/src/query_verbs/tests.rscrates/relayburn-sdk/tests/integration.rspackages/mcp/CHANGELOG.mdpackages/relayburn/CHANGELOG.mdpackages/sdk-node/CHANGELOG.mdpackages/sdk-node/src/index.d.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b68dfc46b7
ℹ️ 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".
|
Review follow-up at ddba562:
All four inline threads have concrete dispositions and are resolved. |
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/relayburn-sdk/src/analyze/overhead.rs">
<violation number="1" location="crates/relayburn-sdk/src/analyze/overhead.rs:178">
P2: A malformed UTF-8 instruction file makes `burn overhead` fail instead of being skipped as unreadable. Discovery should validate UTF-8 before returning the row, or loading should consistently use the lossy parser.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Fixes #290
burn overheadnow discovers the default instruction files each supported harness actually injects, instead of checking three fixed paths beneath the requested project directory.Harness evidence and discovery rules
~/.claude/CLAUDE.md;CLAUDE.mdandCLAUDE.local.mdfrom filesystem root through the requested CWD;.claude/CLAUDE.mdat the Git root (or requested CWD without a Git marker)codex-rs/core/src/agents_md.rs$CODEX_HOME/AGENTS.override.mdorAGENTS.md; one project instruction per directory from Git root through CWD, with override precedence and the default aggregate 32 KiB byte budgetpackages/opencode/src/session/instruction.ts/FSUtil.findUpAGENTS.md, then Claude-compatibleCLAUDE.md) from Git root through CWDDiscovery is deterministic, labels every row as
user,ancestor, orproject, and merges same-kind physical aliases by device/inode or canonical identity. Missing, empty, and unreadable files do not create overhead rows.On-demand descendant files are deliberately not scanned recursively: Claude Code and OpenCode inject them only after accessing that directory, while this filesystem-only discovery surface has no per-session activation evidence. Config-dependent fallback names, custom instruction globs/URLs, managed policy/rules/imports, and compatibility-disable flags remain conservative undercounts rather than speculative cost.
The Rust SDK and Node facade accept an optional
harnessHomeoverride for hermetic embedding and tests. Scope is included in Rust/Node/CLI/MCP result shapes and trim recommendations, and the CLI human output displays it.Verification
cargo fmt --all -- --checkcargo test --workspacecargo clippy --workspace --all-targets -- -D warningspnpm run test🤖 Generated with Claude Code.