Extract as the afterburner for the level: model verdict with stated and title hints, best rank first, agreement per host

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 09:43:52 +02:00
1 parent 3adafd8950
commit 7ca1f02e26
4 files changed
+194 -23

No files matched your search

+29 -9
View File
@@ -7,8 +7,9 @@ Sharing the backlog out a call at a time, the give-up count, splitting a
refused batch, and failing with a notice when no model is reachable are
`desk.modeltask`'s.
A role is waiting while it is open, has never been answered (`extracted_at IS
NULL`), has not been given up on, and is in the best of an enabled agent's
`extract` is also the afterburner for the level. A role is waiting while it is
open, has not been given up on, has never been answered (`extracted_at IS
NULL`) or has no model level (`seniority_model` empty), and is in the best of an enabled agent's
ungated scores as deep and as low as that agent's own `limits` say
(`extract_top`, `extract_min`). That bound is what keeps the cost
proportional to the rankings rather than to the boards:
@@ -16,7 +17,10 @@ the pull scores every role for free first, then reads the few hundred that
rank, and scores again so the gates see what was filled. A batch built for
named uids finishes what it was dealt whatever their rank. The answer only
fills columns that are still empty: a board's structured field wins over what
a model read out of the prose. See `Store.set_extracted`.
a model read out of the prose. The exception is the level, which the model
always gives (the board's word and the title's go in as hints) and which
overrules them; both stay in `seniority_stated` and `seniority_title`, so
`Store.seniority_agreement` can compare them. See `Store.set_extracted`.
Off by default (`extract.enabled: false`), because on the API backend every
batch is a paid call. Whether it runs is `stages.stage_on`: the switch under
@@ -37,7 +41,7 @@ from desk.modeltask import ModelTask
from pipeline import NULL, RunContext, Task, job
from app.config import Config
from app.jobs import stages
from app.models import PERMITS, REMOTE, SENIORITIES, ExtractResult, Role
from app.models import LEVELS, PERMITS, REMOTE, SENIORITIES, ExtractResult, Role
from app.storage import Store
# `FUNCTIONS` is the `ats` plugin's vocabulary, reached the way `web/pages.py`
@@ -68,8 +72,16 @@ Fields:
("Berlin", "Greater London"). '' if none is named.
- country: ISO 3166-1 alpha-2 code of that place ("DE", "GB"), or ''.
- remote: "remote", "hybrid" or "onsite" only when the posting says so, else ''.
- seniority: one of {", ".join(s for s in SENIORITIES if s)}, or ''. From the
title or the stated level, not from years of experience alone.
- seniority: exactly one of {", ".join(s for s in SENIORITIES if s)}, for every
posting; never ''. This is the one field where you decide rather than
extract. Judge the level of the person hired from the title and the text (or
the short teaser when there is no text), weighing years of experience,
scope and who the role reports to. `stated` is the level the job board
itself gave and `title_level` the one a word in the title suggests. Both
are hints: boards use different vocabularies and many state nothing, so
overrule them when the posting says otherwise. When nothing says, choose the
likeliest level for that kind of title; most postings are for individual
contributors, not managers.
- salary_min, salary_max: yearly gross amounts as integers, or null. A stated
monthly figure is multiplied by 12; an hourly or daily rate is null. A single
figure is both min and max.
@@ -95,7 +107,7 @@ SCHEMA: dict[str, Any] = {
"place": _TEXT,
"country": _TEXT,
"remote": {"type": "string", "enum": list(REMOTE)},
"seniority": {"type": "string", "enum": list(SENIORITIES)},
"seniority": {"type": "string", "enum": list(LEVELS)},
"salary_min": _SALARY,
"salary_max": _SALARY,
"currency": _TEXT,
@@ -125,11 +137,15 @@ def _item(role: Role) -> dict[str, Any]:
"""One posting as the model sees it. `location` is the board's own place
text where it gave one: part of the posting, and often the only line that
names the country."""
text = " ".join(role.description.split())[:EXCERPT]
return {key: value for key, value in {
"uid": role.uid,
"title": role.title,
"location": role.place,
"text": " ".join(role.description.split())[:EXCERPT],
"stated": role.seniority_stated,
"title_level": role.seniority_title,
"text": text,
"teaser": "" if text else " ".join(role.teaser.split())[:EXCERPT],
}.items() if value}
@@ -191,7 +207,11 @@ def apply_batch(store: Store, answer: dict[str, Any],
if not uid or uid not in wanted:
stats.rejected.append(uid or "?")
continue
filled = store.set_extracted(uid, fields(one))
got = fields(one)
filled = store.set_extracted(uid, got)
if filled is not None and not got["seniority"]:
# Answered but no level: the role is still waiting for one.
store.extract_missed([uid])
if filled is None:
stats.rejected.append(uid)
continue