Skip to content

Bound compacted usage candidate scans - #1167

Merged
KeenWill merged 1360 commits into
agent/daemon-live-compaction-usage-suffix-fast-pathfrom
agent/daemon-live-compaction-candidate-bound
Aug 26, 2026
Merged

Bound compacted usage candidate scans#1167
KeenWill merged 1360 commits into
agent/daemon-live-compaction-usage-suffix-fast-pathfrom
agent/daemon-live-compaction-candidate-bound

Conversation

@KeenWill

Copy link
Copy Markdown
Owner

Summary

  • discard ordinary usage candidates at or before the latest context-compaction call before proving summary membership
  • preserve the existing exact membership check for every newer candidate, including independently assembled frontiers
  • preserve the existing final newest-call ordering and compacted-frontier fallback

Calls at or before the compaction cannot win that ordering. On the same live session, the candidate-selection plan dropped from 1,075 recursive membership expansions, 9.0 million shared-buffer hits, and 5.3 seconds to nine expansions, 152k hits, and 0.51 seconds.

Meaningfully changed lines (excluding lockfiles): 7.

Validation

  • formatting, package check, warning-denied Clippy, and package tests
  • exact PostgreSQL compaction-usage integration test
  • read-only production-shaped EXPLAIN (ANALYZE, BUFFERS) before and after
  • exact release deployed to dogfood; clean drain/startup, socket and browser listener healthy

Known ignored check: Web search live smoke (provider credits).

Numeric bounds

This slice adds or changes no numeric-bound ceiling.

Stack reconstruction ledger

Copilot AI lite review requested due to automatic review settings August 23, 2026 11:04
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e148b702-b182-4df3-9140-cc80b9aad00e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Your free Security trial is over. An organization admin can activate billing to continue.


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

@KeenWill

Copy link
Copy Markdown
Owner Author

@codex review

Exact head: ed22eba

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Rust coverage (report only)

Report only. This measurement has no threshold, gates no merge, and
fails no check; it exists so untested code stays visible.

Measured suite Outcome
workspace (--all-targets --all-features) failure
persistence PostgreSQL (--ignored) success
signalboxd PostgreSQL (--ignored) failure
terminal-client PostgreSQL (--ignored) success
What this number does not measure
  • Doctests. cargo llvm-cov --doctests needs a nightly
    toolchain; this workspace pins stable, so the compile-fail
    sealing proofs and every other doctest are outside the
    denominator.
  • Live smokes, which spend real network requests or
    credentials and are never run here: the tools-github and
    tools-web smokes stay --ignored, and the whole-daemon and
    real-provider terminal smokes are skipped by name above.
  • The Swift native client, which Xcode measures separately.
  • One environment-clearing test in signalbox-tools-exec,
    which instrumenting its supervisor process perturbs. The
    workflow comment on the workspace step states why; rust.yml
    runs that test uninstrumented and gates on it.
  • Dedicated test files. cargo-llvm-cov excludes tests/
    and benches/ targets and *tests.rs modules from the
    report by default, so that test code is counted neither
    covered nor uncovered here. Inline #[cfg(test)] modules
    inside a source file are the exception: they are
    instrumented, and they land on both sides. A test body
    that ran counts as covered, which makes every percentage
    below optimistic; the body of an #[ignore]d test no
    measured suite runs counts as uncovered, which puts test
    lines into the file ranking. Read both tables as close,
    not exact.
Measure Covered Total Percent
Lines 96503 249106 38.74%
Functions 7718 20848 37.02%
Regions 108747 314277 34.60%

Per crate, least-covered first

