Repository navigation
Keep sidebar metadata cap strictly priority-ordered (#5845 follow-up) - #5879
austinywang wants to merge 12 commits into
Conversation
…ity flood The #5845 status cap gave metadata blocks a just-inserted grace tier intended only for status entries' set_status --pid handoff. On metadata that tier lets a newer low-priority block displace an existing high-priority one at the cap, contradicting priority as the retention signal in sidebarMetadataBlocksInDisplayOrder(). This test fails against that behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…5845) Metadata blocks have no follow-up PID/lifecycle coupling that must survive its own trim (the reason status entries have a just-inserted grace tier), so eviction must rank strictly by priority then timestamp. Drop the grace tier from the metadata trim so a newer low-priority block can no longer displace an existing high-priority one. Follow-up to the #5845 cap (PR #5855), which applied the tier to metadata for symmetry. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR refines metadata block trimming by removing a grace-tier mechanism that retained newly inserted entries, instead relying solely on priority and timestamp ordering. The ChangesMetadata Block Trimming Logic Refinement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (19 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: 1
🤖 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 `@Sources/Workspace.swift`:
- Around line 14542-14543: Update the doc comment that currently reads "priority
is the sole retention signal" to accurately reflect the implementation: change
it to state that "priority is the primary retention signal, with timestamp as
the secondary criterion and dictionary key as the tiebreaker" so it matches the
sorting/eviction logic used in the grace-tier implementation (the code that
sorts by priority first, then timestamp, then dictionary key).
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8c9a2ef7-f1c0-42f7-a8e0-3d6d638b29f2
📒 Files selected for processing (2)
Sources/Workspace.swiftcmuxTests/WorkspaceSidebarObservationTests.swift
…-priority # Conflicts: # Sources/Workspace.swift # cmuxTests/WorkspaceSidebarObservationTests.swift
|
Closing — not pursuing this approach anymore. |
Summary
Follow-up to #5845 / #5855. The sidebar status/metadata cap added a "just-inserted grace tier" so a brand-new status entry survives its own synchronous trim long enough for the
set_status --pidPID-coupling handoff to mark it live. That tier was also applied to the metadata trim for symmetry — but metadata blocks have no such follow-up coupling, so the tier is wrong there: at the 200-block cap, a newer low-priority block displaces an existing high-priority one, contradicting priority as the retention signal defined bysidebarMetadataBlocksInDisplayOrder()and the publicmetadataAPI.(Caught by the
$autoreviewcodex gate after #5855 had already merged.)Fix
Drop the grace tier from
trimSidebarMetadataBlocksIfNeeded(); metadata now evicts strictly by priority then timestamp (storage-key keyed). Status entries keep their grace tier, which they genuinely need.Tests
Two-commit red/green (
cmuxTests/WorkspaceSidebarObservationTests.swift):testMetadataCapRetainsHighPriorityOverNewerLowPriorityFlood— one high-priority block plus a2×capnewer low-priority flood; asserts the high-priority block survives. Fails against the grace-tier behavior onmain.Uses only pre-existing symbols + literals.
🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Keep sidebar metadata eviction strictly priority-ordered and cap both
statusandmetadataat 200 entries. Status trim is tiered, applies grace only toset_status --pid, preserves reserved cmux keys and live-agent statuses, and clears agent runtime on eviction; detached adoption avoids orphan PIDs (including dotted keys).Bug Fixes
WorkspaceSidebarMetadataModel; evict by priority > timestamp > key; no just-inserted tier.remote.error,remote.port_conflicts), live agent-backed (PID or lifecycle), just-inserted PID-handoff keys, then priority/timestamp — so new agent statuses survive their own trim and plain telemetry can’t displace them.recordAgentPIDForSurvivingStatusKey; cap evictions purge PID/ownership/lifecycle state and refresh ports; detached adoption records PID/ownership only if the adopted status survives and skips creating dotted-key orphans.Refactors
Written for commit b871b6f. Summary will update on new commits.
Summary by CodeRabbit