Skip to content

perf(daemon): drain the session derivation audit by work, not by tick - #5697

Merged
Sinity merged 4 commits into
masterfrom
claude/perf-profile-backlog
Sep 28, 2026
Merged

Sinity merged 4 commits into
masterfrom
claude/perf-profile-backlog

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

After a cold build promotes, the session derivation audit (summary, usage rollup, profile) now runs bounded passes back to back within a 45 s budget per periodic tick. Before, it ran one pass per tick.

Problem (evidence)

I ran a fresh-build benchmark: a 144-file private sample, cold-built through polylogued run --cold-build-index, measured with devtools bench fresh-build (#5678). The session derivations published in bursts of at most 64 keys a minute. Each audit pass is bounded at 128 discovered and 64 published keys per domain, and _periodic_convergence_check ran one pass per 60 s tick. Profiles for 148 sessions finished 312 s after promotion, while the writer sat idle between bursts. At full-archive scale that is one minute per 64 sessions per domain.

Solution

ComposedSessionProfiles.converge_backlog(budget_s) repeats the bounded pass while the audit still has domains to sweep, within the budget. The periodic convergence check calls it with 45 s. Every pass keeps its page and publication bounds, so no writer hold grows. The ordinary callback(None) is still one bounded pass.

Verification

  • devtools test tests/unit/daemon/test_session_profile_composition.py "tests/unit/daemon/test_daemon_cli.py::test_daemon_startup_catch_up_and_restart_repair_session_profiles": PASSED.
  • New test test_backlog_call_sweeps_every_domain_in_bounded_passes: one backlog call publishes a profile for every session (more than 129) over several passes of at most 64 each. Anti-vacuity: a single pass leaves the audit pending with fewer profiles than sessions.
  • Benchmark, same corpus: the last session-profile publication came 312 s after promotion before this change and 59 s after with it. The usage rollup went from 89 s to 29 s.

Residuals

cli.py and session_profile_composition.py are outside the derived schema-identity closure.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

After a cold build promotes, the session summary, usage-rollup and
profile domains are swept by bounded audit passes (128 discovered, 64
published). The periodic convergence tick ran one pass per 60 s, so the
derived phase advanced 64 sessions per domain per minute regardless of
free writer or compute time. Run passes back to back within a 45 s
budget while the audit has domains left; every pass keeps its bounds.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@chatgpt-codex-connector

Copy link
Copy Markdown

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T00:43:58.553677Z 1b7f558 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcaf55b9f1

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14825db7d0

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f50d71348

ℹ️ 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".

Budget gains deadline_at, a monotonic instant the kernel checks beside
the relative deadline, so time a pass spends waiting for the owner lock
or a compute worker is spent from the tick's budget.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@Sinity
Sinity merged commit f7ecf8a into master Sep 28, 2026
3 checks passed
@Sinity
Sinity deleted the claude/perf-profile-backlog branch September 28, 2026 00:57
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.

1 participant