Crate Line % Lines Function % Region %
crates/blob-store-filesystem 0.00% 0/1311 0.00% 0.00%
crates/egress-transport 0.00% 0/132 0.00% 0.00%
crates/model-runtime-claude-cli 0.00% 0/1868 0.00% 0.00%
crates/model-runtime-codex-cli 0.00% 0/1738 0.00% 0.00%
crates/model-runtime-openai 0.00% 0/1799 0.00% 0.00%
crates/runner-wire 0.00% 0/1066 0.00% 0.00%
crates/tool-contract 0.00% 0/575 0.00% 0.00%
crates/tools-basic 0.00% 0/449 0.00% 0.00%
crates/tools-code-host 0.00% 0/5027 0.00% 0.00%
crates/tools-conversations 0.00% 0/612 0.00% 0.00%
crates/tools-exec 0.00% 0/3039 0.00% 0.00%
crates/tools-git 0.00% 0/9303 0.00% 0.00%
crates/tools-github 0.00% 0/1929 0.00% 0.00%
crates/tools-sessions 0.00% 0/581 0.00% 0.00%
crates/tools-workspace 0.00% 0/2249 0.00% 0.00%
crates/web-contract 0.00% 0/380 0.00% 0.00%
crates/tools-web 0.34% 8/2363 0.77% 0.19%
crates/model-runtime-anthropic 0.63% 12/1915 1.87% 0.61%
crates/model-runtime 3.87% 193/4992 5.83% 2.23%
apps/signalboxd 9.74% 6109/62721 8.60% 8.70%
apps/client 22.43% 3978/17734 31.43% 21.13%
crates/model-provider-runtime 30.61% 502/1640 34.38% 29.04%
crates/tools-plan 32.03% 287/896 47.01% 25.12%
crates/blob-store 33.33% 64/192 32.43% 42.67%
crates/conversation-import-codex 36.19% 245/677 23.91% 36.65%
crates/process-protocol 36.83% 1222/3318 40.97% 34.65%
crates/application 43.99% 4948/11248 52.80% 41.39%
crates/tool-schema-derive 45.74% 172/376 60.00% 48.22%
crates/conversation-import-claude-code 50.57% 221/437 34.55% 49.85%
crates/expect-table 56.09% 373/665 71.43% 56.62%
crates/domain 68.01% 21812/32074 70.29% 71.32%
crates/persistence 74.34% 56172/75565 69.54% 69.11%
crates/conversation-import-json 78.12% 175/224 89.47% 75.41%
crates/test-bin 90.91% 10/11 100.00% 70.00%

25 files with the most uncovered lines

File Uncovered lines Line %
apps/signalboxd/src/process_runtime.rs 10747 27.50%
apps/signalboxd/src/repo_watch_runtime.rs 9376 0.00%
apps/client/src/lib.rs 6986 18.82%
apps/signalboxd/src/daemon_tools.rs 5706 0.00%
apps/signalboxd/src/configuration.rs 5246 12.22%
apps/signalboxd/src/runner_protocol_runtime.rs 3390 0.00%
apps/client/src/presentation.rs 3104 22.82%
apps/signalboxd/src/main.rs 2792 0.00%
apps/signalboxd/src/lib.rs 2506 15.54%
crates/model-runtime/src/cli_redaction.rs 2457 0.00%
crates/tools-code-host/src/code_host/github.rs 2390 0.00%
crates/persistence/src/submit_input.rs 2357 70.22%
crates/tools-exec/src/process.rs 2262 0.00%
crates/process-protocol/src/lib.rs 2096 36.83%
apps/client/src/arguments.rs 1931 12.51%
crates/tools-github/src/lib.rs 1929 0.00%
apps/signalboxd/src/convergence_sweep_runtime.rs 1813 0.00%
crates/domain/src/turn_eligibility.rs 1658 70.39%
crates/persistence/src/model_execution.rs 1554 82.60%
crates/persistence/src/mapping.rs 1522 42.44%
apps/signalboxd/src/review_orchestration_runtime.rs 1368 0.00%
apps/signalboxd/src/telemetry.rs 1318 0.00%
crates/blob-store-filesystem/src/lib.rs 1311 0.00%
crates/tools-git/src/executor.rs 1294 0.00%
apps/signalboxd/src/web_http.rs 1217 0.00%

Measured at 1db375b1e6a83389232159f6d8ece02d7ecf41ec, the merge commit this pull request builds, whose head is 25b7717d6337e7fada5dc585293f2e8292d536a7, by run 32928866985, which uploads the HTML report and LCOV as an artifact.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.22%. Comparing base (89b1075) to head (ed22eba).

Additional details and impacted files
Flag Coverage Δ
rust 82.80% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

claude and others added 14 commits August 24, 2026 11:55
…mmit

The retained-tool-content ceiling changes what the page states as implemented
behavior, so the page's verified-against reference advances to the commit that
implements it, per the pre-push self-review rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
Re-verify the container start-site inventory the previous wave invalidated:
the convergence sweep runtime added a marked testcontainers start, so the
tooling count moves from 40 to 41. That count is what turned CI red.

202608210400 through 202608210404 all land in this unmerged slice, so no
database has held an inactivity park without the parked-dispatch columns.
Drop the backfill UPDATE and the NOT VALID arm: both were data-upgrade
scaffolding for a schema that was never deployed, and the schema now asserts
unconditionally that every inactivity park carries a dispatch identity.

Revalidate the complete paginated connections after the final details fence
rather than before it. The fence compares only the initial pages, refs, and
page information, so a thread or check on a later page could previously change
after its own reread but before the fence and be accepted from a census the
provider had already invalidated.

Unroll the parked-target and capped-backoff test setups onto named helpers so
each transition is inspected at its own call site.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
…spatch-start-lease

