AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix: preserve complete job boards in hiring signals (#1212)
Ilia Alshanetsky86e364b6034b
diff --git a/changelog.d/+cr-008-jobs-author-cap.fixed.md b/changelog.d/+cr-008-jobs-author-cap.fixed.mdnew file mode 100644index 00000000..91ad90d4--- /dev/null+++ b/changelog.d/+cr-008-jobs-author-cap.fixed.md@@ -0,0 +1 @@+Preserve job-board roles through author diversity filtering and calculate hiring signals from the complete accepted board, so ranking and display limits do not hide strategic roles or understate company size.diff --git a/skills/last30days/scripts/lib/fusion.py b/skills/last30days/scripts/lib/fusion.pyindex ca7cad4c..617ecdd6 100644--- a/skills/last30days/scripts/lib/fusion.py+++ b/skills/last30days/scripts/lib/fusion.py@@ -197,7 +197,8 @@ _MAX_ITEMS_PER_FIRST_PARTY_AUTHOR = 8def _extract_author(candidate: schema.Candidate) -> str | None:"""Return a normalized author key from a candidate's source items."""for item in candidate.source_items:- if item.author:+ # Jobs use the ATS provider as author, not an individual contributor.+ if item.source != "jobs" and item.author:return item.author.strip().lower()return Nonediff --git a/skills/last30days/scripts/lib/pipeline.py b/skills/last30days/scripts/lib/pipeline.pyindex f8bded86..e9b2e616 100644--- a/skills/last30days/scripts/lib/pipeline.py+++ b/skills/last30days/scripts/lib/pipeline.py@@ -2810,6 +2810,17 @@ def run(resolved_handles=resolved_handles,)ranked_public = rerank.prune_fallback_entity_misses(ranked_public, topic=topic)+ if hiring_summary:+ # The diagnostic source dump retains pruned jobs; hiring aggregation+ # needs their rejection identities after they leave the ranked pool.+ retained_ids = {candidate.candidate_id for candidate in ranked_public}+ hiring_summary["rejected_job_keys"] = sorted({+ fusion.candidate_key(item)+ for candidate in public_candidates+ if candidate.candidate_id not in retained_ids+ for item in candidate.source_items+ if item.source == "jobs"+ })# Private corpus already cleared a body-aware retrieval floor; do not apply# the public title/snippet visibility gate (filenames often omit the head# token even when the document body matched).diff --git a/skills/last30days/scripts/lib/render.py b/skills/last30days/scripts/lib/render.pyindex dac07602..b36f9529 100644--- a/skills/last30days/scripts/lib/render.py+++ b/skills/last30days/scripts/lib/render.py@@ -12,6 +12,7 @@ from urllib.parse import urlparsefrom . import (amazon,dates,+ fusion,health,hiring_signals,library_index,@@ -2300,12 +2301,36 @@ def _render_hiring_signals(if not isinstance(summary, dict):return []mode = summary.get("mode") or "standard"- if candidates is not None:- job_items: dict[str, schema.SourceItem] = {}- for candidate in candidates:+ rejected_jobs = set(summary.get("rejected_job_keys") or [])+ if candidates is not None or rejected_jobs:+ solid_clusters = _clusters_clearing_relevance_floor(report, report.clusters)+ accepted = _candidates_for_auxiliary_sections(+ report, report.clusters, solid_clusters,+ )+ accepted_ids = {+ candidate.candidate_id for candidate in accepted+ if _best_take_relevance_ok(candidate)+ }+ rejected_jobs.update(+ fusion.candidate_key(item)+ for candidate in report.ranked_candidates+ if candidate.candidate_id not in accepted_ids+ for item in candidate.source_items+ if item.source == "jobs"+ )+ # Board size and rare-role signals must survive the ranking pool and+ # display limits, while explicitly rejected evidence stays excluded.+ job_items = {+ fusion.candidate_key(item): item+ for item in report.items_by_source.get("jobs", [])+ if fusion.candidate_key(item) not in rejected_jobs+ }+ for candidate in accepted:+ if candidate.candidate_id not in accepted_ids:+ continuefor item in candidate.source_items:if item.source == "jobs":- job_items[item.item_id] = item+ job_items[fusion.candidate_key(item)] = itemif not job_items:return []summary = hiring_signals.analyze(diff --git a/tests/test_jobs_fusion_render.py b/tests/test_jobs_fusion_render.pynew file mode 100644index 00000000..94bf2ff9--- /dev/null+++ b/tests/test_jobs_fusion_render.py@@ -0,0 +1,223 @@+import copy++import pytest++from lib import cluster, fusion, hiring_signals, http, normalize, pipeline, render, rerank, schema+++def _jobs(count):+ return normalize.normalize_source_items(+ "jobs",+ [+ {+ "id": f"job-{index}",+ "title": f"Software Engineer {index}",+ "description": "Build Acme backend infrastructure.",+ "url": f"https://boards.greenhouse.io/acme/jobs/{index}",+ "provider": "greenhouse",+ "department": "Engineering",+ "date": "2026-06-01",+ }+ for index in range(count)+ ],+ "2026-05-17",+ "2026-06-16",+ )+++def _plan(sources):+ return schema.QueryPlan(+ intent="company",+ freshness_mode="relaxed",+ cluster_mode="story",+ raw_topic="Acme",+ subqueries=[schema.SubQuery(+ label="primary",+ search_query="Acme",+ ranking_query="What is Acme hiring for?",+ sources=sources,+ )],+ source_weights={source: 1.0 for source in sources},+ )+++def test_job_provider_does_not_cap_roles_or_exempt_social_author():+ jobs = _jobs(6)+ posts = [+ schema.SourceItem(+ item_id=f"post-{index}",+ source="x",+ title=f"Acme update {index}",+ body="Acme update",+ url=f"https://x.com/greenhouse/status/{index}",+ author="greenhouse",+ relevance_hint=0.8,+ )+ for index in range(6)+ ]++ candidates = fusion.weighted_rrf(+ {("primary", "jobs"): jobs, ("primary", "x"): posts},+ _plan(["jobs", "x"]),+ pool_limit=40,+ )++ assert {item.item_id for item in candidates if item.source == "jobs"} == {+ item.item_id for item in jobs+ }+ assert len([item for item in candidates if item.source == "x"]) == 3+++def _report(jobs, pool_limit):+ plan = _plan(["jobs"])+ candidates = fusion.weighted_rrf(+ {("primary", "jobs"): jobs}, plan, pool_limit=pool_limit,+ )+ ranked = rerank.rerank_candidates(+ topic="Acme", plan=plan, candidates=candidates,+ provider=None, model=None, shortlist_size=pool_limit,+ )+ return schema.Report(+ topic="Acme",+ range_from="2026-05-17",+ range_to="2026-06-16",+ generated_at="2026-06-16T00:00:00+00:00",+ provider_runtime=schema.ProviderRuntime(+ reasoning_provider=None, planner_model=None, rerank_model=None,+ ),+ query_plan=plan,+ ranked_candidates=ranked,+ clusters=cluster.cluster_candidates(ranked, plan),+ items_by_source={"jobs": jobs},+ errors_by_source={},+ artifacts={"hiring_signals": hiring_signals.analyze(+ jobs, explicit=True, topic="Acme",+ )},+ )++[email protected]("renderer", [+ lambda report: render.render_compact(report, cluster_limit=1),+ lambda report: render.render_context(report, cluster_limit=1),+ render.render_for_html,+ lambda report: render.render_compact(report, register="exec", cluster_limit=1),+], ids=["compact", "context", "html", "exec"])[email protected]("pool_limit", [5, 40])+def test_hiring_analysis_uses_board_beyond_ranking_and_display_limits(renderer, pool_limit):+ jobs = _jobs(40)+ jobs[-1].title = "Founding Research Scientist, Human Simulation"+ jobs[-1].body = "Acme is founding a human simulation research team."+ report = _report(jobs, pool_limit=pool_limit)++ assert len(report.ranked_candidates) == pool_limit+ if pool_limit == 5:+ assert all(candidate.item_id != jobs[-1].item_id for candidate in report.ranked_candidates)+ text = renderer(report)++ assert "company-size tier: growth" in text+ assert "Founding Research Scientist, Human Simulation" in text+ assert "evidence: 39 roles" in text++[email protected]("rejection", ["cluster", "candidate"])+def test_hiring_analysis_excludes_rejected_roles_from_full_board(rejection):+ jobs = _jobs(6)+ jobs[-1].title = "Founding Research Scientist, Human Simulation"+ report = _report(jobs, pool_limit=6)+ assert jobs[-1].title in render.render_compact(report)++ rejected = next(+ candidate for candidate in report.ranked_candidates+ if candidate.item_id == jobs[-1].item_id+ )+ if rejection == "cluster":+ next(+ cluster for cluster in report.clusters+ if rejected.candidate_id in cluster.candidate_ids+ ).score = 0+ else:+ rejected.explanation = "fallback-local-score (entity-miss demotion)"++ text = render.render_compact(report)++ assert "## Hiring Signals" in text+ assert jobs[-1].title not in text+ assert "evidence: 5 roles" in text++[email protected]("only_rejected", [False, True])+def test_hiring_analysis_does_not_revive_pruned_entity_miss(monkeypatch, only_rejected):+ jobs = _jobs(6)+ jobs[-1].title = "Founding Research Scientist, Human Simulation"+ jobs[-1].body = "Research an unrelated company."+ rejected_title = jobs[-1].title+ if only_rejected:+ jobs = jobs[-1:]++ def careers_page(url, **kwargs):+ assert url == "https://acme.com/careers"+ return '<a href="https://boards.greenhouse.io/acme">Careers</a>'++ def board_response(url, **kwargs):+ assert url == "https://boards-api.greenhouse.io/v1/boards/acme/jobs"+ return {"jobs": [+ {+ "id": job.item_id,+ "title": job.title,+ "content": job.body,+ "absolute_url": job.url,+ "updated_at": "2026-06-01",+ "departments": [{"name": "Engineering"}],+ }+ for job in jobs+ ]}++ monkeypatch.setattr(http, "get_text", careers_page)+ monkeypatch.setattr(http, "get", board_response)+ report = pipeline.run(+ topic="Acme",+ config={"FROM_BROWSER": "off", "LAST30DAYS_X_BACKEND": "xai"},+ depth="quick",+ requested_sources=["jobs"],+ hiring_signals_mode=True,+ web_backend="none",+ )++ assert any(item.title == rejected_title for item in report.items_by_source["jobs"])+ assert all(candidate.title != rejected_title for candidate in report.ranked_candidates)++ text = render.render_compact(report)++ assert rejected_title not in text+ if not only_rejected:+ assert "## Hiring Signals" in text+ assert "evidence: 5 roles" in text++[email protected]("rejected", [False, True])+def test_hiring_analysis_uses_canonical_job_urls(rejected):+ jobs = _jobs(5)+ jobs[-1].title = "Founding Research Scientist, Human Simulation"+ if rejected:+ jobs[-1].body = "Research an unrelated company."+ jobs[-1].snippet = jobs[-1].body+ report = _report(jobs, pool_limit=5)+ original = jobs[-1]+ variant = copy.deepcopy(original)+ variant.item_id = "other-stream-id"+ variant.url = original.url.upper() + "/?utm_source=jobs"+ report.items_by_source["jobs"] = [*jobs[:-1], variant]+ assert fusion.candidate_key(original) == fusion.candidate_key(variant)+ if rejected:+ candidate = next(+ candidate for candidate in report.ranked_candidates+ if candidate.item_id == original.item_id+ )+ assert "entity-miss" in candidate.explanation+ assert not rerank.candidate_relevance_ok(candidate)++ text = render.render_compact(report)++ assert f"evidence: {4 if rejected else 5} roles" in text+ if rejected:+ assert original.title not in text