Skip to content

fix(math): restore priority-based comment routing (regression from #1961)#2611

Merged
jucor merged 1 commit into
edgefrom
spr/edge/ec8e2093
Jul 18, 2026
Merged

fix(math): restore priority-based comment routing (regression from #1961)#2611
jucor merged 1 commit into
edgefrom
spr/edge/ec8e2093

Conversation

@jucor

@jucor jucor commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

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


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-priorities to pass a real boolean to priority-metric via (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.

Comment thread math/src/polismath/math/conversation.clj Outdated
Comment thread math/src/polismath/math/conversation.clj
@jucor
jucor force-pushed the spr/edge/ec8e2093 branch from 49d8503 to b86d4e6 Compare July 17, 2026 02:00
)

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
@jucor
jucor force-pushed the spr/edge/ec8e2093 branch from b86d4e6 to 2cfa2c3 Compare July 17, 2026 16:24
@jucor
jucor merged commit 424dcae into edge Jul 18, 2026
4 checks passed
@jucor
jucor deleted the spr/edge/ec8e2093 branch July 18, 2026 02:53
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.

2 participants