# Conflicts:
#	crates/persistence/tests/repo_watch_dispatch_postgres.rs
#	docs/spec/repo-watch.md
`cargo fmt --all --check` reported a diff in `model_execution.rs`: the
`projected_tool_content_bytes` fold and its test-side counterpart were
written with the receiver on its own line, which rustfmt collapses onto the
`fold` call. Formatting only -- no behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
`mdformat --check *.md docs/` reported `docs/spec/persistence-protocol.md`
unformatted: the paragraph describing the recovery lap's page bound was
wrapped by hand, leaving an em dash starting a line and a short final line
that mdformat's wrap=80 rejoins. Reflowed by the pinned toolchain in
`tooling/requirements-mdformat.txt`; prose unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
… wf-pr-1084

# Conflicts:
#	clients/web/e2e/product-shell.spec.ts
#	clients/web/src/ProductApp.tsx
#	clients/web/src/commands.ts
#	clients/web/src/preferences.test.ts
#	clients/web/src/preferences.ts
#	clients/web/src/product.test.ts
#	clients/web/src/product.ts
#	clients/web/src/session-timeline/model.ts
#	clients/web/src/state.ts
`mdformat --check *.md docs/` reported `docs/spec/tool-loop.md` unformatted:
the verification reference this branch extended and the retained-tool-content
paragraph it added were hand-wrapped past the 80-column bound `.mdformat.toml`
sets. Reflowed by the pinned toolchain; prose unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
`Bound each supersession cursor lap` rewrote
`AUTOMATIC_MODEL_CALL_RECONCILIATION_SUPERSESSION` in
`crates/persistence/src/lock_inventory.rs` -- adding the materialized bounds
CTE and its high-water mark -- but left the pinned checksum at the value an
earlier commit in this branch recorded, so the gate that makes changes to the
reviewed inventory explicit failed on its own branch.

Pin the checksum to the inventory this branch actually carries. The scan for
strongest-mode row locks outside the inventory is unchanged and still finds
none.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
`reconcile` opens a transaction that takes the delegated child endpoint
locks and then the inventoried strongest-mode `session_scheduler` row
lock, both unqualified, without a server-side `lock_timeout`. Its two
siblings both set one: `claim_due` binds `CLAIM_LOCK_WAIT`, and
`recover_running_candidate` binds `CANDIDATE_RECOVERY_LOCK_WAIT` through
`bound_candidate_recovery_lock_wait`.

The attempt runs under a client-side timeout in the daemon watchdog, but
dropping that future queues a `ROLLBACK` rather than sending a
`CancelRequest`: the backend keeps waiting for the lock and the pooled
connection stays checked out for the full real wait while the caller has
already given up and will retry. That is exactly the mechanism the
`bound_candidate_recovery_lock_wait` doc comment records — contention
turned into connection exhaustion — and this transaction now runs under
live traffic where it once contended with nothing.

Set the transaction-local `lock_timeout` before the first lock is taken,
at the siblings' budget. The wait then ends as `55P03`, which this
repository already records as an ordinary infrastructure failure spent
against the attempt budget, with nothing read or written; the statement
can only interrupt a lock wait, never a commit.

The new integration test holds the scheduler row and asserts the attempt
gives it up as `55P03`, leaves the turn parked and the recovery row
`attempting`, and reconciles on retry once the contention clears.
Without the fix it blocks past a 30s client bound.

The inventoried SQL is unchanged, so the explicit-lock inventory
checksum stands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jz817TssAaL2SzfthXwAP6
The dismissal path could not run. fetch_convergence_evidence reports
gating_check_inventory_quiesced as a conservative default, and the
polling path replaces it with the verdict computed against the freshness
the last committed cursor published. The clearance revalidation never
did, so its assessment was always unsettled, the candidate lookup
short-circuited before its provider request, and dismiss_review_node was
unreachable. The in-code comment asserting "Clearance candidacy does not
consult it" was wrong in both halves: candidacy does consult settlement,
and refuses every unsettled head.

The revalidation now applies the same rule through the same helper. The
two observations it compares are the committed poll that raised the
candidate and this pre-dismissal re-read, so a gating check that appeared
in between leaves the head unsettled and the review undismissed until a
later poll sees the inventory hold still. PullResponse gained the
updated_at the listing already carried, since the comparison is against
what a committed poll recorded from that listing. Freshness is now
published immediately after the cursor commit rather than at the end of
the sweep: the cursor is durable at that point, and a publication the
clearance sweep never reached would leave every candidate unsettled. A
failed attempt still invalidates every entry on its way out.

