#4545·career-ops

reply-watch reads the tracker, follow-ups and reply ledger from the code root, not the data root

Author: abankar1Created Sep 28, 2026Updated Sep 28, 2026
Labelsbug🔧 scripts

Summary

reply-watch.mjs resolves three user-layer paths against __dirname — the directory the script lives in — instead of the data root. paste-reply.mjs does the same for the ledger it writes. For any user whose data lives outside the checkout, reply-watch reads a tracker nobody writes to, and it fails silently.

The code

reply-watch.mjs:26-29:

javascript
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const DEFAULT_CANDIDATES_PATH = path.join(__dirname, 'data', 'reply-candidates.json');
const APPS_FILE = resolveTrackerPath(__dirname);
const FOLLOWUPS_FILE = path.join(__dirname, 'data', 'follow-ups.md');

paste-reply.mjs:52-54:

javascript
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const CANDIDATES_PATH = process.env.CAREER_OPS_REPLY_CANDIDATES
  || path.join(__dirname, 'data', 'reply-candidates.json');

All four files are user layer. DATA_CONTRACT.md resolves the user layer through CAREER_OPS_ROOT, CAREER_OPS_DATA_DIR, or a .career-ops-data marker, and none of those reach either script.

Reproduction — same tracker file, two documented variables

$ CAREER_OPS_ROOT=$SB node reply-watch.mjs cands.json
1. Your application to Acme Corp          <- the email's subject: UNMATCHED
   Type: Interview
   Suggested tracker update: Interview

$ CAREER_OPS_TRACKER=$SB/data/applications.md node reply-watch.mjs cands.json
1. Acme Corp — Senior Backend Engineer    <- the tracker row: matched
   Type: Interview
   Suggested tracker update: Interview

CAREER_OPS_TRACKER works only because resolveTrackerPath() consults it before the root it was handed. CAREER_OPS_ROOT is the first mechanism in DATA_CONTRACT.md's precedence order, so the documented primary setup is the one that breaks.

It fails silently, which is the part that matters. An empty tracker is a legal state, and the classifier runs off the email alone — so the digest still prints a type, evidence and a suggested status. Only the match to an application is missing, which is the single thing the tracker is consulted for. Nothing warns.

follow-ups.md — two scripts, two different files

followup-seed.mjs:214 writes join(getCareerOpsRoot(), 'data/follow-ups.md'). reply-watch.mjs:29 reads join(__dirname, 'data', 'follow-ups.md'). One script wrote a file the other could not see, so reply-watch's follow-up context was empty regardless of how much history existed.

paste-reply.mjs — user content written into the system layer

Its header states the default plainly:

CAREER_OPS_REPLY_CANDIDATES override the output JSON path (used by tests; defaults to data/reply-candidates.json next to this script, matching reply-watch.mjs's default)

"Matching reply-watch.mjs's default" was true, and that is exactly why neither looked broken — the two agreed with each other while both ignored the data root. The consequence is that a user with data outside the checkout has their pasted replies written into the repository, which is the split DATA_CONTRACT.md exists to maintain.

Incidental supporting evidence: a working checkout here accumulated four leaked entries in data/reply-candidates.json (fixture senders — wingyun.com, examplelabs.com, zhaopin.com, somecompany.com). I can't attribute them to a specific run, so treat it as a symptom rather than a claim: this default does write into checkouts.

Expected

All four paths resolve through getCareerOpsRoot(). The explicit overrides (CAREER_OPS_TRACKER, CAREER_OPS_REPLY_CANDIDATES) keep precedence, and behaviour is unchanged for a user whose data root is the checkout — the default layout.

The two scripts must move together: fixing reply-watch alone splits the documented handoff (paste-reply writing beside the script, reply-watch reading the data root, and "Next: run node reply-watch.mjs" finding nothing).

Related

Same class as #3511, #4208 (verify-cv-facts), #4211 (jd-skill-gap) and #4348 (batch-evaluate-gemini) — a user-layer file pinned to the code root.