{"messages":[{"content":"You are a constitutional council ranking individual git commits for ownership allocation.\n\nCompare these two commits. Decide which contributed more lasting value to the project.\n\nJudge substance, not spectacle:\n- Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise.\n- Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one.\n- Do not favor a side merely because its patch is longer or noisier.\n- Weight what the change does for the project, not the contributor's name.\n\nReturn ONLY a JSON object: {\"winner\": \"A\" or \"B\", \"ratio\": \"N:M\", \"explanation\": \"...\"}\nThe explanation must cite concrete differences in the patches (1-3 sentences).\n\nSide A — contributor: tommy-mor\nSide A — commit message:\n[8f69c309] Require Reddit OAuth when credentials are set and refresh on 401/403.\n\nAvoid falling back to the public www.reddit.com API from cloud IPs, which\nreturns Reddit's network-security block page. Also pin SORTER2_BASE_URL in fly.toml.\n\nCo-authored-by: Cursor \n\nSide A — unified diff (full patch):\ndiff --git a/fly.toml b/fly.toml\nindex f0c6a39f643c204987debc177234d95a8ef44b65..ca7e0088a7efd7d58d29d808f8d89080b2bff233 100644\n--- a/fly.toml\n+++ b/fly.toml\n@@ -5,6 +5,7 @@ primary_region = \"iad\"\n dockerfile = \"Dockerfile\"\n \n [env]\n+ SORTER2_BASE_URL = \"https://reddit.sorter.social\"\n SORTER2_DATA_DIR = \"/data\"\n SORTER2_EVENT_LOG = \"/data/events.jsonl\"\n PORT = \"8080\"\ndiff --git a/server/src/reddit.rs b/server/src/reddit.rs\nindex a874814f8927192ee62cab2d0db1efd27dcd57b7..f409764c1e1f36216f1b08107043c2eab905694c 100644\n--- a/server/src/reddit.rs\n+++ b/server/src/reddit.rs\n@@ -283,26 +283,35 @@ async fn reddit_worker(\n );\n tokio::time::sleep(current_delay).await;\n \n- if let Some(c) = &creds {\n- oauth = ensure_oauth_token(&client, &oauth_token_base, c, oauth.take()).await;\n- }\n-\n- let token = oauth.as_ref().map(|t| t.access_token.as_str());\n- let fetch_base = if token.is_some() {\n- tracing::debug!(\n- item = %fetch_id,\n- base = %oauth_api_base,\n- \"reddit fetch using OAuth bearer\"\n- );\n- &oauth_api_base\n- } else {\n- &api_base\n- };\n- let url = match kind {\n- FetchKind::SelfEntity => map_item_to_reddit_api(&fetch_id, fetch_base),\n- FetchKind::Children => map_children_url(&fetch_id, fetch_base),\n+ let outcome = match &creds {\n+ Some(c) => {\n+ // OAuth is required when credentials are configured — never fall\n+ // back to the public www.reddit.com JSON endpoints (cloud IPs\n+ // get blocked with a 403 HTML interstitial).\n+ fetch_with_oauth(\n+ &client,\n+ &oauth_token_base,\n+ &oauth_api_base,\n+ c,\n+ &mut oauth,\n+ &fetch_id,\n+ kind,\n+ )\n+ .await\n+ }\n+ None => {\n+ let url = match kind {\n+ FetchKind::SelfEntity => map_item_to_reddit_api(&fetch_id, &api_base),\n+ FetchKind::Children => map_children_url(&fetch_id, &api_base),\n+ };\n+ match do_fetch(&client, &url, &fetch_id, None).await {\n+ Ok(FetchOutcome::AuthRejected { status, detail }) => {\n+ Err(format!(\"Reddit API {status}: {detail}\"))\n+ }\n+ other => other,\n+ }\n+ }\n };\n- let outcome = do_fetch(&client, &url, &fetch_id, token).await;\n \n match outcome {\n Ok(FetchOutcome::Payload(payload)) => {\n@@ -342,6 +351,12 @@ async fn reddit_worker(\n current_delay = (current_delay * 2).min(Duration::from_secs(60));\n notify(done, FetchJobResult::RateLimited { reset_secs });\n }\n+ Ok(FetchOutcome::AuthRejected { status, detail }) => {\n+ let e = format!(\"Reddit API {status}: {detail}\");\n+ tracing::warn!(item = %fetch_id, err = %e, \"reddit fetch auth rejected\");\n+ current_delay = (current_delay * 2).min(Duration::from_secs(60));\n+ notify(done, FetchJobResult::Failed(e));\n+ }\n Err(e) => {\n tracing::warn!(item = %fetch_id, err = %e, \"reddit fetch failed\");\n current_delay = (current_delay * 2).min(Duration::from_secs(60));\n@@ -357,6 +372,60 @@ enum FetchOutcome {\n Payload(Value),\n NotFound,\n RateLimited { reset_secs: u64 },\n+ /// Bearer rejected — caller should drop the cached token and retry once.\n+ AuthRejected { status: StatusCode, detail: String },\n+}\n+\n+async fn fetch_with_oauth(\n+ client: &Client,\n+ oauth_token_base: &str,\n+ oauth_api_base: &str,\n+ creds: &RedditCredentials,\n+ oauth: &mut Option,\n+ fetch_id: &ItemId,\n+ kind: FetchKind,\n+) -> Result {\n+ for attempt in 0..2 {\n+ let force_refresh = attempt > 0;\n+ *oauth = Some(\n+ ensure_oauth_token(client, oauth_token_base, creds, oauth.take(), force_refresh)\n+ .await?,\n+ );\n+ let token = oauth\n+ .as_ref()\n+ .expect(\"token set above\")\n+ .access_token\n+ .clone();\n+\n+ tracing::debug!(\n+ item = %fetch_id,\n+ base = %oauth_api_base,\n+ attempt,\n+ \"reddit fetch using OAuth bearer\"\n+ );\n+\n+ let url = match kind {\n+ FetchKind::SelfEntity => map_item_to_reddit_api(fetch_id, oauth_api_base),\n+ FetchKind::Children => map_children_url(fetch_id, oauth_api_base),\n+ };\n+ match do_fetch(client, &url, fetch_id, Some(&token)).await? {\n+ FetchOutcome::AuthRejected { status, detail } if attempt == 0 => {\n+ tracing::warn!(\n+ item = %fetch_id,\n+ %status,\n+ %detail,\n+ \"reddit OAuth rejected; refreshing token and retrying\"\n+ );\n+ *oauth = None;\n+ continue;\n+ }\n+ FetchOutcome::AuthRejected { status, detail } => {\n+ return Err(format!(\"Reddit API {status}: {detail}\"));\n+ }\n+ other => return Ok(other),\n+ }\n+ }\n+ unreachable!(\"loop always returns\")\n }\n \n async fn ensure_oauth_token(\n@@ -364,35 +433,35 @@ async fn ensure_oauth_token(\n oauth_base: &str,\n creds: &RedditCredentials,\n existing: Option,\n-) -> Option {\n- if let Some(t) = existing {\n- if Instant::now() < t.expires_at - Duration::from_secs(60) {\n- tracing::debug!(\"reddit OAuth token still valid\");\n- return Some(t);\n+ force_refresh: bool,\n+) -> Result {\n+ if !force_refresh {\n+ if let Some(t) = existing {\n+ if Instant::now() < t.expires_at - Duration::from_secs(60) {\n+ tracing::debug!(\"reddit OAuth token still valid\");\n+ return Ok(t);\n+ }\n }\n }\n \n let url = format!(\"{}/api/v1/access_token\", oauth_base.trim_end_matches('/'));\n- tracing::debug!(%url, \"reddit OAuth token request\");\n+ tracing::debug!(%url, force_refresh, \"reddit OAuth token request\");\n \n let resp = client\n .post(&url)\n .basic_auth(&creds.client_id, Some(&creds.client_secret))\n .form(&[(\"grant_type\", \"client_credentials\")])\n .send()\n- .await;\n-\n- let resp = match resp {\n- Ok(r) => r,\n- Err(e) => {\n- tracing::warn!(\"reddit OAuth token request failed: {e}\");\n- return None;\n- }\n- };\n+ .await\n+ .map_err(|e| format!(\"Reddit OAuth token request failed: {e}\"))?;\n \n if !resp.status().is_success() {\n- tracing::warn!(\"reddit OAuth token HTTP {}\", resp.status());\n- return None;\n+ let status = resp.status();\n+ let body = resp.text().await.unwrap_or_default();\n+ return Err(format!(\n+ \"Reddit OAuth token HTTP {status}: {}\",\n+ truncate_for_error(&body)\n+ ));\n }\n \n #[derive(Deserialize)]\n@@ -401,21 +470,40 @@ async fn ensure_oauth_token(\n expires_in: u64,\n }\n \n- let body: TokenResponse = match resp.json().await {\n- Ok(b) => b,\n- Err(e) => {\n- tracing::warn!(\"reddit OAuth token parse failed: {e}\");\n- return None;\n- }\n- };\n+ let body: TokenResponse = resp\n+ .json()\n+ .await\n+ .map_err(|e| format!(\"Reddit OAuth token parse failed: {e}\"))?;\n \n- tracing::debug!(expires_in = body.expires_in, \"reddit OAuth token acquired\");\n- Some(OAuthToken {\n+ tracing::info!(expires_in = body.expires_in, \"reddit OAuth token acquired\");\n+ Ok(OAuthToken {\n access_token: body.access_token,\n expires_at: Instant::now() + Duration::from_secs(body.expires_in),\n })\n }\n \n+fn truncate_for_error(body: &str) -> String {\n+ let compact: String = body.split_whitespace().collect::>().join(\" \");\n+ if compact.is_empty() {\n+ return \"(empty body)\".into();\n+ }\n+ // Prefer the human-readable block message over dumping Reddit's CSS.\n+ if let Some(idx) = compact.find(\"You've been blocked\") {\n+ let slice: String = compact.chars().skip(idx).take(160).collect();\n+ return if compact.chars().count() > idx + 160 {\n+ format!(\"{slice}…\")\n+ } else {\n+ slice\n+ };\n+ }\n+ let chars: String = compact.chars().take(200).collect();\n+ if compact.chars().count() > 200 {\n+ format!(\"{chars}…\")\n+ } else {\n+ chars\n+ }\n+}\n+\n async fn do_fetch(\n client: &Client,\n url: &str,\n@@ -460,15 +548,16 @@ async fn do_fetch(\n \n if !status.is_success() {\n let body = resp.text().await.unwrap_or_default();\n+ let detail = truncate_for_error(&body);\n tracing::debug!(\n item = %id,\n %status,\n body_len = body.len(),\n- body_prefix = %body.chars().take(240).collect::(),\n+ %detail,\n \"reddit non-success body\"\n );\n if status == StatusCode::FORBIDDEN || status == StatusCode::UNAUTHORIZED {\n- return Err(format!(\"Reddit API {status}: {body}\"));\n+ return Ok(FetchOutcome::AuthRejected { status, detail });\n }\n return Ok(FetchOutcome::NotFound);\n }\n@@ -716,6 +805,15 @@ fn reddit_direct_image_url(url: &str) -> bool {\n mod tests {\n use super::*;\n \n+ #[test]\n+ fn truncate_error_prefers_block_message() {\n+ let html = r#\"
You've been blocked by network security. To continue, log in
\"#;\n+ let msg = truncate_for_error(html);\n+ assert!(msg.starts_with(\"You've been blocked\"));\n+ assert!(msg.len() < 200);\n+ assert!(!msg.contains(\".x{color\"));\n+ }\n+\n #[test]\n fn map_subreddit_about_url() {\n let id = ItemId::from_url(\"https://reddit.com/r/rust\").unwrap();\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[5350388a] Add pool-scoped voting: /vote?pool= picks pairs from children.\n\n- /vote now accepts an optional `pool` param (parent item path). When\n provided without left/right, it picks the first unvoted pair from the\n pool's children. When provided alongside left/right, it constrains\n \"next pair\" navigation to siblings within the pool.\n- \"vote on children\" button appears on item pages with ≥2 children,\n linking to /vote?pool=.\n- Pool is threaded through VoteComparePost → success JS so in-page\n morph after voting keeps the pool context for next-pair navigation.\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide B — unified diff (full patch):\ndiff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs\nindex 5faa642451d69555cb391974beb0ad22c9355c8c..b79efdb4d52bd445a67f38cbfd61d3507d2b3014 100644\n--- a/server/src/api/ui_html.rs\n+++ b/server/src/api/ui_html.rs\n@@ -193,6 +193,7 @@ async fn dispatch_ui_action(\n ratio_right,\n explanation,\n next,\n+ pool,\n form_action,\n } => {\n if form_action != \"/ui\" {\n@@ -239,6 +240,9 @@ async fn dispatch_ui_action(\n .into_response();\n }\n };\n+ let pool_id = pool.as_deref().and_then(|p| {\n+ crate::path_types::ItemId::parse(p.trim()).map(|i| i.normalized_storage())\n+ });\n let mut rl = ratio_left.trim().parse::().unwrap_or(0).max(0);\n let mut rr = ratio_right.trim().parse::().unwrap_or(0).max(0);\n if rl == 0 && rr == 0 {\n@@ -294,6 +298,7 @@ async fn dispatch_ui_action(\n &thread_tag,\n &left_id,\n &right_id,\n+ pool_id.as_ref(),\n pid.as_str(),\n post_index,\n )\ndiff --git a/server/src/html/garden/pin.rs b/server/src/html/garden/pin.rs\nindex 5865cfdbc06aeb6555c97380e25591fae6b3d125..1820d7fe7ee167ecbf5ad5124f23b2ab92ffb01f 100644\n--- a/server/src/html/garden/pin.rs\n+++ b/server/src/html/garden/pin.rs\n@@ -79,7 +79,7 @@ pub(super) fn ont_pin_vote_controls(\n }\n }\n } @else {\n- a class=\"ont-vote-compare-btn\" href=(vote_compare_href(nav, pi, ¤t, None)) title=\"Compare and vote\" {\n+ a class=\"ont-vote-compare-btn\" href=(vote_compare_href(nav, pi, ¤t, None, None)) title=\"Compare and vote\" {\n span class=\"ont-vote-glyph\" aria-hidden=\"true\" { \"⚖\" }\n span { \"vote\" }\n }\n@@ -121,7 +121,7 @@ pub(super) fn child_row_pin_or_vote(\n if nv == 1 { \"\" } else { \"s\" },\n );\n @let aria = format!(\"Vote; {} pairwise {}\", nv, if nv == 1 { \"vote\" } else { \"votes\" });\n- a class=\"ont-garden-vote-ico\" href=(vote_compare_href(nav, pi, row_item, None)) title=(tip) aria-label=(aria) {\n+ a class=\"ont-garden-vote-ico\" href=(vote_compare_href(nav, pi, row_item, None, None)) title=(tip) aria-label=(aria) {\n span class=\"ont-garden-vote-glyph\" aria-hidden=\"true\" { \"⚖\" }\n span class=\"ont-garden-vote-count\" { (format!(\"{}\", nv)) }\n }\ndiff --git a/server/src/html/garden/render.rs b/server/src/html/garden/render.rs\nindex 5c3986ca36902f6c9019a4b5590f0b3b9d2cb4ff..bd8cbce059ee789de6e8dc9b6f69f54beee2f994 100644\n--- a/server/src/html/garden/render.rs\n+++ b/server/src/html/garden/render.rs\n@@ -29,6 +29,7 @@ use super::{\n item::{child_depth_from_uri, item_code_label, item_display_path, item_href},\n item_page::{build_item_page_view_model, sibling_nav_markup},\n pin::{child_row_pin_or_vote, ont_pin_vote_controls, pinned_item_from_jar},\n+ vote::vote_pool_href,\n };\n \n pub(super) async fn render_scope_view(\n@@ -186,12 +187,21 @@ pub(super) async fn render_scope_view(\n }\n \n section class=\"ont-tab-panel ont-tab-panel-children\" {\n+ @let total_children = model.child_rankings.component_rankings\n+ .iter().map(|c| c.ranked.len()).sum::()\n+ + model.child_rankings.unranked_items.len();\n h3 {\n \"ranked child groups\"\n @if model.child_depth > 1 {\n \" \"\n span class=\"muted\" { (format!(\"(depth {})\", model.child_depth)) }\n }\n+ @if total_children >= 2 {\n+ \" \"\n+ a class=\"ont-vote-children-btn\" href=(vote_pool_href(&nav, &model.item)) {\n+ \"vote on children\"\n+ }\n+ }\n }\n @if model.child_rankings.component_rankings.is_empty() {\n p class=\"muted\" { \"no voted pairs yet in this scope\" }\ndiff --git a/server/src/html/garden/tests.rs b/server/src/html/garden/tests.rs\nindex 6900a6795bcde866a176722149d6378e5127b4c3..c2036fca7752aef63d260e36cfe9649f63b5c550 100644\n--- a/server/src/html/garden/tests.rs\n+++ b/server/src/html/garden/tests.rs\n@@ -105,7 +105,7 @@ fn suggest_next_vote_pair_prefers_unvoted_sibling_pair() {\n let content = content_for_garden_view(&reduced, &ScopeId::Public);\n let a = ItemId::parse(\"~/topic/a\").unwrap().normalized_storage();\n let b = ItemId::parse(\"~/topic/b\").unwrap().normalized_storage();\n- let next = suggest_next_vote_pair(content, &a, &b).expect(\"next sibling pair\");\n+ let next = suggest_next_vote_pair(content, &a, &b, None).expect(\"next sibling pair\");\n assert_ne!(\n canonical_edge_items(&next.0, &next.1),\n canonical_edge_items(&a, &b)\ndiff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs\nindex 1d7fc8aa7436bfa9c1186dfd940a8d751ab7e088..2682cfcbd2f834b56459a02831aa225cffe67c58 100644\n--- a/server/src/html/garden/vote.rs\n+++ b/server/src/html/garden/vote.rs\n@@ -211,14 +211,15 @@ pub(crate) async fn vote_compare_post_success_js(\n _thread_tag: &str,\n left: &ItemId,\n right: &ItemId,\n+ pool: Option<&ItemId>,\n _post_id: &str,\n _post_idx: Option,\n ) -> String {\n let reduced = state.reduced.read().await;\n let content = content_for_garden_view(&reduced, &nav.scope());\n let edge_history = vote_edge_history_markup(content, left, right);\n- let next_pair = suggest_next_vote_pair(content, left, right);\n- let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref());\n+ let next_pair = suggest_next_vote_pair(content, left, right, pool);\n+ let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref(), pool);\n drop(reduced);\n JsBuilder::new()\n .morph_inner_selector(\"#vote-edge-history-region\", edge_history)\n@@ -231,27 +232,39 @@ pub(super) fn vote_compare_href(\n left: &ItemId,\n right: &ItemId,\n thread_override: Option<&str>,\n+ pool: Option<&ItemId>,\n ) -> String {\n let left_q = urlencoding::encode(left.as_str());\n let right_q = urlencoding::encode(right.as_str());\n- let base = format!(\n+ let mut base = format!(\n \"{}/vote?left={}&right={}\",\n nav.room_path_prefix_for_vote_compare(),\n left_q,\n right_q\n );\n if let Some(t) = thread_override.filter(|s| !s.is_empty()) {\n- format!(\"{}&thread={}\", base, urlencoding::encode(t))\n- } else {\n- base\n+ base = format!(\"{}&thread={}\", base, urlencoding::encode(t));\n+ }\n+ if let Some(p) = pool {\n+ base = format!(\"{}&pool={}\", base, urlencoding::encode(p.as_str()));\n }\n+ base\n+}\n+\n+pub(super) fn vote_pool_href(nav: &ThreadNav, pool_item_str: &str) -> String {\n+ format!(\n+ \"{}/vote?pool={}\",\n+ nav.room_path_prefix_for_vote_compare(),\n+ urlencoding::encode(pool_item_str)\n+ )\n }\n \n fn vote_compare_nav_markup(\n nav: &ThreadNav,\n next_pair: Option<&(ItemId, ItemId)>,\n+ pool: Option<&ItemId>,\n ) -> maud::Markup {\n- let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None));\n+ let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None, pool));\n html! {\n div class=\"vote-compare-nav\" {\n @if let Some(href) = &next_pair_href {\n@@ -267,8 +280,15 @@ pub(super) fn suggest_next_vote_pair(\n content: &ContentState,\n current_left: &ItemId,\n current_right: &ItemId,\n+ pool_parent: Option<&ItemId>,\n ) -> Option<(ItemId, ItemId)> {\n- let pool: Vec = if current_left.parent().as_ref().map(|p| p.as_str())\n+ let pool: Vec = if let Some(parent) = pool_parent {\n+ content\n+ .item_children\n+ .get(parent)\n+ .map(|s| s.iter().cloned().collect())\n+ .unwrap_or_default()\n+ } else if current_left.parent().as_ref().map(|p| p.as_str())\n == current_right.parent().as_ref().map(|p| p.as_str())\n {\n current_left\n@@ -322,10 +342,14 @@ pub(super) fn vote_compare_item_card(\n }\n #[derive(Debug, Deserialize)]\n pub struct VoteCompareQuery {\n- pub left: String,\n- pub right: String,\n+ #[serde(default)]\n+ pub left: Option,\n+ #[serde(default)]\n+ pub right: Option,\n #[serde(default)]\n pub thread: Option,\n+ #[serde(default)]\n+ pub pool: Option,\n }\n \n /// Public pairwise vote UI — `/vote?left=&right=&thread=`.\n@@ -376,17 +400,53 @@ async fn vote_compare_inner(\n jar: CookieJar,\n uri: Uri,\n ) -> axum::response::Response {\n- let left = match ItemId::parse(q.left.trim()) {\n- Some(i) => i.normalized_storage(),\n- None => return (StatusCode::NOT_FOUND, \"bad left item\").into_response(),\n+ let pool_id: Option = match q.pool.as_deref() {\n+ Some(p) => match ItemId::parse(p.trim()) {\n+ Some(i) => Some(i.normalized_storage()),\n+ None => return (StatusCode::BAD_REQUEST, \"bad pool item\").into_response(),\n+ },\n+ None => None,\n };\n- let right = match ItemId::parse(q.right.trim()) {\n- Some(i) => i.normalized_storage(),\n- None => return (StatusCode::NOT_FOUND, \"bad right item\").into_response(),\n+\n+ let (left, right) = match (q.left.as_deref(), q.right.as_deref()) {\n+ (Some(l), Some(r)) => {\n+ let left = match ItemId::parse(l.trim()) {\n+ Some(i) => i.normalized_storage(),\n+ None => return (StatusCode::NOT_FOUND, \"bad left item\").into_response(),\n+ };\n+ let right = match ItemId::parse(r.trim()) {\n+ Some(i) => i.normalized_storage(),\n+ None => return (StatusCode::NOT_FOUND, \"bad right item\").into_response(),\n+ };\n+ if left == right {\n+ return (StatusCode::BAD_REQUEST, \"items must differ\").into_response();\n+ }\n+ (left, right)\n+ }\n+ (None, None) => {\n+ let Some(pool) = pool_id.as_ref() else {\n+ return (StatusCode::BAD_REQUEST, \"provide left+right or pool\").into_response();\n+ };\n+ let reduced = state.reduced.read().await;\n+ let content = content_for_garden_view(&reduced, &nav.scope());\n+ let children: Vec = content\n+ .item_children\n+ .get(pool)\n+ .map(|s| s.iter().cloned().collect())\n+ .unwrap_or_default();\n+ if children.len() < 2 {\n+ drop(reduced);\n+ return (StatusCode::BAD_REQUEST, \"pool has fewer than 2 children to compare\").into_response();\n+ }\n+ let pair = suggest_next_pair_in_pool(&content.ranking_group, &children, None);\n+ drop(reduced);\n+ match pair {\n+ Some(p) => p,\n+ None => return (StatusCode::BAD_REQUEST, \"no pairs available in pool\").into_response(),\n+ }\n+ }\n+ _ => return (StatusCode::BAD_REQUEST, \"provide both left and right, or just pool\").into_response(),\n };\n- if left == right {\n- return (StatusCode::BAD_REQUEST, \"items must differ\").into_response();\n- }\n \n let reduced = state.reduced.read().await;\n let content = content_for_garden_view(&reduced, &nav.scope());\n@@ -409,7 +469,7 @@ async fn vote_compare_inner(\n let left_body = content.item_bodies.get(&left).cloned();\n let right_body = content.item_bodies.get(&right).cloned();\n let item_bodies_for_cards = content.item_bodies.clone();\n- let next_pair = suggest_next_vote_pair(content, &left, &right);\n+ let next_pair = suggest_next_vote_pair(content, &left, &right, pool_id.as_ref());\n drop(reduced);\n \n let title = format!(\n@@ -432,6 +492,7 @@ async fn vote_compare_inner(\n \"ratio_right\": {\"$form\": \"ratio_right\"},\n \"explanation\": {\"$form\": \"explanation\"},\n \"next\": next_path,\n+ \"pool\": pool_id.as_ref().map(|p| p.as_str()),\n \"form_action\": \"/ui\",\n }))\n .expect(\"vote compare rpc json\");\n@@ -456,7 +517,7 @@ async fn vote_compare_inner(\n Some(&item_bodies_for_cards),\n ))\n }\n- (vote_compare_nav_markup(&nav, next_pair.as_ref()))\n+ (vote_compare_nav_markup(&nav, next_pair.as_ref(), pool_id.as_ref()))\n div id=\"vote-edge-history-region\" {\n (edge_history)\n }\ndiff --git a/server/src/html/ui_action.rs b/server/src/html/ui_action.rs\nindex dd5294202569454acf9f41b458718700bbf96f39..2589a2cc00bb7b18cd19ebcbb938083122d6921d 100644\n--- a/server/src/html/ui_action.rs\n+++ b/server/src/html/ui_action.rs\n@@ -50,6 +50,9 @@ pub enum HtmlUiAction {\n explanation: String,\n /// Same-origin path after successful post (JS redirect).\n next: String,\n+ /// Pool parent item path, if the vote was initiated from a pool URL.\n+ #[serde(default)]\n+ pool: Option,\n #[serde(default = \"default_ui_form_action\")]\n form_action: String,\n },\n","role":"user"}],"model":"openai/gpt-chat-latest"}