Fixing that activates a second hole, so both land together. The candidate
rule never checked gating_check_count, so a head that ran no gating check
at all — whose empty non-green list is indistinguishable from a fully
green head's, and which the reference convergence rule therefore counts
as blocked — was admissible. With the revalidation repaired, the daemon
would have dismissed blocking reviews on pull requests with zero green
checks. The candidate predicate, the poller's mirror of it, and the
durable eligibility query now all require a positive count, matching
RepoWatchConvergenceAssessment::try_new.

Tests: a quiesced inventory carries a planned clearance through to its
dismissal, an inventory that grew since the committed poll refuses it, a
zero-check assessment yields no candidate, and the durable query plans
nothing for a recorded assessment without a gating check while still
planning for one with it. RepoWatchPlannedStaleReviewClearance gained a
test-support constructor so the revalidation is testable without a store.
@KeenWill
KeenWill deployed to claude-smoke August 26, 2026 04:05 — with GitHub Actions Active
@KeenWill
KeenWill deployed to anthropic-smoke August 26, 2026 04:05 — with GitHub Actions Active
@KeenWill
KeenWill deployed to claude-smoke August 26, 2026 04:05 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Native client coverage (report only)

Report only. This measurement has no threshold, gates no merge, and
fails no check; it exists so untested code stays visible.

61.50% of product lines covered (14544/23649).

The .xctest bundles Xcode also measures are excluded from that total:
counting them would measure how thoroughly the tests run themselves.
Excluded here: SignalboxAppTests.xctest, SignalboxClientTests.xctest, SignalboxModelsTests.xctest, SignalboxNativeTests.xctest, SignalboxNativeUITests.xctest.

Product target Line % Lines
SignalboxNative.app 61.50% 14544/23649

30 files with the most uncovered lines

File Uncovered lines Line %
clients/native/Sources/SignalboxApp/ProcessViews.swift 2070 48.00%
clients/native/Sources/SignalboxApp/TimelineViews.swift 1230 0.00%
clients/native/Sources/SignalboxApp/SessionsView.swift 968 0.00%
clients/native/Sources/SignalboxApp/OperationsViews.swift 765 0.00%
clients/native/Sources/SignalboxModels/ProcessProtocol.swift 639 82.81%
clients/native/Sources/SignalboxApp/SessionDetailView.swift 586 0.00%
clients/native/Sources/SignalboxClient/ProcessService.swift 370 79.54%
clients/native/Sources/SignalboxApp/ViewModels.swift 307 66.52%
clients/native/Sources/SignalboxClient/ProcessProtocolClient.swift 245 43.29%
clients/native/Sources/SignalboxModels/EventNormalizer.swift 225 86.29%
clients/native/Sources/SignalboxApp/ArtifactPreviewView.swift 209 0.00%
clients/native/Sources/SignalboxApp/SettingsView.swift 193 0.52%
clients/native/Sources/SignalboxModels/SignalboxEvents.swift 170 48.17%
clients/native/Sources/SignalboxClient/SessionSynchronization.swift 161 90.67%
clients/native/Sources/SignalboxClient/ProcessTranscriptProjector.swift 138 93.07%
clients/native/Sources/SignalboxApp/Components.swift 123 0.00%
clients/native/Sources/SignalboxApp/RootView.swift 116 35.56%
clients/native/Sources/SignalboxClient/SessionSynchronizationDriver.swift 111 67.64%
clients/native/Sources/SignalboxModels/SignalboxResponses.swift 82 27.43%
clients/native/Sources/SignalboxApp/MockProcessProtocolHarness.swift 79 90.88%
clients/native/Sources/SignalboxModels/ProcessPresentation.swift 74 86.27%
clients/native/Sources/SignalboxModels/SignalboxModels.swift 64 67.51%
clients/native/Sources/SignalboxApp/ProcessAppSupport.swift 44 63.03%
clients/native/Sources/SignalboxApp/MockSignalboxService.swift 35 72.22%
clients/native/Sources/SignalboxModels/JSONValue.swift 23 84.97%
clients/native/Sources/SignalboxApp/MockSignalboxFixtures.swift 20 69.23%
clients/native/Sources/SignalboxClient/LegacySignalboxClientProtocol.swift 19 53.66%
clients/native/Sources/SignalboxApp/SignalboxNativeApp.swift 15 82.95%
clients/native/Sources/SignalboxApp/TemplatePresentation.swift 10 80.39%
clients/native/Sources/SignalboxApp/ArtifactPresentation.swift 7 89.55%

Measured at 1db375b1e6a83389232159f6d8ece02d7ecf41ec, the merge commit this pull request builds, whose head is 25b7717d6337e7fada5dc585293f2e8292d536a7, by run 32928866930, which uploads the xccov JSON, text, and Markdown reports as an artifact.

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.

4 participants