From 4a9bcb2b1c7a36255ce2585f65bce1e140f3a73d Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 6 Oct 2026 13:33:32 +0200 Subject: [PATCH] Let the judge read the person's languages beside the CV, as ADR 4.2 has it: a language a posting requires above the level spoken lowers skills and is a gap, and a change to them re-judges the cut Co-Authored-By: Claude Fable 5.1 --- app/jobs/judge.py | 26 ++++++++++++++++++-------- tests/test_judge.py | 12 +++++++++--- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/jobs/judge.py b/app/jobs/judge.py index 9b63419..61c59c1 100644 --- a/app/jobs/judge.py +++ b/app/jobs/judge.py @@ -18,7 +18,7 @@ The work is pairs, `(agent, role)`: an enabled agent with a CV, with or without a prompt, and an open role in its cut (`scores.cut`, see `app.jobs.score`: the best by fit, the best by CV closeness that those leave out, and the liked and saved) with some text, that has no judgement yet, or one read from another CV, -prompts, like, avoid or must text or role text than today's (`input_key`). +prompts, languages, like, avoid or must text or role text than today's (`input_key`). The cut is the only selection: the pull judges it after extract and the rescore that follows, so it reads the cut as recomputed. A pair is named by the composite key `":"`, which is what `desk.modeltask` hands round as a uid, so `desk/` is untouched. @@ -52,7 +52,7 @@ from pipeline.task import Batch from app.config import Config from app.jobs import stages from app.models import ( - LANGUAGE_LEVELS, MUST_VERDICTS, Agent, CvLanguage, cv_languages, must_lines, + LANGUAGE_LEVELS, MUST_VERDICTS, Agent, CvLanguage, _language_name, cv_languages, must_lines, ) from app.storage import Store @@ -66,22 +66,28 @@ EXCERPT = 8000 #: 3: what the person likes (`like_text`) beside what they do not, and the #: career rubric reading both. #: 4: the three numbers 0 to 10 rather than 0 to 100. -FORMAT = 4 +#: 5: the person's languages, read into skills. +FORMAT = 5 #: How many strengths and gaps are kept, and how long each may be. MOST, LONGEST = 3, 300 SYSTEM = """You judge job postings for one person: how well each fits their CV and what they want. -Below the rules is the person: their CV, what they want, what they like and -what they do not like (the work, the workplace, situations), and their -must-haves and deal-breakers when they gave any. Each item is one posting with a key, its title, company, place +Below the rules is the person: their CV, the languages they speak and how +well, what they want, what they like and what they do not like (the work, +the workplace, situations), and their must-haves and deal-breakers when they +gave any. Each item is one posting with a key, its title, company, place and text. Answer one judgement per item. Score three dimensions, each a whole number from 0 to 10: - skills: 8-10 the core requirements are the person's primary skills; 6-7 most requirements match, with 1-2 gaps that are learnable; 4-5 a partial - match, significant upskilling needed; 0-3 a fundamental mismatch. + match, significant upskilling needed; 0-3 a fundamental mismatch. A + language the posting requires counts as a requirement: one the person + speaks below the level asked, or not at all when their languages are + listed, lowers skills and is a gap. A language the posting does not + mention changes nothing. - experience: match on the function and nature of the work performed, not the literal job title, and on its level. 8-10 direct experience in the same domain and role type; 6-7 related, with transferable skills clear; 4-5 @@ -181,9 +187,10 @@ def _text(row: Any) -> str: def input_key(agent: Agent, text: str) -> str: """A hash of everything a judgement reads: the CV, the prompts, the - like, avoid and must texts, and the role's text as sent. A judgement stored + languages, the like, avoid and must texts, and the role's text as sent. A judgement stored under another key is read again.""" blob = json.dumps([FORMAT, agent.cv_text, [[p.name, p.text] for p in agent.prompts], + [[l.language, l.level] for l in agent.cv_languages], agent.like_text, agent.avoid_text, agent.must_text, text], ensure_ascii=False) return hashlib.sha1(blob.encode()).hexdigest()[:16] @@ -230,6 +237,9 @@ def pending(store: Store) -> int: def system(agent: Agent) -> str: """The rubric, and the person as this agent describes them.""" parts = [SYSTEM, "", "The person.", "", f"\n{agent.cv_text.strip()}\n"] + if agent.cv_languages: + spoken = ", ".join(f"{_language_name(l.language)} {l.level}" for l in agent.cv_languages) + parts.append(f"\n\n{spoken}\n") wants = "\n".join(f"- {p.name}: {' '.join(p.text.split())}" for p in agent.prompts if p.text.strip()) if wants: diff --git a/tests/test_judge.py b/tests/test_judge.py index 48e5208..19572fd 100644 --- a/tests/test_judge.py +++ b/tests/test_judge.py @@ -14,7 +14,7 @@ import pytest from app.config import Config from app.jobs import judge, stages -from app.models import CvLanguage, Prompt +from app.models import CvLanguage, Prompt, Weights from app.storage import Store from desk import modeltask from desk.models import Item @@ -259,10 +259,16 @@ def test_a_judgement_is_read_again_only_when_what_it_read_changed( with store.transaction() as conn: conn.execute("UPDATE roles SET closed_at = NULL WHERE uid = ?", (uid,)) - # The languages are not part of what it read; the must text is. + # The languages and the must text are part of what it read; the weights + # are not. store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, - cv_languages=[CvLanguage(language="da", level="native")]) + weights=Weights(cv_skills=50)) assert judge.pending(store) == 0 + spoken = store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, + cv_languages=[CvLanguage(language="da", level="native")]) + assert judge.pending(store) == 1 + assert '\nDanish native' \ + in judge.system(spoken) store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, must_text="Remote two days a week.") assert judge.pending(store) == 1