Skip to content

Rank the suggested moments against each other before choosing - #159

Merged
nmbrthirteen merged 1 commit into
mainfrom
feat/rank-moments
Aug 21, 2026
Merged

Rank the suggested moments against each other before choosing#159
nmbrthirteen merged 1 commit into
mainfrom
feat/rank-moments

Conversation

@nmbrthirteen

Copy link
Copy Markdown
Owner

What this does

A long episode is searched in three to six timeline buckets, each its own LLM call. Their scores are not comparable: a generous bucket's 17 beats a strict bucket's 15 because the two calls never met. Scores are integer sums of four 1-5 dimensions, so a pool of a dozen candidates is thick with ties, and a tie at the cut line was broken by list position, which systematically favours the opening minutes of the episode.

One transcript-free pass now compares the whole pool at once and writes a 1-based rank. It runs after the audio blend, so a laughter peak is an input to the decision rather than a reshuffle of it, and only when the pool has a surplus to drop. Every failure path falls back to the score ordering that shipped before.

score is left alone. It stays the model's self-reported 0-20 sum, so the CLI's /20 display and the signal blend's +3 ceiling keep their meaning.

This is also the right home for a workspace's published-clip history. What retains on a channel answers "which of these twelve do I keep", not "where do I look", and it was being fetched once per bucket and spent on discovery.

Needs rank_moments registered in podcli-cloud, which is deployed.

Two fixes fall out of it

  • local_prompt replaces the prompt outright rather than merging, so the workspace-learnings block reached only the cloud backend. A Pro subscriber whose chain resolved to local Claude Code or Codex was paying for learnings the model never saw.
  • prompt_block caught CloudError only. A stalled response body raises TimeoutError and a non-JSON 200 raises JSONDecodeError, and either aborted the whole suggestion run. It is now held for the life of the process, keyed on the session token so a workspace switch cannot leak one workspace's learnings into another's prompt.

The CLI called blend_signal_scores and discarded the return value, so laughter detection could not promote a clip into the set on that path. podcli process and the studio now go through one selection path and ship the same clips from the same episode.

How I tested it

npx tsc --noEmit, npx vitest run (262 passing), pytest tests/ (625 passing; the one failure is test_find_cli_falls_back_to_shell_lookup, which fails on a clean checkout of main on any machine with a real claude on PATH).

Ten new tests cover the ranking pass: a tie at the cut line decided by rank, timeline ordering of the result, a partial ranking discarded whole, an unreadable answer, no AI available, a pool with nothing to drop making no call, and the pass being metered under its own purpose. Two more assert the learned block reaches a local CLI and that the free-tier prompt is byte-identical when there is no block.

Checklist

  • npx tsc --noEmit and npm test pass (plus pytest tests/ if you touched the backend)
  • Docs updated if commands or behavior changed
  • No secrets, personal config, or generated output committed

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@nmbrthirteen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Limit details: You’ve used the included review currently available.

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?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5cf1765f-ecac-4d37-8328-c2e6546ee9ec

📥 Commits

Reviewing files that changed from the base of the PR and between d0e3c58 and db03301.

📒 Files selected for processing (8)
  • backend/cli.py
  • backend/main.py
  • backend/services/claude_suggest.py
  • backend/services/podcli_cloud.py
  • src/models/index.ts
  • src/ui/web-server.ts
  • tests/test_ai_fallback.py
  • tests/test_suggest_handler.py

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.

❤️ Share

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

A long episode is searched in three to six timeline buckets, each its own
call. Their scores are not comparable: a generous bucket's 17 beats a
strict bucket's 15 because the two calls never met. Scores are integer
sums of four 1-5 dimensions, so the pool is thick with ties, and a tie at
the cut line was broken by list position, which favours the opening
minutes.

One transcript-free pass now compares the whole pool and writes a rank.
It runs after the audio blend, so a laughter peak is an input rather than
a later reshuffle, and only when there is a surplus to drop. Any failure
falls back to score ordering.

This is also where a workspace's published-clip history belongs. What
retains on a channel says which of twelve candidates to keep, not where
to look for them, and it was being fetched once per bucket and spent on
finding instead of choosing.

Two fixes fall out of it:

- local_prompt replaces the prompt outright, so the learned block reached
  only the cloud backend. A subscriber whose chain resolved to local
  Claude Code or Codex paid for learnings the model never saw.
- prompt_block caught CloudError only. A stalled body raises TimeoutError
  and a non-JSON 200 raises JSONDecodeError, either of which aborted the
  run. It is held for the process now, keyed on the token.

The CLI called blend_signal_scores and dropped the result, so laughter
detection could not promote a clip there. Both entry points go through
one path now and ship the same clips from the same episode.
@nmbrthirteen
nmbrthirteen merged commit 8c917c1 into main Aug 21, 2026
14 checks passed
@nmbrthirteen nmbrthirteen mentioned this pull request Aug 21, 2026
@nmbrthirteen
nmbrthirteen deleted the feat/rank-moments branch August 21, 2026 12:27
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