Skip to content

Documentation: stale runbooks, a missing deploy prerequisite, a JS syntax error, PII hygiene (3 PRs) #26

Description

@ahueb

Three documentation PRs. DOC-7 (inside DOC-A) is the operationally urgent one — it records a deploy prerequisite that is currently absent from the runbooks an operator actually follows.

Line numbers current as of origin/main @ b7edcbc (2026-07-30).

PR DOC-A — Stale-doc, runbook & JS-bug bundle (trivial)

  • DOC-7 (new, do this first) — commit 10c240c removed the slack_ts inference from _restored_slack_ts (simulation.py:79-102), making scripts/backfill_slack_ts.py --apply a deploy prerequisite on any workspace with pre-Stage-6 history. Without it, every legacy slack_ts IS NULL row reads as DB-origin, _slack_parent_ts (:2718) returns None, and replies to those threads are silently kept off Slack. Commit 7d8b177 measured 60 of 625 rows in the live run as NULL. This is stated in specs/local-db-conversations.md:57-59 and in the _restored_slack_ts docstring, but not in CLAUDE.md or README.md. (Note: 7d8b177's own commit message says legacy NULL rows are safe because "the rebuild's inference … handles them correctly" — 10c240c deleted that inference 1h39m later, so that reassurance no longer holds.) Fix: add the one-time repair step to the CLAUDE.md/README restart runbooks. While in specs/local-db-conversations.md, also fix the "Three processes mint" count at :65 — see PR V11 in the issue Worker & background jobs: id collisions, session rollback, email robustness (4 PRs) #21.
  • DOC-1README.md:92 says to add PIs to a PILOT_LABS list in src/agent/simulation.py (0 matches in src/); :91 says to create a Slack bot token per agent and add it to env config. Both stale — the roster and tokens are DB-driven via AgentRegistry.
  • DOC-3AGENT.md: stale GitHub URL (andrewsu/coPI-python-opus vs SuLab/coPI.science, :7), wrong impersonation path (/api/admin/impersonate vs the real POST /admin/impersonate, admin.py:987), email listed "out of scope" though it is fully built, stale lab counts.
  • DOC-4 (doc half)specs/tech-stack.md:213 cites src/models/llm_call_log.py; the model actually lives in agent_activity.py:172.
  • DOC-5templates/base.html:20: posthog.identify('…', {name:'…'{% if … %}, email:'…'{% endif %}); — the object literal is missing its closing } before ), a JS syntax error whenever it renders for a logged-in user. Also: dead prompts prompts/daily_audit.md and prompts/email-reply-classify.md (0 refs in src/); lab counts disagree across docs.

PR DOC-B — Correct the live-roster-sync claims (small)

agent/main.py:84 admits every active agent to the roster regardless of token (the query filters on status == "active" only, :78-80), so _sync_roster_from_db (simulation.py:3589) never picks up a later token for an agent that was active-but-tokenless at boot without a restart. The sync early-returns unless the active-agent_id set changes (if not to_remove and not to_add: return), so bot_name/pi_name edits and post-activation connect_slack are not live either. CLAUDE.md currently claims all of this works without a restart. Fix: correct the CLAUDE.md claim (and/or re-run _load_pi_mappings on field edits — small, optional).

PR DOC-C — Align the agent-id/bot-name collision path + scripts hygiene (small)

agent_page.py:378-395 lacks the numeric-suffix fallback that scripts/backfill_agents.py:47-69 has, so a double collision hits the unique constraint and 500s; it also mints a bare {LastName}Bot where the scripts and CLAUDE.md specify e.g. PWuBot. Separately: generate_sparsedata_user.py:57 imports the private _extract_json and writes a PII CSV into the non-gitignored scripts/ directory (:854; .gitignore has no csv rule); build_cabo_sankey.py:35 bakes a stale 2026-05-01 default. Fix: align the web collision path with the script logic (numeric fallback + correct bot name); gitignore scripts/*.csv; parameterize the date.

Definition of done: DOC-5's template fix ships with a rendering assertion. DOC-7 is verified by following the runbook end to end on a workspace with legacy rows.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions