fix(math): restore priority-based comment routing (regression from #1961)#2611
Merged
Conversation
jucor
added a commit
that referenced
this pull request
Jul 17, 2026
…ce (#2612) Adds delphi/docs/MATH_ALGORITHM_HISTORY.md — a git-archaeology reference of the core Polis math algorithms (comment routing, PCA/projection, extremity/repness, clustering, consensus/moderation): introductions, numeric-output-changing edits, and bugs, with verified commit hashes and dates. Includes the 2025 comment-routing regression (#1961, fixed in #2611), the pre-2018 uniform-random routing history, and how to map conversations to algorithm versions via the prod deploy timeline. Sourced entirely from public git history and code — no production data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> commit-id:31321c47
Contributor
There was a problem hiding this comment.
Pull request overview
Restores the intended priority-weighted comment routing by fixing meta-comment detection in the Clojure math pipeline (preventing all comments from being treated as meta due to Clojure truthiness of 0). This re-enables non-uniform priorities so downstream routing (TS server sampling) behaves as designed.
Changes:
- Fix
:comment-prioritiesto pass a real boolean topriority-metricvia(contains? meta-tids tid). - Document the parity implications and current Python↔Clojure priority mismatch in the Delphi parity planning docs.
- Add an append-only journal entry describing the regression, fix, and discovered parity blocker.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| math/src/polismath/math/conversation.clj | Fixes meta detection for priority computation to prevent all priorities collapsing to 49. |
| delphi/docs/PLAN_DISCREPANCY_FIXES.md | Notes the newly-unmasked D12 parity blocker and cautions against un-mirroring Python yet. |
| delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md | Records the routing regression fix and the discovered non-parity details for future follow-up work. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
) The `:comment-priorities` node passed the meta-tid lookup value `(if meta-tids (get meta-tids tid 0) 0)` into `priority-metric`'s `is-meta` argument. `(get meta-tids tid 0)` returns `0` for non-meta tids, and `0` is TRUTHY in Clojure, so `(if is-meta ...)` took the meta branch for EVERY comment — every priority collapsed to `meta-priority^2 = 49`. The TypeScript server's `selectProbabilistically` then degraded to uniform-random next-comment selection, reverting routing to its pre-2018 behavior. Introduced by #1961 (2025-03-15, "cutoff for large-convo processing if > 5000 comments"), which changed the meta-tid default from `(meta-tids tid)` (nil for non-meta) to `(get meta-tids tid 0)`. Fix: pass a real boolean — `(priority-metric (contains? meta-tids tid) ...)`. `contains?` is false for a non-meta tid and false when `meta-tids` is nil, restoring meta=49 / non-meta=importance*novelty. Verified end-to-end: a math image built with this fix regenerates the vw cold-start blob with varied priorities (125 distinct, 5.16-61.95) instead of all-49. Scope: Clojure only, which is what feeds production routing. The Python port still mirrors the bug (`priority_metric` returns META_PRIORITY**2). Un-mirroring it revealed that Python and Clojure priorities are not yet at parity (rank-uncorrelated on vw), so the Python un-mirror + cold-start blob regeneration is deferred to #2571, pending extremity/PCA parity (D1/D1b). See delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md (2026-07-17). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> commit-id:ec8e2093
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
:comment-prioritiesnode passed the meta-tid lookup value(if meta-tids (get meta-tids tid 0) 0)intopriority-metric'sis-metaargument.
(get meta-tids tid 0)returns0for non-meta tids, and0isTRUTHY in Clojure, so
(if is-meta ...)took the meta branch for EVERYcomment — every priority collapsed to
meta-priority^2 = 49. The TypeScriptserver's
selectProbabilisticallythen degraded to uniform-random next-commentselection, reverting routing to its pre-2018 behavior.
Introduced by #1961 (2025-03-15, "cutoff for large-convo processing if
Fix: pass a real boolean —
(priority-metric (contains? meta-tids tid) ...).contains?is false for a non-meta tid and false whenmeta-tidsis nil,restoring meta=49 / non-meta=importance*novelty.
Verified end-to-end: a math image built with this fix regenerates the vw
cold-start blob with varied priorities (125 distinct, 5.16-61.95) instead of
all-49.
Scope: Clojure only, which is what feeds production routing. The Python port
still mirrors the bug (
priority_metricreturns META_PRIORITY**2). Un-mirroringit revealed that Python and Clojure priorities are not yet at parity
(rank-uncorrelated on vw), so the Python un-mirror + cold-start blob
regeneration is deferred to #2571, pending extremity/PCA parity (D1/D1b).
See delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md (2026-07-17).
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
commit-id:ec8e2093
Stack: