The Veas codebase runs N bots that each occupy a "domain" for a user (currently: mediator = relationship coach for a dyad on topic=relationship; tante_rosi = solo pregnancy coach on topic=pregnancy; more bots planned). Today only the mediator's content can flow between dyad partners, gated by a global opt-in (users.cross_thread_sharing_default). The pregnancy coach writes everything private; her facts cannot reach the partner even when the user wants to share them.
We want to generalise partner-sharing so that every bot (current and future) can produce content that the user's partner sees, gated by a per-bot opt-in. The user gets one switch per domain ("share my pregnancy stuff with my partner — yes / no / not decided yet"). Until they decide, the bot keeps surfacing the question.
The basic infrastructure already exists for distillations (visibility: private | dyad_shareable, shareable_summary, raw_message_visibility() filtering in app/services/cross_thread_privacy.py, app/services/hot_context.py:500-577). The work below generalises it across both bots-and-content-types, and replaces the global toggle with a per-bot one.
Goal (one sentence)
Replace the single global users.cross_thread_sharing_default with per-bot opt-in state on user_bot_state, extend dyad_shareable visibility to memories (today it only exists on distillations), and rewire the hot-context read path so a partner sees dyad_shareable content from any bot where the content's owner has opted in for that bot — with NULL ("not decided") triggering a prompt-slot the bot uses to ask.
Decisions already made (do not re-litigate)
These are settled — the plan should implement them, not re-debate them.
Per-bot opt-in lives on user_bot_state as one new column partner_share text with values 'opt_in' | 'opt_out' | NULL. NULL = "pending, must ask". Key is (user_id, bot_id) — same shape as every other per-bot state today.
Memories get visibility and shareable_summary mirroring distillations exactly. Default . When , is required.
Assistant
{"output":"I’ll implement only T1: inspect the existing bot constants and migration schema, then add the constant and migration foundation with focused verification.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"I found the repo has existing untracked directories/files unrelated to this batch. I’m leaving those alone and reading the current schema around bots, user_bot_state, distillations, and memories before editing.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"I’m going to keep the schema change migration self-contained and rerunnable where practical: add the new columns and constraints first, backfill from the old users column only if it still exists, then drop that old column at the end.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"The first edit is in place. I’m checking for Python import regressions and migration-shape issues now; if the registry fake pools dislike the parameterized lookups, I’ll narrow that change back to avoid accidental test churn.","files_changed":[[REDACTED],[REDACTED],[REDACTED],[REDACTED]],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"Focused checks pass, and the migration has one BEGIN/COMMIT with the drop after the backfill and memory-field additions. I’m running the full suite now because this batch changes startup bot registration code as well as schema files.","files_changed":[[REDACTED],[REDACTED],[REDACTED],[REDACTED]],"commands_run":["python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q","rg -n "cross_thread_sharing_default|partner_share|visibility|shareable_summary|tante_rosi" migrations/0035_per_bot_partner_sharing.sql app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py","python - <<'PY'\nfrom pathlib import Path\nsql = Path('migrations/0035_per_bot_partner_sharing.sql').read_text()\nprint(sql.count('BEGIN;'), sql.count('COMMIT;'))\nprint('drop_pos', sql.rfind('DROP COLUMN cross_thread_sharing_default'))\nprint('backfill_pos', sql.find('INSERT INTO user_bot_state'))\nprint('mem_pos', sql.find('ALTER TABLE memories'))\nPY","python - <<'PY'\ntry:\n import pglast\nexcept Exception as e:\n print(f'pglast unavailable: {e.class.name}: {e}')\nelse:\n from pathlib import Path\n pglast.parse_sql(Path('migrations/0035_per_bot_partner_sharing.sql').read_text())\n print('pglast parse ok')\nPY"],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"The full suite surfaced four failures in tests/test_agentic.py and tests/test_decay.py. They look unrelated to T1: one is a missing fake event in an existing agentic ordering test, and three are decay/scoring fake-pool misses after an Anthropic 401 path; I’m rerunning those full modules to confirm the failure shape before checkpointing.","files_changed":[[REDACTED],[REDACTED],[REDACTED],[REDACTED]],"commands_run":["pytest -q"],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
User
Assistant
{"output":"I’ll implement only T2: add the shared partner-sharing service, keep it independent of later hot-context/tool rewrites, and verify it imports cleanly plus run focused modules that cover bot registry/import paths.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"I’m adding a narrow service module with typed state normalization, batch fetch via (user_id, bot_id) pairs, scoped upsert, dyad-member partner lookup, and one async provenance helper that tries the bot registry before the bots table and then the raw id.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"The new helper module and its focused tests pass. I’m running the full suite now to satisfy the batch verification rule; prior batch already showed unrelated failures in test_agentic and test_decay, so I’ll report whether that changes.","files_changed":[[REDACTED],[REDACTED]],"commands_run":["python -m py_compile app/services/partner_sharing.py","pytest tests/test_partner_sharing.py -q","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q"],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"Executed batch 2 / T2. Added shared partner-sharing helpers and focused tests. Focused verification passed; full pytest was rerun and still fails in the same prior unrelated-looking agentic/decay tests from batch 1.","files_changed":["app/services/partner_sharing.py","tests/test_partner_sharing.py"],"commands_run":["python -m black app/services/partner_sharing.py tests/test_partner_sharing.py","python -m py_compile app/services/partner_sharing.py","pytest tests/test_partner_sharing.py -q","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q","pytest -q"],"deviations":["Full test suite still does not pass: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob fails looking for a fake-pool read:list_themes event; tests/test_decay.py has 3 failures on an unhandled fake-pool UPDATE after Anthropic 401 during observation rescoring. Same failure pattern as prior batch, unrelated to T2 helper changes."],"task_updates":[{"task_id":"T2","status":"done","executor_notes":"Created app/services/partner_sharing.py with strict partner_share normalization, single and batch fetches keyed by (user_id, bot_id), scoped upsert for one (user_id, bot_id), dyad partner lookup through dyads/dyad_members, and provenance formatting that uses registry display names with bots-table and bot-id fallback. Added focused helper tests covering normalization, missing-row pending behavior, scoped upsert, dyad lookup, and provenance fallback. Focused tests passed. Full pytest was rerun and still fails only in the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures from batch 1.","files_changed":["app/services/partner_sharing.py","tests/test_partner_sharing.py"],"commands_run":["python -m black app/services/partner_sharing.py tests/test_partner_sharing.py","python -m py_compile app/services/partner_sharing.py","pytest tests/test_partner_sharing.py -q","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q","pytest -q"],"auto_attributed_files":false}],"sense_check_acknowledgments":[{"sense_check_id":"SC2","executor_note":"Yes. The helper APIs read/write only explicit (user_id, bot_id) keys and do not create bot rows; unknown bot IDs fall through to DB/id display fallback while FK constraints will guard writes. Partner resolution uses dyads/dyad_members, and provenance uses the bot registry display name first with bots.display_name and raw id fallbacks."}]}
User
Assistant
{"output":"I’ll execute only T3: remove the old global sharing field from the User model, partner lookup, and staging paths, then wire per-bot partner-share state only where prompt rendering currently needs a replacement.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"The old field is still embedded in User, partner_of, BotSpec.render_system_prompt, and staging replay. I’m removing those production dependencies and using get_partner_share(pool, user_id, bot_id) as the temporary source for the existing prompt renderer arguments until the later prompt-renaming batch lands.","files_changed":[],"commands_run":[],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"Focused model/prompt/helper checks pass, and the T3 paths no longer select or hydrate the dropped users column. I’m running the full suite now; I expect the same pre-existing test_agentic/test_decay failures unless this batch introduced something new.","files_changed":[[REDACTED],[REDACTED],[REDACTED],[REDACTED],[REDACTED]],"commands_run":["python -m black app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py","python -m py_compile app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py","pytest tests/test_pregnancy_user_model.py tests/test_partner_sharing.py tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q"],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
{"output":"I adjusted the fake pool to recognize the new user SELECT shape so the batch doesn't create broad fixture noise. The focused agentic/staging module run is back to the known single test_agentic failure from earlier batches.","files_changed":[[REDACTED],[REDACTED],[REDACTED],[REDACTED],[REDACTED],[REDACTED]],"commands_run":["pytest tests/test_agentic.py tests/test_agentic_lifecycle.py tests/test_staging.py -q"],"deviations":[],"task_updates":[],"sense_check_acknowledgments":[]}
Assistant
I’ve picked up batch 3 from the existing handoff. The implementation and verification are already mostly complete; I’m doing the final sanity checks and checkpoint write now.
Assistant
The final grep check found no production read/pass dependency in the T3 paths. I’m writing the batch checkpoint now with only the T3 task and SC3 acknowledgment.
Assistant
User
Assistant
I’m starting batch 4, limited to replacing the legacy sharing write tool with the scoped set_partner_sharing tool. I’ll first inspect the existing schema, registry, write-tool, and scope-guard wiring so the edit matches local patterns.
Assistant
The old tool wrote directly to users.cross_thread_sharing_default and accepted a user override. I’m replacing that with a no-override schema and a write helper that only uses ctx.user.id plus ctx.bot_id.
Assistant
The core replacement is in place. I’m formatting and running the focused schema/tool tests first, then I’ll run the full suite as required and document any pre-existing failures.
Assistant
Focused tests passed. I’m running the full test suite now; based on earlier batches I expect the same unrelated agentic/decay failures, but I’ll verify the failure set does not expand.
Assistant
The full suite failure set is unchanged from prior batches. I’m doing the final registry/allowlist sanity checks now: the old tool should be gone from tool schemas and dispatch, and the new tool should be visible through mediator, Rosi, and coach paths.
Assistant
One detail I’m tightening before finalizing: the input model should reject extra user_id or bot_id fields rather than silently ignoring them, so the no-override contract is enforced at schema validation too.
visibility='private'
visibility='dyad_shareable'
shareable_summary
The opt-in is shown until decided. While partner_share IS NULL, every render of that bot's hot context includes a "pending opt-in" slot in the system prompt asking the bot to raise the question this turn. As soon as the value is non-NULL (opt_in OR opt_out), the slot drops out and the bot stops raising it.
One shared prompt slot, used by every bot. Define one canonical pending-opt-in paragraph used by every bot's render_system_prompt. Rosi's existing _FIRST_CONTACT_V1 collapses into it; the mediator's onboarding language for cross-thread sharing also collapses into it. New bots inherit the slot for free — no per-bot prompt work.
One shared tool: set_partner_sharing(opt_in: bool). Implicit bot_id (from the calling bot's scope). Writes to user_bot_state.partner_share for the calling (user, bot) pair.
Migration: the existing global flag goes away. Backfill user_bot_state[bot_id='mediator', user_id=X].partner_share from users.cross_thread_sharing_default for every existing user, then drop users.cross_thread_sharing_default. One model, not two — no fallback path, no two-system-running period.
No per-row UX in v1. The user gets the per-bot toggle. The bot decides per-call whether a given memory/distillation should be private vs dyad_shareable based on the content. No user-facing per-row controls.
Hot context cross-bot pull is in scope. When rendering for user B (the partner of A), pull A's dyad_shareable rows from any bot where partner_share[A, that_bot] = 'opt_in', surfaced with a provenance prefix (e.g. from Rosi:). Same-bot dyad sharing (the existing mediator behaviour) keeps working unchanged in shape, just driven by the new column.
Files known to be relevant (planner should read at least these)
The planner should still survey the repo, but these are the focal points:
migrations/0012_cross_thread_sharing.sql — defines the global flag being retired.
app/services/tools/write_tools.py — add_memory (~line 776) and add_distillation (~line 1165). The add_memory write helper needs to accept visibility + shareable_summary.
app/services/tools/tool_schemas.py — AddMemoryInput needs new fields mirroring AddDistillationInput.visibility etc. (~line 996 for the distillation schema as the template).
app/bots/mediator.py and app/bots/tante_rosi.py — both need to (a) include the canonical pending-opt-in slot via their render_system_prompt, (b) be eligible to call set_partner_sharing. Rosi additionally needs prompt language about when to write dyad_shareable rows once opted in.
app/bots/prompts/tante_rosi.py (_FIRST_CONTACT_V1) and the equivalent mediator prompt file — the canonical slot replaces/absorbs whatever ask-the-user-about-sharing language already exists in each.
app/bots/ tool dispatch — wherever bot tool allowlists are wired, set_partner_sharing must be available to every bot (it's user-state-modifying, like set_pregnancy_edd, not domain-specific).
Invariants to enforce (must hold)
NULL → silent. When partner_share IS NULL, no content from that (user, bot) is shared with the partner regardless of per-row visibility. The toggle is the gate; per-row visibility only matters when the toggle is opt_in.
opt_out → silent. Same as NULL for the read path. The only difference is the prompt slot doesn't surface.
opt_in → per-row decides. When the toggle is opt_in, dyad_shareable rows from that bot flow to the partner; private rows don't.
No partner → moot. When the user has no partner (users.partner_user_id IS NULL), the prompt slot is suppressed even with partner_share IS NULL. Nothing to share to. Don't ask a question that has no answer.
No backsliding on the mediator. Every existing mediator user must continue to see exactly what they see today — the migration must be observationally equivalent. A user whose current cross_thread_sharing_default = 'opt_in' ends up with user_bot_state[mediator].partner_share = 'opt_in'; a user with 'opt_out' ends up 'opt_out'; NULL stays NULL.
Cross-bot pull is opt-in-gated, not opt-out-gated. Default is "don't show partner's other-bot content." Only 'opt_in' from the content owner unlocks the pull. This matters: a partner who hasn't decided cannot accidentally have their content surfaced because of someone else's default.
Tool authorisation.set_partner_sharing writes only to the calling user's row for the calling bot. A user calling Rosi cannot toggle their mediator state; Rosi cannot toggle Véas's state. Scope is (message.sender_id, message.bot_id).
The shareable_summary contract. When add_memory or add_distillation is called with visibility='dyad_shareable', shareable_summary must be non-null and non-empty. Reject the call otherwise. Same rule that already applies to distillations should now apply to memories.
Edge cases and ordering concerns
The planner should treat these as real, not paranoid:
Migration backfill ordering. The new column on user_bot_state must be added and backfilled before cross_thread_sharing_default is dropped. The hot-context read path must be flipped to the new column atomically with the drop, or the system briefly reads from a dropped column. Plan the migration as a single transaction or with explicit phasing.
Backfill for users without a user_bot_state[mediator] row. Some legacy users may not have a user_bot_state row for the mediator yet (it may be created lazily on first message). The migration must create rows for any user with a non-NULL cross_thread_sharing_default. For users with NULL global setting, decide: either create rows pre-set to NULL (explicit pending state) or skip (lazy creation later, still NULL). Either is defensible — make a call and write it down.
The pending slot wording is shared. Different bots have different voices. The shared slot must be voice-agnostic — short, neutral, instructive to the model, not user-facing copy. The bot's own voice handles the actual question to the user; the slot just tells the bot "raise this naturally this turn."
Cross-bot pull volume. A partner with several opted-in bots could see a long list of "from X:" rows in their hot context. Budget for hot-context length: cap, summarise, or rank. Don't ship a context bomb.
Order of cross-bot content. When pulling rows from multiple bots, by what order? By recency? By bot? Pick one and write it down so the reviewer can check it.
Provenance prefix format. "from Rosi:" / "from Véas:" — bake into a single helper, not sprinkled. Bots are named via the bot registry; use the registry's display name, not a hard-coded string.
Explicitly out of scope
Per-row visibility controls exposed to the user. (The bot decides per-row; users only decide per-bot.)
Re-asking after some time has passed. Once opt_in or opt_out is set, the slot stays gone. Future work, not this sprint.
New bot registration code. The pattern must work for new bots when they show up, but we are not adding a new bot in this sprint.
Per-topic granularity within a bot. Each bot is one domain; one toggle per bot is enough.
UI surfaces. There is no UI today and we are not building one.
Encryption-at-rest changes. shareable_summary on memories follows whatever the existing memory content encryption pattern is.
Success criteria
Reviewer should check, in priority order:
must
Migration adds user_bot_state.partner_share and backfills it from users.cross_thread_sharing_default for every user where the global flag was non-NULL, preserving the same value semantically ('opt_in' → 'opt_in', 'opt_out' → 'opt_out').
Migration adds memories.visibility (default 'private') and memories.shareable_summary (nullable) with a CHECK constraint matching the existing distillations one (shareable_summary required iff visibility='dyad_shareable').
Migration drops users.cross_thread_sharing_default only after the read path is updated.
cross_thread_privacy.raw_message_visibility() (and any other reader of the old column) reads from user_bot_state.partner_share for the relevant bot, not from users.cross_thread_sharing_default.
hot_context.py cross-bot pull lands: when rendering for partner B, B sees A's dyad_shareable memories and distillations from any bot where partner_share[A, that_bot]='opt_in', with a provenance prefix from the bot registry.
hot_context.py emits partner_sharing_state: 'pending' when partner_share IS NULL and the user has a partner; the canonical prompt slot is rendered into the system prompt of any bot whose hot context carries this signal.
set_partner_sharing tool exists, is wired into the tool registry for every bot, and updates user_bot_state.partner_share for the calling (user, bot) only.
add_memory accepts visibility and shareable_summary; rejects dyad_shareable without shareable_summary.
Rosi's prompt is updated so that when partner_share='opt_in', she writes dyad_shareable memories and distillations for non-sensitive facts (with appropriate shareable_summary).
Mediator's existing partner-sharing onboarding language is collapsed into the canonical slot; mediator continues to behave observationally as today for existing users post-migration.
Tests cover: NULL → no partner content visible; opt_out → no partner content visible; opt_in + private row → no partner content visible; opt_in + dyad_shareable row → partner content visible with provenance; cross-bot pull respects toggle independently per bot; user with no partner never sees the pending slot.
should
Cross-bot content ordering and length budget are explicit (chosen rule, written down in code or comment).
Migration is a single transaction or has explicit phasing documented.
The canonical prompt slot is defined in one place and imported by both bot prompt files.
info
Future work for re-asking or per-topic granularity is captured (e.g., as a ticket via megaplan ticket new) but not implemented.
Notes for the planner
Do not invent new bot-ID strings. Use the existing bot_id constants from app/bots/ids.py.
Do not gate behaviour on bot identity if it can be data-driven. The whole point is N bots; if Rosi gets a code path that Véas doesn't, that's a smell. The only legitimate per-bot differences are prompt content and topic, both of which are already data-driven.
The pending slot's prompt language matters. Write it once, write it well, and stop. Bots are instructed what to do (raise the question this turn), not how to phrase it — voice belongs to each bot.
The migration is the riskiest piece. Get the ordering and the backfill right and the rest is mechanical.
code
Batch framing:
- Execute batch 1 of 13.
- Actionable task IDs for this batch: ['T1']
- Already completed task IDs available as dependency context: []
Actionable tasks for this batch:
[
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[]
Prior batch deviations (address if applicable):
None
User action prerequisites:
No user_action prerequisites for this batch.
Batch-scoped sense checks:
[
{
"id": "SC1",
"task_id": "T1",
"question": "Does migration 0035_per_bot_partner_sharing.sql run in one transaction, seed tante_rosi, add constrained partner_share, backfill mediator non-NULL values exactly, add memory sharing fields/checks/indexes, and drop the old users column last?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in app/services/partner_sharing.py: normalize partner share values, fetch single/batch states from user_bot_state, upsert scoped (user_id, bot_id) state, resolve dyad partner via dyads/dyad_members, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update app/models/user.py, app/services/turn_context.py::partner_of, and app/staging.py so they no longer select, hydrate, pass, or depend on cross_thread_sharing_default; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T4",
"description": "Replace the legacy sharing tool with set_partner_sharing: update root tool_schemas.py, app/services/tools/write_tools.py, app/services/tools/registry.py, and app/services/tools/scope_guard.py; remove/deprecate update_cross_thread_sharing_default; ensure the new tool accepts only opt_in: bool plus optional reason and writes only (ctx.user.id, ctx.bot_id) via the shared helper.",
"depends_on": [
"T2",
"T3"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T5",
"description": "Run and act on a stale-reference sweep before deeper rewrites: use ; rewrite production hits to per-bot terminology or document intentional historical/test-only references.",
"depends_on": [
"T3",
"T4"
],
"status": "pending",
"kind": "audit",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T6",
"description": "Flip raw privacy decisions to partner-share terminology in : decision inputs/results should use owner for the relevant message bot, with NULL/unset and blocking partner-visible raw content and own-owner reads unchanged.",
"depends_on": [
"T2",
"T5"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T7",
"description": "Scope raw-message reads by bot/topic in and : recent/trigger/search/recent_activity paths must filter to current bot and active topic before applying privacy; and write-tool owner visibility checks must load partner-share keyed by each source row's or source message . Treat legacy NULL message bot IDs as hidden from partner raw reads.",
"depends_on": [
"T6"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T8",
"description": "Rewrite dyadic hot context partner-share state and cross-bot summary rendering in : add current/partner and , emit pending only when current user has a resolved dyad partner and current bot state is missing/NULL, remove the hardcoded urgent sharing block, pull partner memories/distillations from any opted-in bot, render only with shared provenance prefix, sort by recency across bots, and cap globally (for example 12 rows) with a code comment or test documenting the rule.",
"depends_on": [
"T2",
"T7"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T9",
"description": "Extend solo hot context in : resolve dyad partner existence through the shared helper, add current-bot and , suppress pending when no partner exists, and keep solo bots from exposing partner raw messages or partner memories.",
"depends_on": [
"T2",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T10",
"description": "Define one canonical pending partner-sharing prompt slot in . Keep it domain-agnostic and model-facing: raise the choice naturally this turn unless crisis/time-critical, call in the record step after an explicit choice, and do not share this bot's rows until opt-in.",
"depends_on": [
"T4",
"T8",
"T9"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T11",
"description": "Wire the canonical prompt slot through every bot prompt path: update , , , , , and so mediator, Tante Rosi, coach, and future solo bots receive /; replace stale mediator onboarding language and tool references; add only Rosi-specific guidance for safe pregnancy facts once opted in.",
"depends_on": [
"T10"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T12",
"description": "Extend memory and distillation write/read contracts: in root , add and to with a validator requiring non-empty summaries for ; update to persist and encrypt memory shareable summaries, keep superseded replacement behavior explicit, ensure writes , and update read/render paths so partner/cross-bot rows expose only summaries.",
"depends_on": [
"T4",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T13",
"description": "Update existing test infrastructure and regression tests in place. Extend fake pool/fixtures for , , message /, and memory sharing fields; update affected existing tests to remove the old user column; add or extend regression coverage for migration SQL, privacy matrix, cross-bot independence, raw-message bot isolation, prompt-slot pending/no-partner behavior, scoped Rosi success, and shareable-summary validation.",
"depends_on": [
"T1",
"T2",
"T7",
"T8",
"T9",
"T11",
"T12"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T14",
"description": "Final verification only: run the stale-reference sweeps and focused tests named by the approved plan, then the full relevant suite. Include commands such as , , , hot-context/read-tool tests, prompt/allowlist tests, and finally if focused tests pass. Also write a short throwaway script that reproduces the original leak/bug scenario (partner-share per bot: Rosi opt-in exposes only Rosi summaries while mediator opt-out blocks mediator rows and raw cross-bot messages), run it, record the result, and delete the script before finishing. Do not create new permanent test files in this final task; fix failures and rerun until passing or document a concrete blocker.",
"depends_on": [
"T13"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
],
"watch_items": [
"Do not invoke the CLI, read the skill, or start nested planning; treat this as a direct execution brief.",
"The migration is the highest-risk piece: seed before any Rosi write, backfill mediator non-NULL values before dropping the old users column, and keep the SQL transactional.",
"Raw messages must remain same-bot/topic scoped. Cross-bot partner sharing is summaries only, never raw .",
" and missing both mean pending for prompts but silent for read-path sharing; is silent and suppresses the prompt slot.",
"Partner resolution uses /, not .",
"Root is the schema target; there is no .",
"Use and source message as the gate key for artifacts. Do not gate Rosi artifacts with mediator partner-share or vice versa.",
"The provenance prefix must come from a shared helper using bot registry display names with DB/id fallback, not scattered hard-coded strings.",
"Cross-bot shareable rows need a fixed global cap and recency ordering documented in code or tests to avoid context bloat.",
"Do not make unrelated debt items worse, especially staging hot-context divergence and existing bot/topic routing assumptions.",
"Respect the write-access contract: attempt real edits and only report permission failure after an actual OS-level rejection and retry."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does migration run in one transaction, seed , add constrained , backfill mediator non-NULL values exactly, add memory sharing fields/checks/indexes, and drop the old users column last?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do all shared helpers use without silently creating arbitrary bot IDs, resolve dyad partner through /, and produce provenance from registry display names with fallback?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are , , and staging paths free of selects/hydration while still supplying prompt code with per-bot partner-share state where needed?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Is the only sharing-state write tool, with no user/bot input override and with allowlist/registry/scope guard wiring for mediator, Rosi, coach, and generic record/write steps?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does the grep sweep show no production dependence on the dropped user field or old tool, and are remaining strings intentional historical/test references or rewritten?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does preserve owner-visible behavior while partner visibility depends only on the owner's for the message's bot, with NULL/unset and blocking?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Can a mediator opt-in no longer expose Rosi raw messages through hot context, , or , including when legacy messages have NULL ?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC8",
"task_id": "T8",
"question": "Does dyadic hot context emit pending only for current user/current bot with a partner, pull opted-in cross-bot summaries only, use provenance prefixes, enforce recency ordering, and cap total cross-bot rows?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC9",
"task_id": "T9",
"question": "Does solo hot context ask about partner sharing only when a dyad partner exists and avoid exposing partner raw/messages/memories to solo bots?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC10",
"task_id": "T10",
"question": "Is the pending prompt slot defined once, neutral, domain-agnostic, and explicit about after an explicit choice?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC11",
"task_id": "T11",
"question": "Do mediator, Tante Rosi, coach, and generic solo prompt paths all render the canonical slot from and avoid stale language?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC12",
"task_id": "T12",
"question": "Does reject blank/missing for , persist/encrypt summaries, and do partner/cross-bot renders expose only while own same-bot reads retain full content as appropriate?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC13",
"task_id": "T13",
"question": "Do updated existing tests cover NULL, opt-out, opt-in+private, opt-in+dyad_shareable, independent per-bot gates, raw-message bot isolation, no-partner prompt suppression, Rosi FK success, and memory validation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC14",
"task_id": "T14",
"question": "Do the final grep sweeps, focused pytest commands, full suite or documented subset, and deleted throwaway reproduction script demonstrate the feature works without stale production references?",
"executor_note": "",
"verdict": ""
}
],
"user_actions": [
{
"id": "U1",
"description": "After the code is merged, apply the new database migration to the target staging/production database using the project's normal migration process, then deploy the matching application version atomically with that schema change.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "The repo executor can write and test the migration locally, but applying it to external environments and coordinating deploy order requires operator access.",
"requires_human_only_reason": null
},
{
"id": "U2",
"description": "After deployment, manually smoke test one dyad with mediator and Tante Rosi: pending prompt appears when undecided, records opt-in/out for the active bot only, and the partner sees only opted-in shareable summaries with provenance.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "Manual product smoke coverage catches prompt UX and live-data integration issues outside the local test harness.",
"requires_human_only_reason": null
}
],
"meta_commentary": "Execute in schema-first order, then remove the old user field everywhere before relying on the dropping migration. Keep the raw-message boundary strict: current-bot partner_share can unlock only same-bot/topic raw messages, while cross-bot sharing is summary-only and gated by the artifact owner\u2019s partner_share for the artifact\u2019s recorded bot. The main implementation trap is a partial migration/code split: do not leave production code reading after drops it. The second trap is prompt inheritance: wire the canonical slot through generic solo prompts so coach and future solo bots get it without bespoke work.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add Tante Rosi bot id constant and replace literals where appropriate.",
"finalize_item_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add migration with Rosi bot seed, partner_share, backfill, memory fields, indexes, and old-column drop.",
"finalize_item_ids": [
"T1",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 3: Add shared partner-sharing service for normalization, fetching, upsert, partner resolution, and provenance.",
"finalize_item_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Update user model, turn context, and staging to remove global sharing field and use per-bot state.",
"finalize_item_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Replace old sharing tool and registry/scope references with .",
"finalize_item_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Run stale-reference sweep for old sharing names before deeper rewrites.",
"finalize_item_ids": [
"T5",
"T14"
]
},
{
"plan_step_summary": "Step 7: Flip pure privacy decisions to use per-bot partner_share.",
"finalize_item_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Scope dyadic raw-message reads by bot/topic in hot context and read tools.",
"finalize_item_ids": [
"T7",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 9: Rewrite dyadic hot-context partner-share state and labels.",
"finalize_item_ids": [
"T8"
]
},
{
"plan_step_summary": "Step 10: Add cross-bot shareable-summary pull with provenance, recency ordering, and cap.",
"finalize_item_ids": [
"T8",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 11: Extend solo hot context with current-bot partner-share pending state and no partner content exposure.",
"finalize_item_ids": [
"T9"
]
},
{
"plan_step_summary": "Step 12: Add canonical pending partner-sharing prompt slot once.",
"finalize_item_ids": [
"T10"
]
},
{
"plan_step_summary": "Step 13: Wire canonical slot through mediator, generic solo/coach, and Tante Rosi prompt paths.",
"finalize_item_ids": [
"T11"
]
},
{
"plan_step_summary": "Step 14: Extend memory tool schema/write path with visibility and shareable summary validation/persistence.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 15: Keep distillation contract bot-scoped and render partner/cross-bot rows as summaries only.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 16: Update fake pool and existing fixtures/tests for bots, user_bot_state.partner_share, message bot/topic, and removed users column.",
"finalize_item_ids": [
"T13"
]
},
{
"plan_step_summary": "Step 17: Add focused regression coverage for migration, privacy matrix, cross-bot independence, raw-message isolation, prompt slots, tools, and memory validation.",
"finalize_item_ids": [
"T13",
"T14"
]
},
{
"plan_step_summary": "Execution order and validation order: run stale-reference sweeps, focused pytest commands, full suite, and a throwaway reproduction script before finalizing.",
"finalize_item_ids": [
"T14"
]
},
{
"plan_step_summary": "External rollout: apply migration/deploy and manual smoke test outside the local repo executor.",
"finalize_item_ids": [
"U1",
"U2"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All approved numbered steps are mapped to execution tasks. The final task is intentionally verification-only and includes the required throwaway reproduction script, which must be deleted before completion. External DB migration/deploy and live smoke testing are captured as user actions because they require operator access outside repo editing.",
"coverage_complete": true
},
"baseline_test_failures": [],
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_note": "No baseline test run is part of finalization; executor should run the focused and full test commands in T14 after implementation."
}
code
Debt watch items (do not make these worse):
[DEBT] all-locations: all_locations: staging.py:47 calls build_hot_context without the new allow_cross_topic_peek/allow_cross_topic_status_injection flags. since these default to false, staging replay of the mediator bot will not exercise cross-topic paths, diverging from production behavior where mediator has both flags true. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan’s scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standard unique (transport, address, guild_id, channel_id) constraint on raw columns. postgresql on conflict target lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs like coalesce in the target list do not match a raw-column unique constraint and will raise a syntax or 'no unique or exclusion constraint matching the on conflict specification' error at runtime. the seed script will fail unless either (a) the table is changed to use an expression-based unique index with those exact coalesce expressions, or (b) the seed script is rewritten to query-first/insert-if-missing or uses the plain column names and accepts the null-handling semantics of the constraint. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: phase b cte pair (ins and src) requires identical where/order/limit clauses for cursor correctness. both are written aligned but nothing enforces the invariant during executor edits; drift would silently mis-advance cursor. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5.1 says dyad_id is appended before the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed by current_step: turnstep = "respond" at the next line. placement intent is clear (append at end of optional block), but the line reference may drift after the field is added. minor precision wobble; not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: eval baseline capture (step 2) is technically blocked by infra. the plan's approach (write script in main tree, copy to worktree, run there) assumes python scripts/capture_eval_baseline.py can connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserve set search_path across connection acquisitions, so the script would fail with schema lookup errors. the plan should add an alternative path (port 5432 session-mode override, or explicit schema-qualified queries everywhere, or defer entirely). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the lint script scripts/lint_inserts.py has a directory-not-found error path at lines 305-309 that still exits 0. the plan step 13 says to remove the # todo(s2b) marker at line 308 but does not mention changing the sys.exit(0) at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid --dir argument (or when args.dir resolves to a non-existent path) will silently exit 0. this defeats the ci-blocking intent because a typo in the scan directory would be treated as success instead of failure. the fix is trivial: change sys.exit(0) to sys.exit(1) at line 309 (or remove the error-path todo and update the exit code in the same step). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 4.5's _row_matches_topic helper falls back to global behavior when (table, id) is not in self.artifact_topics — explicitly for backward compatibility. this is sensible but creates a subtle hazard: a test that forgets to call link_topic for a new artifact sees global decay behavior with no warning, which could mask the very scoping bug the new test in step 12 is meant to catch. the decay scope test does call link_topic for both topics, so it's safe; future authors may not. worth recording but not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: flag-017 (decay handler backward-compat fallback) is downgraded to accepted maintainability debt with an inline warning comment per step 4.5. the warning text explicitly tells future authors to call link_topic. acceptable, but a noisy assertion (e.g. log a warning when topic_id present in sql but row has no link) would catch silent regressions more loudly. not blocking. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 11 sql returns last_updated_at, but settopicstatusoutput field is named updated_at. the executor needs to alias on read (e.g., row['last_updated_at']). minor mapping point, not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 18 coach botspec writes tool_allowlist=frozenset({...}) - frozenset({'set_topic_status'}) with {...} as a placeholder. the executor needs to know what set to start from (probably the union of step_allowed_tools). this is under-specified; the executor will likely just use 'all tools currently in tool_dispatch minus set_topic_status', which is fine, but worth pinning. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: botspec.render_system_prompt at app/bots/base.py:63-79 unpacks partner.name and partner.cross_thread_sharing_default positionally before delegating to the renderer. plan step 6 passes partner=none for solo turns and assumption #5 says base.py does not need modification. the **kwargs trick in the solo renderer cannot help — attributeerror fires inside botspec.render_system_prompt before the renderer runs. plan must commit to patching base.py (or route solo turn around botspec.render_system_prompt). (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 6 parameterizes topic_id at agentic.py:753 (event metadata) and 778 (turncontext.primary_topic_id) but omits line 737 where _open_turn(..., topic_id=get_relationship_topic_id(), ...) is hardcoded. without patching line 737, persisted turn rows for coach carry topic_id=relationship — directly trips stop condition solo bot writes to mediator's relationship topic in any test. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-041): are the proposed changes technically correct?: botspec.render_system_prompt unpacks partner.name positionally before delegating; partner=none still breaks regardless of solo renderer **kwargs. plan is unchanged from prior critique. carrying as accepted debt per guidance. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-042): are the proposed changes technically correct?: step 6 still omits agentic.py:737 (the _open_turn topic_id kwarg). same gap as prior iteration; trips stop condition if not addressed by executor. carrying as accepted debt. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5's mid-turn refresh refetches user inside the same db transaction (for update held). if the refresh uses fetch_user_by_id rather than dataclasses.replace, it issues a select through the pool while the same connection holds the lock — with asyncpg pools this can deadlock unless the same acquired connection is reused. plan offers both options without specifying which connection the re-fetch uses. dataclasses.replace avoids this entirely; if executor picks fetch_user_by_id, lock contention risk is real. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 2.5 says to copy the 8 new fields through the post-resolve user rebuild in fetch_user_by_id l.152-160. with 8 fields plus existing ones, the constructor call grows long and is easy to miss a field. using dataclasses.replace(user, phone=resolved) would be cleaner and forward-compatible — plan instead keeps the verbose pattern. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the scripts/seed_channels.py plan uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration creates a plain unique (transport, address, guild_id, channel_id) constraint. postgresql requires the on conflict target to match a unique constraint or index exactly; an expression-based target without a matching expression index will raise a runtime error. additionally, the raw unique constraint treats nulls as distinct, so it cannot deduplicate whatsapp channels where guild_id and channel_id are null. the executor must either add a matching unique expression index in 0020, or rewrite the seed script to use a pre-insert select check instead of on conflict. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the 0020 migration plan for user_identities omits the verified_at timestamptz column present in architecture doc §12.2 ddl, while claiming 'exactly per §3/§12 ddl'. since account-linking workflows are deferred beyond s1, the column is not functionally load-bearing yet, but the claim of exact ddl match is incorrect. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the resolve_binding sql in app/services/routing.py uses limit 1 without order by. if a user ever has both a solo binding and a dyad binding to the same bot, the returned row is non-deterministic. the schema has no unique constraint preventing multiple bindings per (bot_id, user_id). since s1 only seeds one dyad binding and the module is not wired into inbound yet, this is latent future risk rather than an immediate s1 blocker. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user notes #1/#2 asked to restructure user_actions.md (split t14, move u1 to after execute). the plan addresses the spirit via execution order but does not enumerate user_actions.md content changes. if the harness consumes a separate user_actions.md, it may still reflect pre-revision ordering. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: verified step 8.1 names the scheduler claim query precisely at scheduled_jobs.py:104 (_claim_due_jobs). the plan cites returning lines 124-125 but the actual file has the returning list at lines 126-127 (off by ~2 because the plan was computed against a stale snapshot). executor will still find the right block, but the precise line offset is wrong. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the user note explicitly directs: t2 (eval baseline capture) is blocked by supabase transaction-mode pooler — set search_path doesn't persist across pooled connections — and must be deferred, with sprint proceeding on t6–t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task with phase 0 must run first execution order. plan body and execution order do not reflect the deferral; executor will block on it. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: validation order steps 1 and 11 still reference the eval baseline (tests/fixtures/eval_baseline/ populated; final python -m evals run diff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-run python -m evals run --prompt-version v1; diff against tests/fixtures/eval_baseline/'. if t2 is deferred there is no baseline to diff against; this step needs to be conditioned on baseline availability or removed. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: advisory: lint_inserts.py line 325 still contains the comment '# always exit 0 in s2a (advisory).' which will become stale after step 13 makes the linter blocking. the adjacent line 326 todo(s2b) is removed, but this stale advisory comment is not mentioned in the plan. it is cosmetic and will be obvious to the executor when editing line 327, but it is a minor maintainability drift. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: q1 resolved by stashing tool_schemas.py first (step 21.2) and q4 resolved by numbered 0031 migration with in-sql guard — but the stash-pop-at-end plan introduces a new risk: sprint edits to tool_schemas.py will conflict with the stashed dirty diff on pop. plan should either drop the stashed tool_schemas.py changes outright or note that conflict resolution is the executor's responsibility. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user note defers t16 (preflight: staging seed + consenting uuid) with explicit instruction to proceed on code-only items 1-8 and treat preflight as pass with todo comments. plan step 9 already gates prod-promotion behind staging verification and falls back to a feedback.md todo — consistent with the deferral. plan does not however explicitly add 'todo comments in coach scaffold code referencing the operator decision' as the user note requests; executor should add a todo marker in app/bots/coach.py per the note. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: recurring debt: did the work fully address: step 11 option b reads enablement from the bots table assuming a row like id='tante_rosi', enabled=true, but migrations/0020_topics_bots_bindings.sql defines bots(id, display_name, created_at) — there is no enabled column. either an extra migration must add the column, or the gate must rely on row existence. plan picks option b as recommended but does neither explicitly. (flagged 1 times across 1 plans)
[DEBT] discord-ingress: exact discord converter/signature edit is not named in the plan. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool with channels, user_identities, bot_bindings, dyads, and dyad_members dicts so the sql patterns in resolve_bot, resolve_sender, and resolve_binding can match against stored rows. however, tests/conftest.py is explicitly listed in the brief as a dirty file that must not be touched. the revised plan says "extend fakepool minimally" twice (step 9 and step 11 assumption) but never specifies how to do so without modifying conftest.py—for example by defining a local routingfakepool(fakepool) subclass inside tests/test_routing.py or by monkeypatching the class in that test module. if the executor follows the plan literally and edits conftest.py, they will violate a locked constraint. if they do not extend fakepool, the routing unit tests cannot be implemented as written. this is a supporting-infrastructure gap. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: step 3 updates scripts/seed_channels.py to import _decode_discord_user_id from the new shared module. the seeder also previously had a regex _discord_bot_user_id_re constant (or similar) inline; if the seeder's local regex remains while the new module redefines it, the two could drift. plan should explicitly say the seeder deletes its local copy. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters but paused_for_user does not currently call logger.* (verified by reading hooks.py). the plan instructs to log extra={user_id, bot_id} — if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: scripts/capture_eval_baseline.py is still listed as a deliverable (step 2.1) and a smoke test (step 2.7 --help invocation). if t2 is deferred, the script could either (a) not be written, or (b) be written but its run deferred. plan should specify which. the smoke test alone (--help) does not require the pooler. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 0 contains both step 1 (parity + identity seeding pre-flight) and step 2 (eval baseline). step 1 is independent of the pooler block — it queries via psql or any working connection — and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: get_relationship_topic_id() is referenced in agentic.py at lines 719, 737, 753, 778. step 6 covers 719/721, 753, 767/778, 793 but not 737. same gap as correctness finding — _open_turn's topic_id kwarg must also be parameterized. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: recurring debt (debt-045): does the change touch all locations: get_relationship_topic_id() at agentic.py:737 still not in step 6's enumeration. same as debt-042. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan does not specify that step 5's coach scaffold should carry a todo comment referencing the deferred t16 preflight (operator-held uuid + staging seed verification) per the new user note. minor scope addition the executor must remember. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan mentions updating app/staging.py:47 'if it calls build_hot_context'. staging.py:47 does call build_hot_context with primary_topic_id=get_relationship_topic_id(). the new allow_cross_topic_peek and allow_cross_topic_status_injection parameters default to false. since staging replay exercises the mediator bot (which has both flags true in its spec), leaving staging.py unchanged means cross-topic peek/status injection is not exercised during staging replay, causing divergence from production behavior. the plan should explicitly state what values to pass. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan's step 7d updates _render_with_counts for dyadic rendering but does not explicitly mention updating _render_solo_with_counts in hot_context_solo.py for the solo cross_topic_peek block. since render_hot_context_solo delegates actual text generation to _render_solo_with_counts, the cross_topic_peek block must be added there. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 8 places the pregnancy block in solo hot context gated on bot_id == 'tante_rosi'. the bot_id is read from where? hot_context_solo.py builders typically take a botspec / topic, not a bare bot_id string. plan doesn't enumerate where the gate condition is plumbed from. minor but executor needs clarity. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: new issue: the 0020 migration ddl defines channels with unique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows with guild_id=null, channel_id=null and the same transport+address would not conflict. however, scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, which requires a matching unique index on those coalesce expressions. without it, the seed script will raise 'there is no unique or exclusion constraint matching the on conflict specification'. the ddl should either use unique nulls not distinct (pg15+, and the repo uses pg16 per test_eval_workflow.py:36) or a unique index on the coalesce expressions. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 adds bot_id kwarg to hooks.paused_for_user. callers grep shows it is called from various places; the plan only enumerates messaging.py:170,335 as new bot_id-passing sites. other callers continue to call without bot_id (none default), which is fine, but plan should call out that all existing callers continue to work without modification. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: evals.runner.run_scenarios is referenced by the deferred step 2.1; plan doesn't enumerate that runner's callers or its schema dependencies. since step 2 is being deferred, this is moot — but if the script is still authored as a step 2.1 deliverable, it must not import anything that hits the pooler at import time. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 strips bot_spec defaults from tests/_scope_helpers.py:make_mediator_ctx, which has six call sites across tests/test_s2a_stamping.py (5 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that rely on the implicit default. the executor must update all six call sites to pass bot_spec explicitly. however, plan step 20's stop-condition nuance lists only steps 14–17 as the 'intentional-update list' and omits step 18. if the executor misses a call site and those tests fail, the stop condition text would classify the failure as 'unexpected' and trigger stop, even though the root cause is an incomplete step 18 execution. the stop condition should explicitly include step 18 (or enumerate test_s2a_stamping.py and test_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 5.3 read-gate behavior on error path: returns <outputmodel>(is_error=true, error=err, ...) with 'populate empty lists'. different read tools have different output shapes (some return single objects e.g. get_theme, get_self_model). plan says 'exact empty-output shape is per-tool' — but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: botspec.render_system_prompt has exactly one caller — agentic.py:721. step 6 passes partner=none for solo. the base method unpacks partner.name positionally; partner=none breaks the call regardless of solo renderer signature. the single caller passes a value the method cannot currently handle without a base.py edit. (flagged 2 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the plan updates agentic.py:722-725 (solo path) and 729-732 (dyad path) to pass allow_cross_topic_peek and allow_cross_topic_status_injection flags. however, the staging.py:47 call site is mentioned only as a vague 'if it calls build_hot_context' note. staging replay for mediator should pass allow_cross_topic_peek=true and allow_cross_topic_status_injection=true to mirror production, but the plan does not commit to this. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 10.3's early-return contract is loose ('analogous early-return matching the tool's return contract'). each of edit_message/delete_message/react_to_message returns a distinct outputmodel; the executor needs to construct the right model with action='unsupported' or similar. minor under-specification but the tools' existing 'unsupported' / 'not_found' return shapes provide an obvious template. (flagged 1 times across 1 plans)
[DEBT] inbound-boundary: full scope construction happens after user resolution rather than literally in gateway handlers. (flagged 1 times across 1 plans)
[DEBT] issue-hints-completeness: issue_hints / completeness: user note explicitly defers t2 (eval baseline capture) due to supabase transaction-mode pooler not preserving set search_path. plan still has step 2 in phase 0 as a gating task, with phase 0 listed first in execution order and the final validation order step diffing against the baseline. plan body must be updated to mark step 2 as deferred, downgrade the related success criterion from 'must' to 'should/deferred', and remove the post-stamp diff from the must-do validation list. (flagged 1 times across 1 plans)
[DEBT] scope: scope: the plan adds cross_topic_peek to hotcontextsolo but does not explicitly update the copy constructor inside render_hot_context_solo (hot_context_solo.py:706-723) or the _render_solo_with_counts rendering function. if the dataclass field is added but the copy constructor omits it, peek data is silently lost during solo rendering. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.2 ddl for user_identities includes a verified_at timestamptz column. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a future alter table user_identities add column verified_at is required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.1 ddl for channels includes config jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. like verified_at, this is a small additive column that should be created now to match the locked schema; deferring it requires a later migration. the executor should add the column to the 0020 ddl. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claims populate_mediator_spec_from_db(pool) reads 'db-populated fields' for primary_topic_slug, participants_shape, read_scopes, etc. however, the bots table ddl in the plan only defines id, display_name, and created_at — none of the botspec scope fields have db columns. in practice the function will hardcode mediator defaults (primary_topic_slug='relationship', participants_shape='dyad') and only read display_name from the db row. the plan's wording could mislead the executor into writing a select * from bots expecting columns that do not exist. the implementation should explicitly select only display_name and hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns on bots, so hardcoding is correct for s1, but the plan text should be clarified. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief §16.1 work item 1 explicitly requires 'channel rows for current discord + whatsapp' seeded inside migration 0020. the revised plan instead moves channel seeding to a runtime script scripts/seed_channels.py. while the rationale (env vars differ across environments) is pragmatic, this is a concrete divergence from the locked architecture-doc brief which the plan must consume, not override. if the executor applies only the sql migrations, the channels table will be empty and routing will have no rows to resolve, breaking the mid-sprint checkpoint 'channel rows for current discord + whatsapp' gate. the runtime script must be documented as a mandatory post-migration step, but the brief expected it in the migration itself. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: debt-005/006/007/010: verified_at and channels.config jsonb added to 0020; step 10 clarifies populate_mediator_spec_from_db reads only display_name; channel seeding documented as mandatory post-migration script. debt-010 remains a literal divergence from §16.1 'channels seeded in migration 0020' wording but is now explicitly explained. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 13.2 adds optional bot_id kwarg to hooks.paused_for_user but the function's body still calls system_state.is_paused(_pool) only (global). the added parameter is wired in but not consumed in s2a — essentially a dead parameter until s2b. plan does not explicitly say so; executor may either leave it unused or call user_bot_paused. worth flagging for clarity. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: user note's deferral applies only to t2 (eval baseline). the core s2a deliverable — stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause — is independent of t2 and proceeds. plan does not currently distinguish; deferring t2 requires explicit text saying 'phase 0 step 2 is deferred to s3 pre-flight or end-of-sprint manual capture'. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: eval-baseline-related criteria in the success_criteria list (criterion 13: 'eval baseline captured by writing scripts/capture_eval_baseline.py ...') will be unmeetable if t2 is deferred. plan should downgrade that criterion's priority from 'must' to 'should' or mark deferred. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 18 instructs the executor to grep for bot_spec= to enumerate fixture defaults, but this pattern misses the actual signature default bot_spec: botspec | none = none in tests/_scope_helpers.py:35. there are 7 call sites across tests/test_s2a_stamping.py (6 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that invoke make_mediator_ctx() without passing bot_spec and rely on that default. because the grep won't surface the signature default, the executor may miss stripping it and updating the call sites, leaving the 'should' criterion partially unmet. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: write_tools.py has direct updates on all six artifact tables. plan defers these to s6 (defensible) but does not note that update-form direct accesses persist by design and the new from-form lint regex will not catch them. worth recording so s6 scope is unambiguous. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: partner_of is also called at inbound.py:130 (_control_recipients for pause/resume) and staging.py:32. plan step 6 only patches the runner. inbound.py:130 catches valueerror with a warning, so solo pause/resume logs a benign warning, but brief stop condition partner_of called for participants_shape==solo in any code path is strictly broader. plan should narrow the stop condition or patch inbound. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: brief locked decision #5 asks to verify resolve_bot returns coach for the coach's transport. migration 0031 explicitly defers channel seeding. plan includes no routing verification step — step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-043): search for related code: partner_of calls at inbound.py:130 and staging.py:32 remain unaddressed by step 6. valueerror catch in inbound makes it benign in practice but the brief stop condition is broader. plan unchanged. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-044): search for related code: resolve_bot routing for coach's transport is still unverified; channel seeding deferred in migration 0031 lines 31-33. plan adds no routing smoke step. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan adds cross_topic_peek to hotcontextsolo and says to update render_hot_context_solo, but render_hot_context_solo (hot_context_solo.py:706-723) constructs an explicit hotcontextsolo(...) copy with field-by-field assignment. if cross_topic_peek is added to the dataclass but not to this copy constructor, the peek data is silently dropped during solo rendering. the plan does not explicitly mention updating the copy constructor inside render_hot_context_solo. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan says 'similarly update render_hot_context_solo in hot_context_solo.py for cross_topic_peek only' but the actual text rendering for solo happens in _render_solo_with_counts (hot_context_solo.py:561), not in render_hot_context_solo (which only handles truncation). the plan does not explicitly mention adding the cross_topic_peek block to _render_solo_with_counts, creating ambiguity about where the solo rendering change belongs. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 2.4 says to grep for select.*from users\|_row_to_user to find other hydration sites. but there are likely selects that go through mediator.users schema-prefixed (per repo conventions) or use from_row/update … returning patterns that the regex would miss. the defensive if col in row fallback in _row_to_user catches missed sites at runtime (returns none) but means renders will silently show no pregnancy state from those code paths. worth surfacing. (flagged 1 times across 1 plans)
[DEBT] tests: old-behavior test file is not explicitly named. (flagged 1 times across 1 plans)
[DEBT] untagged: step 11 (prod-registration via bots table) reads a non-existent enabled column from bots (schema is id, display_name, created_at per 0020_topics_bots_bindings.sql). plan recommends option b but never adds a migration for the column or specifies row-existence as the gate. (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: standard.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T1]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC1]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/Veas/.megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_1.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
{"output":"Executed batch 1 / T1. Added the Tante Rosi bot id constant, updated touched bot registry/spec references, created the transactional 0035 migration, and checkpointed batch progress under .megaplan. Focused verification passed; full pytest was run and failed in unrelated existing-looking agentic/decay tests.","files_changed":["app/bots/ids.py","app/bots/registry.py","app/bots/tante_rosi.py","migrations/0035_per_bot_partner_sharing.sql",".megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_1.json"],"commands_run":["python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q","rg -n "cross_thread_sharing_default|partner_share|visibility|shareable_summary|tante_rosi" migrations/0035_per_bot_partner_sharing.sql app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py","python - <<'PY'\nfrom pathlib import Path\nsql = Path('migrations/0035_per_bot_partner_sharing.sql').read_text()\nprint(sql.count('BEGIN;'), sql.count('COMMIT;'))\nprint('drop_pos', sql.rfind('DROP COLUMN cross_thread_sharing_default'))\nprint('backfill_pos', sql.find('INSERT INTO user_bot_state'))\nprint('mem_pos', sql.find('ALTER TABLE memories'))\nPY","python - <<'PY'\ntry:\n import pglast\nexcept Exception as e:\n print(f'pglast unavailable: {e.class.name}: {e}')\nelse:\n from pathlib import Path\n pglast.parse_sql(Path('migrations/0035_per_bot_partner_sharing.sql').read_text())\n print('pglast parse ok')\nPY","pytest -q","pytest tests/test_agentic.py -q","pytest tests/test_decay.py -q","python -m black app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py"],"deviations":["Full test suite did not pass: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob still fails looking for a fake-pool read:list_themes event; tests/test_decay.py has 3 failures on an unhandled fake-pool UPDATE after Anthropic 401 during observation rescoring. These appear unrelated to T1 schema/constants changes."],"task_updates":[{"task_id":"T1","status":"done","executor_notes":"Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.","files_changed":["app/bots/ids.py","app/bots/registry.py","app/bots/tante_rosi.py","migrations/0035_per_bot_partner_sharing.sql"],"commands_run":["python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py","pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q","pytest -q","pytest tests/test_agentic.py -q","pytest tests/test_decay.py -q"],"auto_attributed_files":false}],"sense_check_acknowledgments":[{"sense_check_id":"SC1","executor_note":"Yes. Migration 0035 is transactional, seeds tante_rosi, constrains partner_share, backfills non-NULL mediator sharing values exactly from the legacy user column before dropping it, adds constrained memory sharing fields plus encrypted summary storage and indexes, and drops users.cross_thread_sharing_default last."}]}
The Veas codebase runs N bots that each occupy a "domain" for a user (currently: mediator = relationship coach for a dyad on topic=relationship; tante_rosi = solo pregnancy coach on topic=pregnancy; more bots planned). Today only the mediator's content can flow between dyad partners, gated by a global opt-in (users.cross_thread_sharing_default). The pregnancy coach writes everything private; her facts cannot reach the partner even when the user wants to share them.
We want to generalise partner-sharing so that every bot (current and future) can produce content that the user's partner sees, gated by a per-bot opt-in. The user gets one switch per domain ("share my pregnancy stuff with my partner — yes / no / not decided yet"). Until they decide, the bot keeps surfacing the question.
The basic infrastructure already exists for distillations (visibility: private | dyad_shareable, shareable_summary, raw_message_visibility() filtering in app/services/cross_thread_privacy.py, app/services/hot_context.py:500-577). The work below generalises it across both bots-and-content-types, and replaces the global toggle with a per-bot one.
Goal (one sentence)
Replace the single global users.cross_thread_sharing_default with per-bot opt-in state on user_bot_state, extend dyad_shareable visibility to memories (today it only exists on distillations), and rewire the hot-context read path so a partner sees dyad_shareable content from any bot where the content's owner has opted in for that bot — with NULL ("not decided") triggering a prompt-slot the bot uses to ask.
Decisions already made (do not re-litigate)
These are settled — the plan should implement them, not re-debate them.
Per-bot opt-in lives on user_bot_state as one new column partner_share text with values 'opt_in' | 'opt_out' | NULL. NULL = "pending, must ask". Key is (user_id, bot_id) — same shape as every other per-bot state today.
Memories get visibility and shareable_summary mirroring distillations exactly. Default visibility='private'. When visibility='dyad_shareable', shareable_summary is required.
The opt-in is shown until decided. While partner_share IS NULL, every render of that bot's hot context includes a "pending opt-in" slot in the system prompt asking the bot to raise the question this turn. As soon as the value is non-NULL (opt_in OR opt_out), the slot drops out and the bot stops raising it.
One shared prompt slot, used by every bot. Define one canonical pending-opt-in paragraph used by every bot's render_system_prompt. Rosi's existing _FIRST_CONTACT_V1 collapses into it; the mediator's onboarding language for cross-thread sharing also collapses into it. New bots inherit the slot for free — no per-bot prompt work.
One shared tool: set_partner_sharing(opt_in: bool). Implicit bot_id (from the calling bot's scope). Writes to user_bot_state.partner_share for the calling (user, bot) pair.
Migration: the existing global flag goes away. Backfill user_bot_state[bot_id='mediator', user_id=X].partner_share from users.cross_thread_sharing_default for every existing user, then drop users.cross_thread_sharing_default. One model, not two — no fallback path, no two-system-running period.
No per-row UX in v1. The user gets the per-bot toggle. The bot decides per-call whether a given memory/distillation should be private vs dyad_shareable based on the content. No user-facing per-row controls.
Hot context cross-bot pull is in scope. When rendering for user B (the partner of A), pull A's dyad_shareable rows from any bot where partner_share[A, that_bot] = 'opt_in', surfaced with a provenance prefix (e.g. from Rosi:). Same-bot dyad sharing (the existing mediator behaviour) keeps working unchanged in shape, just driven by the new column.
Files known to be relevant (planner should read at least these)
The planner should still survey the repo, but these are the focal points:
migrations/0012_cross_thread_sharing.sql — defines the global flag being retired.
app/services/tools/write_tools.py — add_memory (~line 776) and add_distillation (~line 1165). The add_memory write helper needs to accept visibility + shareable_summary.
app/services/tools/tool_schemas.py — AddMemoryInput needs new fields mirroring AddDistillationInput.visibility etc. (~line 996 for the distillation schema as the template).
app/bots/mediator.py and app/bots/tante_rosi.py — both need to (a) include the canonical pending-opt-in slot via their render_system_prompt, (b) be eligible to call set_partner_sharing. Rosi additionally needs prompt language about when to write dyad_shareable rows once opted in.
app/bots/prompts/tante_rosi.py (_FIRST_CONTACT_V1) and the equivalent mediator prompt file — the canonical slot replaces/absorbs whatever ask-the-user-about-sharing language already exists in each.
app/bots/ tool dispatch — wherever bot tool allowlists are wired, set_partner_sharing must be available to every bot (it's user-state-modifying, like set_pregnancy_edd, not domain-specific).
Invariants to enforce (must hold)
NULL → silent. When partner_share IS NULL, no content from that (user, bot) is shared with the partner regardless of per-row visibility. The toggle is the gate; per-row visibility only matters when the toggle is opt_in.
opt_out → silent. Same as NULL for the read path. The only difference is the prompt slot doesn't surface.
opt_in → per-row decides. When the toggle is opt_in, dyad_shareable rows from that bot flow to the partner; private rows don't.
No partner → moot. When the user has no partner (users.partner_user_id IS NULL), the prompt slot is suppressed even with partner_share IS NULL. Nothing to share to. Don't ask a question that has no answer.
No backsliding on the mediator. Every existing mediator user must continue to see exactly what they see today — the migration must be observationally equivalent. A user whose current cross_thread_sharing_default = 'opt_in' ends up with user_bot_state[mediator].partner_share = 'opt_in'; a user with 'opt_out' ends up 'opt_out'; NULL stays NULL.
Cross-bot pull is opt-in-gated, not opt-out-gated. Default is "don't show partner's other-bot content." Only 'opt_in' from the content owner unlocks the pull. This matters: a partner who hasn't decided cannot accidentally have their content surfaced because of someone else's default.
Tool authorisation.set_partner_sharing writes only to the calling user's row for the calling bot. A user calling Rosi cannot toggle their mediator state; Rosi cannot toggle Véas's state. Scope is (message.sender_id, message.bot_id).
The shareable_summary contract. When add_memory or add_distillation is called with visibility='dyad_shareable', shareable_summary must be non-null and non-empty. Reject the call otherwise. Same rule that already applies to distillations should now apply to memories.
Edge cases and ordering concerns
The planner should treat these as real, not paranoid:
Migration backfill ordering. The new column on user_bot_state must be added and backfilled before cross_thread_sharing_default is dropped. The hot-context read path must be flipped to the new column atomically with the drop, or the system briefly reads from a dropped column. Plan the migration as a single transaction or with explicit phasing.
Backfill for users without a user_bot_state[mediator] row. Some legacy users may not have a user_bot_state row for the mediator yet (it may be created lazily on first message). The migration must create rows for any user with a non-NULL cross_thread_sharing_default. For users with NULL global setting, decide: either create rows pre-set to NULL (explicit pending state) or skip (lazy creation later, still NULL). Either is defensible — make a call and write it down.
The pending slot wording is shared. Different bots have different voices. The shared slot must be voice-agnostic — short, neutral, instructive to the model, not user-facing copy. The bot's own voice handles the actual question to the user; the slot just tells the bot "raise this naturally this turn."
Cross-bot pull volume. A partner with several opted-in bots could see a long list of "from X:" rows in their hot context. Budget for hot-context length: cap, summarise, or rank. Don't ship a context bomb.
Order of cross-bot content. When pulling rows from multiple bots, by what order? By recency? By bot? Pick one and write it down so the reviewer can check it.
Provenance prefix format. "from Rosi:" / "from Véas:" — bake into a single helper, not sprinkled. Bots are named via the bot registry; use the registry's display name, not a hard-coded string.
Explicitly out of scope
Per-row visibility controls exposed to the user. (The bot decides per-row; users only decide per-bot.)
Re-asking after some time has passed. Once opt_in or opt_out is set, the slot stays gone. Future work, not this sprint.
New bot registration code. The pattern must work for new bots when they show up, but we are not adding a new bot in this sprint.
Per-topic granularity within a bot. Each bot is one domain; one toggle per bot is enough.
UI surfaces. There is no UI today and we are not building one.
Encryption-at-rest changes. shareable_summary on memories follows whatever the existing memory content encryption pattern is.
Success criteria
Reviewer should check, in priority order:
must
Migration adds user_bot_state.partner_share and backfills it from users.cross_thread_sharing_default for every user where the global flag was non-NULL, preserving the same value semantically ('opt_in' → 'opt_in', 'opt_out' → 'opt_out').
Migration adds memories.visibility (default 'private') and memories.shareable_summary (nullable) with a CHECK constraint matching the existing distillations one (shareable_summary required iff visibility='dyad_shareable').
Migration drops users.cross_thread_sharing_default only after the read path is updated.
cross_thread_privacy.raw_message_visibility() (and any other reader of the old column) reads from user_bot_state.partner_share for the relevant bot, not from users.cross_thread_sharing_default.
hot_context.py cross-bot pull lands: when rendering for partner B, B sees A's dyad_shareable memories and distillations from any bot where partner_share[A, that_bot]='opt_in', with a provenance prefix from the bot registry.
hot_context.py emits partner_sharing_state: 'pending' when partner_share IS NULL and the user has a partner; the canonical prompt slot is rendered into the system prompt of any bot whose hot context carries this signal.
set_partner_sharing tool exists, is wired into the tool registry for every bot, and updates user_bot_state.partner_share for the calling (user, bot) only.
add_memory accepts visibility and shareable_summary; rejects dyad_shareable without shareable_summary.
Rosi's prompt is updated so that when partner_share='opt_in', she writes dyad_shareable memories and distillations for non-sensitive facts (with appropriate shareable_summary).
Mediator's existing partner-sharing onboarding language is collapsed into the canonical slot; mediator continues to behave observationally as today for existing users post-migration.
Tests cover: NULL → no partner content visible; opt_out → no partner content visible; opt_in + private row → no partner content visible; opt_in + dyad_shareable row → partner content visible with provenance; cross-bot pull respects toggle independently per bot; user with no partner never sees the pending slot.
should
Cross-bot content ordering and length budget are explicit (chosen rule, written down in code or comment).
Migration is a single transaction or has explicit phasing documented.
The canonical prompt slot is defined in one place and imported by both bot prompt files.
info
Future work for re-asking or per-topic granularity is captured (e.g., as a ticket via megaplan ticket new) but not implemented.
Notes for the planner
Do not invent new bot-ID strings. Use the existing bot_id constants from app/bots/ids.py.
Do not gate behaviour on bot identity if it can be data-driven. The whole point is N bots; if Rosi gets a code path that Véas doesn't, that's a smell. The only legitimate per-bot differences are prompt content and topic, both of which are already data-driven.
The pending slot's prompt language matters. Write it once, write it well, and stop. Bots are instructed what to do (raise the question this turn), not how to phrase it — voice belongs to each bot.
The migration is the riskiest piece. Get the ordering and the backfill right and the rest is mechanical.
code
Batch framing:
- Execute batch 2 of 13.
- Actionable task IDs for this batch: ['T2']
- Already completed task IDs available as dependency context: ['T1']
Actionable tasks for this batch:
[
{
"id": "T2",
"description": "Create shared partner-sharing helpers in app/services/partner_sharing.py: normalize partner share values, fetch single/batch states from user_bot_state, upsert scoped (user_id, bot_id) state, resolve dyad partner via dyads/dyad_members, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
The Veas codebase runs N bots that each occupy a "domain" for a user (currently: mediator = relationship coach for a dyad on topic=relationship; tante_rosi = solo pregnancy coach on topic=pregnancy; more bots planned). Today only the mediator's content can flow between dyad partners, gated by a global opt-in (users.cross_thread_sharing_default). The pregnancy coach writes everything private; her facts cannot reach the partner even when the user wants to share them.
We want to generalise partner-sharing so that every bot (current and future) can produce content that the user's partner sees, gated by a per-bot opt-in. The user gets one switch per domain ("share my pregnancy stuff with my partner — yes / no / not decided yet"). Until they decide, the bot keeps surfacing the question.
The basic infrastructure already exists for distillations (visibility: private | dyad_shareable, shareable_summary, raw_message_visibility() filtering in app/services/cross_thread_privacy.py, app/services/hot_context.py:500-577). The work below generalises it across both bots-and-content-types, and replaces the global toggle with a per-bot one.
Goal (one sentence)
Replace the single global users.cross_thread_sharing_default with per-bot opt-in state on user_bot_state, extend dyad_shareable visibility to memories (today it only exists on distillations), and rewire the hot-context read path so a partner sees dyad_shareable content from any bot where the content's owner has opted in for that bot — with NULL ("not decided") triggering a prompt-slot the bot uses to ask.
Decisions already made (do not re-litigate)
These are settled — the plan should implement them, not re-debate them.
Per-bot opt-in lives on user_bot_state as one new column partner_share text with values 'opt_in' | 'opt_out' | NULL. NULL = "pending, must ask". Key is (user_id, bot_id) — same shape as every other per-bot state today.
Memories get visibility and shareable_summary mirroring distillations exactly. Default visibility='private'. When visibility='dyad_shareable', shareable_summary is required.
The opt-in is shown until decided. While partner_share IS NULL, every render of that bot's hot context includes a "pending opt-in" slot in the system prompt asking the bot to raise the question this turn. As soon as the value is non-NULL (opt_in OR opt_out), the slot drops out and the bot stops raising it.
One shared prompt slot, used by every bot. Define one canonical pending-opt-in paragraph used by every bot's render_system_prompt. Rosi's existing _FIRST_CONTACT_V1 collapses into it; the mediator's onboarding language for cross-thread sharing also collapses into it. New bots inherit the slot for free — no per-bot prompt work.
One shared tool: set_partner_sharing(opt_in: bool). Implicit bot_id (from the calling bot's scope). Writes to user_bot_state.partner_share for the calling (user, bot) pair.
Migration: the existing global flag goes away. Backfill user_bot_state[bot_id='mediator', user_id=X].partner_share from users.cross_thread_sharing_default for every existing user, then drop users.cross_thread_sharing_default. One model, not two — no fallback path, no two-system-running period.
No per-row UX in v1. The user gets the per-bot toggle. The bot decides per-call whether a given memory/distillation should be private vs dyad_shareable based on the content. No user-facing per-row controls.
Hot context cross-bot pull is in scope. When rendering for user B (the partner of A), pull A's dyad_shareable rows from any bot where partner_share[A, that_bot] = 'opt_in', surfaced with a provenance prefix (e.g. from Rosi:). Same-bot dyad sharing (the existing mediator behaviour) keeps working unchanged in shape, just driven by the new column.
Files known to be relevant (planner should read at least these)
The planner should still survey the repo, but these are the focal points:
migrations/0012_cross_thread_sharing.sql — defines the global flag being retired.
app/services/tools/write_tools.py — add_memory (~line 776) and add_distillation (~line 1165). The add_memory write helper needs to accept visibility + shareable_summary.
app/services/tools/tool_schemas.py — AddMemoryInput needs new fields mirroring AddDistillationInput.visibility etc. (~line 996 for the distillation schema as the template).
app/bots/mediator.py and app/bots/tante_rosi.py — both need to (a) include the canonical pending-opt-in slot via their render_system_prompt, (b) be eligible to call set_partner_sharing. Rosi additionally needs prompt language about when to write dyad_shareable rows once opted in.
app/bots/prompts/tante_rosi.py (_FIRST_CONTACT_V1) and the equivalent mediator prompt file — the canonical slot replaces/absorbs whatever ask-the-user-about-sharing language already exists in each.
app/bots/ tool dispatch — wherever bot tool allowlists are wired, set_partner_sharing must be available to every bot (it's user-state-modifying, like set_pregnancy_edd, not domain-specific).
Invariants to enforce (must hold)
NULL → silent. When partner_share IS NULL, no content from that (user, bot) is shared with the partner regardless of per-row visibility. The toggle is the gate; per-row visibility only matters when the toggle is opt_in.
opt_out → silent. Same as NULL for the read path. The only difference is the prompt slot doesn't surface.
opt_in → per-row decides. When the toggle is opt_in, dyad_shareable rows from that bot flow to the partner; private rows don't.
No partner → moot. When the user has no partner (users.partner_user_id IS NULL), the prompt slot is suppressed even with partner_share IS NULL. Nothing to share to. Don't ask a question that has no answer.
No backsliding on the mediator. Every existing mediator user must continue to see exactly what they see today — the migration must be observationally equivalent. A user whose current cross_thread_sharing_default = 'opt_in' ends up with user_bot_state[mediator].partner_share = 'opt_in'; a user with 'opt_out' ends up 'opt_out'; NULL stays NULL.
Cross-bot pull is opt-in-gated, not opt-out-gated. Default is "don't show partner's other-bot content." Only 'opt_in' from the content owner unlocks the pull. This matters: a partner who hasn't decided cannot accidentally have their content surfaced because of someone else's default.
Tool authorisation.set_partner_sharing writes only to the calling user's row for the calling bot. A user calling Rosi cannot toggle their mediator state; Rosi cannot toggle Véas's state. Scope is (message.sender_id, message.bot_id).
The shareable_summary contract. When add_memory or add_distillation is called with visibility='dyad_shareable', shareable_summary must be non-null and non-empty. Reject the call otherwise. Same rule that already applies to distillations should now apply to memories.
Edge cases and ordering concerns
The planner should treat these as real, not paranoid:
Migration backfill ordering. The new column on user_bot_state must be added and backfilled before cross_thread_sharing_default is dropped. The hot-context read path must be flipped to the new column atomically with the drop, or the system briefly reads from a dropped column. Plan the migration as a single transaction or with explicit phasing.
Backfill for users without a user_bot_state[mediator] row. Some legacy users may not have a user_bot_state row for the mediator yet (it may be created lazily on first message). The migration must create rows for any user with a non-NULL cross_thread_sharing_default. For users with NULL global setting, decide: either create rows pre-set to NULL (explicit pending state) or skip (lazy creation later, still NULL). Either is defensible — make a call and write it down.
The pending slot wording is shared. Different bots have different voices. The shared slot must be voice-agnostic — short, neutral, instructive to the model, not user-facing copy. The bot's own voice handles the actual question to the user; the slot just tells the bot "raise this naturally this turn."
Cross-bot pull volume. A partner with several opted-in bots could see a long list of "from X:" rows in their hot context. Budget for hot-context length: cap, summarise, or rank. Don't ship a context bomb.
Order of cross-bot content. When pulling rows from multiple bots, by what order? By recency? By bot? Pick one and write it down so the reviewer can check it.
Provenance prefix format. "from Rosi:" / "from Véas:" — bake into a single helper, not sprinkled. Bots are named via the bot registry; use the registry's display name, not a hard-coded string.
Explicitly out of scope
Per-row visibility controls exposed to the user. (The bot decides per-row; users only decide per-bot.)
Re-asking after some time has passed. Once opt_in or opt_out is set, the slot stays gone. Future work, not this sprint.
New bot registration code. The pattern must work for new bots when they show up, but we are not adding a new bot in this sprint.
Per-topic granularity within a bot. Each bot is one domain; one toggle per bot is enough.
UI surfaces. There is no UI today and we are not building one.
Encryption-at-rest changes. shareable_summary on memories follows whatever the existing memory content encryption pattern is.
Success criteria
Reviewer should check, in priority order:
must
Migration adds user_bot_state.partner_share and backfills it from users.cross_thread_sharing_default for every user where the global flag was non-NULL, preserving the same value semantically ('opt_in' → 'opt_in', 'opt_out' → 'opt_out').
Migration adds memories.visibility (default 'private') and memories.shareable_summary (nullable) with a CHECK constraint matching the existing distillations one (shareable_summary required iff visibility='dyad_shareable').
Migration drops users.cross_thread_sharing_default only after the read path is updated.
cross_thread_privacy.raw_message_visibility() (and any other reader of the old column) reads from user_bot_state.partner_share for the relevant bot, not from users.cross_thread_sharing_default.
hot_context.py cross-bot pull lands: when rendering for partner B, B sees A's dyad_shareable memories and distillations from any bot where partner_share[A, that_bot]='opt_in', with a provenance prefix from the bot registry.
hot_context.py emits partner_sharing_state: 'pending' when partner_share IS NULL and the user has a partner; the canonical prompt slot is rendered into the system prompt of any bot whose hot context carries this signal.
set_partner_sharing tool exists, is wired into the tool registry for every bot, and updates user_bot_state.partner_share for the calling (user, bot) only.
add_memory accepts visibility and shareable_summary; rejects dyad_shareable without shareable_summary.
Rosi's prompt is updated so that when partner_share='opt_in', she writes dyad_shareable memories and distillations for non-sensitive facts (with appropriate shareable_summary).
Mediator's existing partner-sharing onboarding language is collapsed into the canonical slot; mediator continues to behave observationally as today for existing users post-migration.
Tests cover: NULL → no partner content visible; opt_out → no partner content visible; opt_in + private row → no partner content visible; opt_in + dyad_shareable row → partner content visible with provenance; cross-bot pull respects toggle independently per bot; user with no partner never sees the pending slot.
should
Cross-bot content ordering and length budget are explicit (chosen rule, written down in code or comment).
Migration is a single transaction or has explicit phasing documented.
The canonical prompt slot is defined in one place and imported by both bot prompt files.
info
Future work for re-asking or per-topic granularity is captured (e.g., as a ticket via megaplan ticket new) but not implemented.
Notes for the planner
Do not invent new bot-ID strings. Use the existing bot_id constants from app/bots/ids.py.
Do not gate behaviour on bot identity if it can be data-driven. The whole point is N bots; if Rosi gets a code path that Véas doesn't, that's a smell. The only legitimate per-bot differences are prompt content and topic, both of which are already data-driven.
The pending slot's prompt language matters. Write it once, write it well, and stop. Bots are instructed what to do (raise the question this turn), not how to phrase it — voice belongs to each bot.
The migration is the riskiest piece. Get the ordering and the backfill right and the rest is mechanical.
code
Batch framing:
- Execute batch 3 of 13.
- Actionable task IDs for this batch: ['T3']
- Already completed task IDs available as dependency context: ['T1', 'T2']
Actionable tasks for this batch:
[
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update app/models/user.py, app/services/turn_context.py::partner_of, and app/staging.py so they no longer select, hydrate, pass, or depend on cross_thread_sharing_default; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in : normalize partner share values, fetch single/batch states from , upsert scoped state, resolve dyad partner via /, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "done",
"kind": "code",
"executor_notes": "Created app/services/partner_sharing.py with strict partner_share normalization, single and batch fetches keyed by (user_id, bot_id), scoped upsert for one (user_id, bot_id), dyad partner lookup through dyads/dyad_members, and provenance formatting that uses registry display names with bots-table and bot-id fallback. Added focused helper tests covering normalization, missing-row pending behavior, scoped upsert, dyad lookup, and provenance fallback. Focused tests passed. Full pytest was rerun and still fails only in the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures from batch 1.",
"files_changed": [
"app/services/partner_sharing.py",
"tests/test_partner_sharing.py"
],
"commands_run": [
"python -m black app/services/partner_sharing.py tests/test_partner_sharing.py",
"python -m py_compile app/services/partner_sharing.py",
"pytest tests/test_partner_sharing.py -q",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q",
"pytest -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
{
"output": {
"batch": 3,
"status": "completed",
"summary": "Executed T3. Removed production use of users.cross_thread_sharing_default from User hydration, partner_of, staging, and prompt-render setup; prompt rendering now receives per-bot partner_share loaded by (user_id, bot_id)."
},
"files_changed": [
"app/models/user.py",
"app/services/turn_context.py",
"app/staging.py",
"app/bots/base.py",
"app/services/agentic.py",
"tests/conftest.py",
".megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_3.json"
],
"commands_run": [
"python -m black app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py tests/conftest.py",
"python -m py_compile app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py",
"pytest tests/test_pregnancy_user_model.py tests/test_partner_sharing.py tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest tests/test_agentic.py tests/test_agentic_lifecycle.py tests/test_staging.py -q",
"pytest tests/test_hot_context.py tests/test_tools.py -q",
"pytest -q",
"rg -n "SELECT[^\n]*cross_thread_sharing_default|cross_thread_sharing_default=row|cross_thread_sharing_default=user|user\.cross_thread_sharing_default|partner\.cross_thread_sharing_default" app/models/user.py app/services/turn_context.py app/staging.py app/bots/base.py app/services/agentic.py"
],
"deviations": [
"Full pytest still fails in the same prior unrelated-looking locations: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob and three tests/test_decay.py failures around the fake-pool observation UPDATE after Anthropic 401.",
"A temporary non-hydrated User.cross_thread_sharing_default compatibility property remains so older tests/callers do not break before the later stale-reference cleanup batch. It is no longer selected from or hydrated from users."
],
"task_updates": [
{
"id": "T3",
"status": "done",
"executor_notes": "Removed production DB selection/hydration/use of users.cross_thread_sharing_default from User, partner_of, staging, and prompt rendering paths. Added per-bot partner-share loading for prompt rendering in agentic and staging via app.services.partner_sharing.get_partner_share, while keeping a temporary non-hydrated User compatibility shim for old callers until the later stale-reference cleanup batch. Updated FakePool for the new user SELECT shape and partner_share lookup. Verified focused user/partner-sharing/pregnancy/schema tests, hot-context/tools tests, and agentic/staging modules; full pytest was rerun and still only shows the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures.",
"files_changed": [
"app/models/user.py",
"app/services/turn_context.py",
"app/staging.py",
"app/bots/base.py",
"app/services/agentic.py",
"tests/conftest.py"
],
"commands_run": [
"python -m black app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py tests/conftest.py",
"python -m py_compile app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py",
"pytest tests/test_pregnancy_user_model.py tests/test_partner_sharing.py tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest tests/test_agentic.py tests/test_agentic_lifecycle.py tests/test_staging.py -q",
"pytest tests/test_hot_context.py tests/test_tools.py -q",
"pytest -q",
"rg -n "SELECT[^\n]*cross_thread_sharing_default|cross_thread_sharing_default=row|cross_thread_sharing_default=user|user\.cross_thread_sharing_default|partner\.cross_thread_sharing_default" app/models/user.py app/services/turn_context.py app/staging.py app/bots/base.py app/services/agentic.py"
]
}
],
"sense_check_acknowledgments": [
{
"id": "SC3",
"executor_note": "Yes for the production paths in scope. User, partner_of, staging, base prompt rendering, and agentic prompt construction no longer select, hydrate, or pass users.cross_thread_sharing_default; prompt rendering now receives per-bot partner_share loaded by (user_id, bot_id). A temporary User compatibility property remains non-hydrated for legacy test/caller tolerance and is not a DB dependency.",
"verdict": "passed"
}
]
}
The Veas codebase runs N bots that each occupy a "domain" for a user (currently: mediator = relationship coach for a dyad on topic=relationship; tante_rosi = solo pregnancy coach on topic=pregnancy; more bots planned). Today only the mediator's content can flow between dyad partners, gated by a global opt-in (users.cross_thread_sharing_default). The pregnancy coach writes everything private; her facts cannot reach the partner even when the user wants to share them.
We want to generalise partner-sharing so that every bot (current and future) can produce content that the user's partner sees, gated by a per-bot opt-in. The user gets one switch per domain ("share my pregnancy stuff with my partner — yes / no / not decided yet"). Until they decide, the bot keeps surfacing the question.
The basic infrastructure already exists for distillations (visibility: private | dyad_shareable, shareable_summary, raw_message_visibility() filtering in app/services/cross_thread_privacy.py, app/services/hot_context.py:500-577). The work below generalises it across both bots-and-content-types, and replaces the global toggle with a per-bot one.
Goal (one sentence)
Replace the single global users.cross_thread_sharing_default with per-bot opt-in state on user_bot_state, extend dyad_shareable visibility to memories (today it only exists on distillations), and rewire the hot-context read path so a partner sees dyad_shareable content from any bot where the content's owner has opted in for that bot — with NULL ("not decided") triggering a prompt-slot the bot uses to ask.
Decisions already made (do not re-litigate)
These are settled — the plan should implement them, not re-debate them.
Per-bot opt-in lives on user_bot_state as one new column partner_share text with values 'opt_in' | 'opt_out' | NULL. NULL = "pending, must ask". Key is (user_id, bot_id) — same shape as every other per-bot state today.
Memories get visibility and shareable_summary mirroring distillations exactly. Default visibility='private'. When visibility='dyad_shareable', shareable_summary is required.
The opt-in is shown until decided. While partner_share IS NULL, every render of that bot's hot context includes a "pending opt-in" slot in the system prompt asking the bot to raise the question this turn. As soon as the value is non-NULL (opt_in OR opt_out), the slot drops out and the bot stops raising it.
One shared prompt slot, used by every bot. Define one canonical pending-opt-in paragraph used by every bot's render_system_prompt. Rosi's existing _FIRST_CONTACT_V1 collapses into it; the mediator's onboarding language for cross-thread sharing also collapses into it. New bots inherit the slot for free — no per-bot prompt work.
One shared tool: set_partner_sharing(opt_in: bool). Implicit bot_id (from the calling bot's scope). Writes to user_bot_state.partner_share for the calling (user, bot) pair.
Migration: the existing global flag goes away. Backfill user_bot_state[bot_id='mediator', user_id=X].partner_share from users.cross_thread_sharing_default for every existing user, then drop users.cross_thread_sharing_default. One model, not two — no fallback path, no two-system-running period.
No per-row UX in v1. The user gets the per-bot toggle. The bot decides per-call whether a given memory/distillation should be private vs dyad_shareable based on the content. No user-facing per-row controls.
Hot context cross-bot pull is in scope. When rendering for user B (the partner of A), pull A's dyad_shareable rows from any bot where partner_share[A, that_bot] = 'opt_in', surfaced with a provenance prefix (e.g. from Rosi:). Same-bot dyad sharing (the existing mediator behaviour) keeps working unchanged in shape, just driven by the new column.
Files known to be relevant (planner should read at least these)
The planner should still survey the repo, but these are the focal points:
migrations/0012_cross_thread_sharing.sql — defines the global flag being retired.
app/services/tools/write_tools.py — add_memory (~line 776) and add_distillation (~line 1165). The add_memory write helper needs to accept visibility + shareable_summary.
app/services/tools/tool_schemas.py — AddMemoryInput needs new fields mirroring AddDistillationInput.visibility etc. (~line 996 for the distillation schema as the template).
app/bots/mediator.py and app/bots/tante_rosi.py — both need to (a) include the canonical pending-opt-in slot via their render_system_prompt, (b) be eligible to call set_partner_sharing. Rosi additionally needs prompt language about when to write dyad_shareable rows once opted in.
app/bots/prompts/tante_rosi.py (_FIRST_CONTACT_V1) and the equivalent mediator prompt file — the canonical slot replaces/absorbs whatever ask-the-user-about-sharing language already exists in each.
app/bots/ tool dispatch — wherever bot tool allowlists are wired, set_partner_sharing must be available to every bot (it's user-state-modifying, like set_pregnancy_edd, not domain-specific).
Invariants to enforce (must hold)
NULL → silent. When partner_share IS NULL, no content from that (user, bot) is shared with the partner regardless of per-row visibility. The toggle is the gate; per-row visibility only matters when the toggle is opt_in.
opt_out → silent. Same as NULL for the read path. The only difference is the prompt slot doesn't surface.
opt_in → per-row decides. When the toggle is opt_in, dyad_shareable rows from that bot flow to the partner; private rows don't.
No partner → moot. When the user has no partner (users.partner_user_id IS NULL), the prompt slot is suppressed even with partner_share IS NULL. Nothing to share to. Don't ask a question that has no answer.
No backsliding on the mediator. Every existing mediator user must continue to see exactly what they see today — the migration must be observationally equivalent. A user whose current cross_thread_sharing_default = 'opt_in' ends up with user_bot_state[mediator].partner_share = 'opt_in'; a user with 'opt_out' ends up 'opt_out'; NULL stays NULL.
Cross-bot pull is opt-in-gated, not opt-out-gated. Default is "don't show partner's other-bot content." Only 'opt_in' from the content owner unlocks the pull. This matters: a partner who hasn't decided cannot accidentally have their content surfaced because of someone else's default.
Tool authorisation.set_partner_sharing writes only to the calling user's row for the calling bot. A user calling Rosi cannot toggle their mediator state; Rosi cannot toggle Véas's state. Scope is (message.sender_id, message.bot_id).
The shareable_summary contract. When add_memory or add_distillation is called with visibility='dyad_shareable', shareable_summary must be non-null and non-empty. Reject the call otherwise. Same rule that already applies to distillations should now apply to memories.
Edge cases and ordering concerns
The planner should treat these as real, not paranoid:
Migration backfill ordering. The new column on user_bot_state must be added and backfilled before cross_thread_sharing_default is dropped. The hot-context read path must be flipped to the new column atomically with the drop, or the system briefly reads from a dropped column. Plan the migration as a single transaction or with explicit phasing.
Backfill for users without a user_bot_state[mediator] row. Some legacy users may not have a user_bot_state row for the mediator yet (it may be created lazily on first message). The migration must create rows for any user with a non-NULL cross_thread_sharing_default. For users with NULL global setting, decide: either create rows pre-set to NULL (explicit pending state) or skip (lazy creation later, still NULL). Either is defensible — make a call and write it down.
The pending slot wording is shared. Different bots have different voices. The shared slot must be voice-agnostic — short, neutral, instructive to the model, not user-facing copy. The bot's own voice handles the actual question to the user; the slot just tells the bot "raise this naturally this turn."
Cross-bot pull volume. A partner with several opted-in bots could see a long list of "from X:" rows in their hot context. Budget for hot-context length: cap, summarise, or rank. Don't ship a context bomb.
Order of cross-bot content. When pulling rows from multiple bots, by what order? By recency? By bot? Pick one and write it down so the reviewer can check it.
Provenance prefix format. "from Rosi:" / "from Véas:" — bake into a single helper, not sprinkled. Bots are named via the bot registry; use the registry's display name, not a hard-coded string.
Explicitly out of scope
Per-row visibility controls exposed to the user. (The bot decides per-row; users only decide per-bot.)
Re-asking after some time has passed. Once opt_in or opt_out is set, the slot stays gone. Future work, not this sprint.
New bot registration code. The pattern must work for new bots when they show up, but we are not adding a new bot in this sprint.
Per-topic granularity within a bot. Each bot is one domain; one toggle per bot is enough.
UI surfaces. There is no UI today and we are not building one.
Encryption-at-rest changes. shareable_summary on memories follows whatever the existing memory content encryption pattern is.
Success criteria
Reviewer should check, in priority order:
must
Migration adds user_bot_state.partner_share and backfills it from users.cross_thread_sharing_default for every user where the global flag was non-NULL, preserving the same value semantically ('opt_in' → 'opt_in', 'opt_out' → 'opt_out').
Migration adds memories.visibility (default 'private') and memories.shareable_summary (nullable) with a CHECK constraint matching the existing distillations one (shareable_summary required iff visibility='dyad_shareable').
Migration drops users.cross_thread_sharing_default only after the read path is updated.
cross_thread_privacy.raw_message_visibility() (and any other reader of the old column) reads from user_bot_state.partner_share for the relevant bot, not from users.cross_thread_sharing_default.
hot_context.py cross-bot pull lands: when rendering for partner B, B sees A's dyad_shareable memories and distillations from any bot where partner_share[A, that_bot]='opt_in', with a provenance prefix from the bot registry.
hot_context.py emits partner_sharing_state: 'pending' when partner_share IS NULL and the user has a partner; the canonical prompt slot is rendered into the system prompt of any bot whose hot context carries this signal.
set_partner_sharing tool exists, is wired into the tool registry for every bot, and updates user_bot_state.partner_share for the calling (user, bot) only.
add_memory accepts visibility and shareable_summary; rejects dyad_shareable without shareable_summary.
Rosi's prompt is updated so that when partner_share='opt_in', she writes dyad_shareable memories and distillations for non-sensitive facts (with appropriate shareable_summary).
Mediator's existing partner-sharing onboarding language is collapsed into the canonical slot; mediator continues to behave observationally as today for existing users post-migration.
Tests cover: NULL → no partner content visible; opt_out → no partner content visible; opt_in + private row → no partner content visible; opt_in + dyad_shareable row → partner content visible with provenance; cross-bot pull respects toggle independently per bot; user with no partner never sees the pending slot.
should
Cross-bot content ordering and length budget are explicit (chosen rule, written down in code or comment).
Migration is a single transaction or has explicit phasing documented.
The canonical prompt slot is defined in one place and imported by both bot prompt files.
info
Future work for re-asking or per-topic granularity is captured (e.g., as a ticket via megaplan ticket new) but not implemented.
Notes for the planner
Do not invent new bot-ID strings. Use the existing bot_id constants from app/bots/ids.py.
Do not gate behaviour on bot identity if it can be data-driven. The whole point is N bots; if Rosi gets a code path that Véas doesn't, that's a smell. The only legitimate per-bot differences are prompt content and topic, both of which are already data-driven.
The pending slot's prompt language matters. Write it once, write it well, and stop. Bots are instructed what to do (raise the question this turn), not how to phrase it — voice belongs to each bot.
The migration is the riskiest piece. Get the ordering and the backfill right and the rest is mechanical.
code
Batch framing:
- Execute batch 4 of 13.
- Actionable task IDs for this batch: ['T4']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3']
Actionable tasks for this batch:
[
{
"id": "T4",
"description": "Replace the legacy sharing tool with set_partner_sharing: update root tool_schemas.py, app/services/tools/write_tools.py, app/services/tools/registry.py, and app/services/tools/scope_guard.py; remove/deprecate update_cross_thread_sharing_default; ensure the new tool accepts only opt_in: bool plus optional reason and writes only (ctx.user.id, ctx.bot_id) via the shared helper.",
"depends_on": [
"T2",
"T3"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory //encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in : normalize partner share values, fetch single/batch states from , upsert scoped state, resolve dyad partner via /, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "done",
"kind": "code",
"executor_notes": "Created app/services/partner_sharing.py with strict partner_share normalization, single and batch fetches keyed by (user_id, bot_id), scoped upsert for one (user_id, bot_id), dyad partner lookup through dyads/dyad_members, and provenance formatting that uses registry display names with bots-table and bot-id fallback. Added focused helper tests covering normalization, missing-row pending behavior, scoped upsert, dyad lookup, and provenance fallback. Focused tests passed. Full pytest was rerun and still fails only in the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures from batch 1.",
"files_changed": [
"app/services/partner_sharing.py",
"tests/test_partner_sharing.py"
],
"commands_run": [
"python -m black app/services/partner_sharing.py tests/test_partner_sharing.py",
"python -m py_compile app/services/partner_sharing.py",
"pytest tests/test_partner_sharing.py -q",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q",
"pytest -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update , , and so they no longer select, hydrate, pass, or depend on ; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "done",
"kind": "code",
"executor_notes": "Removed production DB selection/hydration/use of users.cross_thread_sharing_default from User, partner_of, staging, and prompt rendering paths. Added per-bot partner-share loading for prompt rendering in agentic and staging via app.services.partner_sharing.get_partner_share, while keeping a temporary non-hydrated User compatibility shim for old callers until the later stale-reference cleanup batch. Updated FakePool for the new user SELECT shape and partner_share lookup. Verified focused user/partner-sharing/pregnancy/schema tests, hot-context/tools tests, and agentic/staging modules; full pytest was rerun and still only shows the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures.",
"files_changed": [
"app/models/user.py",
"app/services/turn_context.py",
"app/staging.py",
"app/bots/base.py",
"app/services/agentic.py",
"tests/conftest.py"
],
"commands_run": [
"python -m black app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py tests/conftest.py",
"python -m py_compile app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py",
"pytest tests/test_pregnancy_user_model.py tests/test_partner_sharing.py tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest tests/test_agentic.py tests/test_agentic_lifecycle.py tests/test_staging.py -q",
"pytest tests/test_hot_context.py tests/test_tools.py -q",
"pytest -q",
"rg -n "SELECT[^\n]*cross_thread_sharing_default|cross_thread_sharing_default=row|cross_thread_sharing_default=user|user\.cross_thread_sharing_default|partner\.cross_thread_sharing_default" app/models/user.py app/services/turn_context.py app/staging.py app/bots/base.py app/services/agentic.py"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
]
“Execute the approved plan in the repository. Project directory:….” Conversation with gpt-5.5, from the Peter O’Mallet DataClaw Conversations dataset. The Chat Archive, 2026. https://thechatarchive.com/c/01m80eqpj221rxgj6ahhse017b
"Full test suite did not pass: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob still fails looking for a fake-pool read:list_themes event; tests/test_decay.py has 3 failures on an unhandled fake-pool UPDATE after Anthropic 401 during observation rescoring. These appear unrelated to T1 schema/constants changes.",
"Advisory quality: code changes lacked test updates: app/bots/ids.py, app/bots/registry.py, app/bots/tante_rosi.py.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_1.json",
"Advisory audit finding: Git status shows changed files not claimed by any task: megaplans/, scripts/import_chatgpt.py, supabase/",
"Advisory audit finding: Sense check SC2 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC8 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC9 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC10 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC11 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC12 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC13 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC14 is missing an executor acknowledgment.",
"Advisory audit finding: Tasks left pending after execute (executor never started them): T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14"
]
code
User action prerequisites:
No user_action prerequisites for this batch.
Batch-scoped sense checks:
[
{
"id": "SC2",
"task_id": "T2",
"question": "Do all shared helpers use (user_id, bot_id) without silently creating arbitrary bot IDs, resolve dyad partner through dyads/dyad_members, and produce provenance from registry display names with fallback?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in app/services/partner_sharing.py: normalize partner share values, fetch single/batch states from user_bot_state, upsert scoped (user_id, bot_id) state, resolve dyad partner via dyads/dyad_members, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update app/models/user.py, app/services/turn_context.py::partner_of, and app/staging.py so they no longer select, hydrate, pass, or depend on cross_thread_sharing_default; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T4",
"description": "Replace the legacy sharing tool with set_partner_sharing: update root tool_schemas.py, app/services/tools/write_tools.py, app/services/tools/registry.py, and app/services/tools/scope_guard.py; remove/deprecate update_cross_thread_sharing_default; ensure the new tool accepts only opt_in: bool plus optional reason and writes only (ctx.user.id, ctx.bot_id) via the shared helper.",
"depends_on": [
"T2",
"T3"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T5",
"description": "Run and act on a stale-reference sweep before deeper rewrites: use rg \"cross_thread_sharing_default|update_cross_thread_sharing_default|current_user_sharing_default|partner_sharing_default|sharing_default\" app tests tool_schemas.py; rewrite production hits to per-bot partner_share terminology or document intentional historical/test-only references.",
"depends_on": [
"T3",
"T4"
],
"status": "pending",
"kind": "audit",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T6",
"description": "Flip raw privacy decisions to partner-share terminology in app/services/cross_thread_privacy.py: decision inputs/results should use owner partner_share for the relevant message bot, with NULL/unset and opt_out blocking partner-visible raw content and own-owner reads unchanged.",
"depends_on": [
"T2",
"T5"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T7",
"description": "Scope raw-message reads by bot/topic in app/services/hot_context.py and app/services/tools/read_tools.py: recent/trigger/search/recent_activity paths must filter to current bot and active topic before applying privacy; get_distillations and write-tool owner visibility checks must load partner-share keyed by each source row's recorded_by_bot_id or source message bot_id. Treat legacy NULL message bot IDs as hidden from partner raw reads.",
"depends_on": [
"T6"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T8",
"description": "Rewrite dyadic hot context partner-share state and cross-bot summary rendering in app/services/hot_context.py: add current/partner partner_share and partner_sharing_state, emit pending only when current user has a resolved dyad partner and current bot state is missing/NULL, remove the hardcoded urgent sharing block, pull partner dyad_shareable memories/distillations from any opted-in bot, render only shareable_summary with shared provenance prefix, sort by recency across bots, and cap globally (for example 12 rows) with a code comment or test documenting the rule.",
"depends_on": [
"T2",
"T7"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T9",
"description": "Extend solo hot context in app/services/hot_context_solo.py: resolve dyad partner existence through the shared helper, add current-bot partner_share and partner_sharing_state, suppress pending when no partner exists, and keep solo bots from exposing partner raw messages or partner memories.",
"depends_on": [
"T2",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T10",
"description": "Define one canonical pending partner-sharing prompt slot in app/bots/prompts/partner_sharing.py. Keep it domain-agnostic and model-facing: raise the choice naturally this turn unless crisis/time-critical, call set_partner_sharing(opt_in=...) in the record step after an explicit choice, and do not share this bot's rows until opt-in.",
"depends_on": [
"T4",
"T8",
"T9"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T11",
"description": "Wire the canonical prompt slot through every bot prompt path: update app/bots/base.py, app/services/prompts.py, app/services/prompts_solo.py, app/bots/prompts/tante_rosi.py, app/bots/coach.py, and app/bots/tante_rosi.py so mediator, Tante Rosi, coach, and future solo bots receive partner_share/partner_sharing_state; replace stale mediator onboarding language and tool references; add only Rosi-specific guidance for safe pregnancy dyad_shareable facts once opted in.",
"depends_on": [
"T10"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T12",
"description": "Extend memory and distillation write/read contracts: in root tool_schemas.py, add visibility and shareable_summary to AddMemoryInput with a validator requiring non-empty summaries for dyad_shareable; update app/services/tools/write_tools.py to persist and encrypt memory shareable summaries, keep superseded replacement behavior explicit, ensure add_distillation() writes recorded_by_bot_id=ctx.bot_id, and update read/render paths so partner/cross-bot rows expose only summaries.",
"depends_on": [
"T4",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T13",
"description": "Update existing test infrastructure and regression tests in place. Extend fake pool/fixtures for bots, user_bot_state.partner_share, message bot_id/topic_id, and memory sharing fields; update affected existing tests to remove the old user column; add or extend regression coverage for migration SQL, privacy matrix, cross-bot independence, raw-message bot isolation, prompt-slot pending/no-partner behavior, set_partner_sharing scoped Rosi success, and add_memory shareable-summary validation.",
"depends_on": [
"T1",
"T2",
"T7",
"T8",
"T9",
"T11",
"T12"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T14",
"description": "Final verification only: run the stale-reference sweeps and focused tests named by the approved plan, then the full relevant suite. Include commands such as rg \"cross_thread_sharing_default|update_cross_thread_sharing_default\" app tool_schemas.py, rg \"current_user_sharing_default|partner_sharing_default|sharing_default\" app tool_schemas.py, pytest tests/test_tool_schemas_importable.py tests/test_tools.py -q, hot-context/read-tool tests, prompt/allowlist tests, and finally pytest if focused tests pass. Also write a short throwaway script that reproduces the original leak/bug scenario (partner-share per bot: Rosi opt-in exposes only Rosi summaries while mediator opt-out blocks mediator rows and raw cross-bot messages), run it, record the result, and delete the script before finishing. Do not create new permanent test files in this final task; fix failures and rerun until passing or document a concrete blocker.",
"depends_on": [
"T13"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
],
"watch_items": [
"Do not invoke the megaplan CLI, read the megaplan skill, or start nested planning; treat this as a direct execution brief.",
"The migration is the highest-risk piece: seed bots(id='tante_rosi') before any Rosi user_bot_state write, backfill mediator non-NULL values before dropping the old users column, and keep the SQL transactional.",
"Raw messages must remain same-bot/topic scoped. Cross-bot partner sharing is summaries only, never raw content.",
"partner_share IS NULL and missing user_bot_state both mean pending for prompts but silent for read-path sharing; opt_out is silent and suppresses the prompt slot.",
"Partner resolution uses dyads/dyad_members, not users.partner_user_id.",
"Root tool_schemas.py is the schema target; there is no app/services/tools/tool_schemas.py.",
"Use recorded_by_bot_id and source message bot_id as the gate key for artifacts. Do not gate Rosi artifacts with mediator partner-share or vice versa.",
"The provenance prefix must come from a shared helper using bot registry display names with DB/id fallback, not scattered hard-coded strings.",
"Cross-bot shareable rows need a fixed global cap and recency ordering documented in code or tests to avoid context bloat.",
"Do not make unrelated debt items worse, especially staging hot-context divergence and existing bot/topic routing assumptions.",
"Respect the write-access contract: attempt real edits and only report permission failure after an actual OS-level rejection and retry."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does migration 0035_per_bot_partner_sharing.sql run in one transaction, seed tante_rosi, add constrained partner_share, backfill mediator non-NULL values exactly, add memory sharing fields/checks/indexes, and drop the old users column last?",
"executor_note": "Yes. Migration 0035 is transactional, seeds tante_rosi, constrains partner_share, backfills non-NULL mediator sharing values exactly from the legacy user column before dropping it, adds constrained memory sharing fields plus encrypted summary storage and indexes, and drops users.cross_thread_sharing_default last.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do all shared helpers use (user_id, bot_id) without silently creating arbitrary bot IDs, resolve dyad partner through dyads/dyad_members, and produce provenance from registry display names with fallback?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are User, partner_of, and staging paths free of cross_thread_sharing_default selects/hydration while still supplying prompt code with per-bot partner-share state where needed?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Is set_partner_sharing the only sharing-state write tool, with no user/bot input override and with allowlist/registry/scope guard wiring for mediator, Rosi, coach, and generic record/write steps?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does the grep sweep show no production dependence on the dropped user field or old tool, and are remaining sharing_default strings intentional historical/test references or rewritten?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does raw_message_visibility() preserve owner-visible behavior while partner visibility depends only on the owner's partner_share for the message's bot, with NULL/unset and opt_out blocking?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Can a mediator opt-in no longer expose Rosi raw messages through hot context, search_messages, or recent_activity, including when legacy messages have NULL bot_id?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC8",
"task_id": "T8",
"question": "Does dyadic hot context emit pending only for current user/current bot with a partner, pull opted-in cross-bot summaries only, use provenance prefixes, enforce recency ordering, and cap total cross-bot rows?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC9",
"task_id": "T9",
"question": "Does solo hot context ask about partner sharing only when a dyad partner exists and avoid exposing partner raw/messages/memories to solo bots?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC10",
"task_id": "T10",
"question": "Is the pending prompt slot defined once, neutral, domain-agnostic, and explicit about set_partner_sharing after an explicit choice?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC11",
"task_id": "T11",
"question": "Do mediator, Tante Rosi, coach, and generic solo prompt paths all render the canonical slot from partner_sharing_state and avoid stale update_cross_thread_sharing_default language?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC12",
"task_id": "T12",
"question": "Does add_memory reject blank/missing shareable_summary for dyad_shareable, persist/encrypt summaries, and do partner/cross-bot renders expose only shareable_summary while own same-bot reads retain full content as appropriate?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC13",
"task_id": "T13",
"question": "Do updated existing tests cover NULL, opt-out, opt-in+private, opt-in+dyad_shareable, independent per-bot gates, raw-message bot isolation, no-partner prompt suppression, Rosi FK success, and memory validation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC14",
"task_id": "T14",
"question": "Do the final grep sweeps, focused pytest commands, full suite or documented subset, and deleted throwaway reproduction script demonstrate the feature works without stale production references?",
"executor_note": "",
"verdict": ""
}
],
"user_actions": [
{
"id": "U1",
"description": "After the code is merged, apply the new database migration to the target staging/production database using the project's normal migration process, then deploy the matching application version atomically with that schema change.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "The repo executor can write and test the migration locally, but applying it to external environments and coordinating deploy order requires operator access.",
"requires_human_only_reason": null
},
{
"id": "U2",
"description": "After deployment, manually smoke test one dyad with mediator and Tante Rosi: pending prompt appears when undecided, set_partner_sharing records opt-in/out for the active bot only, and the partner sees only opted-in shareable summaries with provenance.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "Manual product smoke coverage catches prompt UX and live-data integration issues outside the local test harness.",
"requires_human_only_reason": null
}
],
"meta_commentary": "Execute in schema-first order, then remove the old user field everywhere before relying on the dropping migration. Keep the raw-message boundary strict: current-bot partner_share can unlock only same-bot/topic raw messages, while cross-bot sharing is summary-only and gated by the artifact owner\u2019s partner_share for the artifact\u2019s recorded bot. The main implementation trap is a partial migration/code split: do not leave production code reading users.cross_thread_sharing_default after 0035 drops it. The second trap is prompt inheritance: wire the canonical slot through generic solo prompts so coach and future solo bots get it without bespoke work.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add Tante Rosi bot id constant and replace literals where appropriate.",
"finalize_item_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add migration 0035_per_bot_partner_sharing.sql with Rosi bot seed, partner_share, backfill, memory fields, indexes, and old-column drop.",
"finalize_item_ids": [
"T1",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 3: Add shared partner-sharing service for normalization, fetching, upsert, partner resolution, and provenance.",
"finalize_item_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Update user model, turn context, and staging to remove global sharing field and use per-bot state.",
"finalize_item_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Replace old sharing tool and registry/scope references with set_partner_sharing.",
"finalize_item_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Run stale-reference sweep for old sharing names before deeper rewrites.",
"finalize_item_ids": [
"T5",
"T14"
]
},
{
"plan_step_summary": "Step 7: Flip pure privacy decisions to use per-bot partner_share.",
"finalize_item_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Scope dyadic raw-message reads by bot/topic in hot context and read tools.",
"finalize_item_ids": [
"T7",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 9: Rewrite dyadic hot-context partner-share state and labels.",
"finalize_item_ids": [
"T8"
]
},
{
"plan_step_summary": "Step 10: Add cross-bot shareable-summary pull with provenance, recency ordering, and cap.",
"finalize_item_ids": [
"T8",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 11: Extend solo hot context with current-bot partner-share pending state and no partner content exposure.",
"finalize_item_ids": [
"T9"
]
},
{
"plan_step_summary": "Step 12: Add canonical pending partner-sharing prompt slot once.",
"finalize_item_ids": [
"T10"
]
},
{
"plan_step_summary": "Step 13: Wire canonical slot through mediator, generic solo/coach, and Tante Rosi prompt paths.",
"finalize_item_ids": [
"T11"
]
},
{
"plan_step_summary": "Step 14: Extend memory tool schema/write path with visibility and shareable summary validation/persistence.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 15: Keep distillation contract bot-scoped and render partner/cross-bot rows as summaries only.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 16: Update fake pool and existing fixtures/tests for bots, user_bot_state.partner_share, message bot/topic, and removed users column.",
"finalize_item_ids": [
"T13"
]
},
{
"plan_step_summary": "Step 17: Add focused regression coverage for migration, privacy matrix, cross-bot independence, raw-message isolation, prompt slots, tools, and memory validation.",
"finalize_item_ids": [
"T13",
"T14"
]
},
{
"plan_step_summary": "Execution order and validation order: run stale-reference sweeps, focused pytest commands, full suite, and a throwaway reproduction script before finalizing.",
"finalize_item_ids": [
"T14"
]
},
{
"plan_step_summary": "External rollout: apply migration/deploy and manual smoke test outside the local repo executor.",
"finalize_item_ids": [
"U1",
"U2"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All approved numbered steps are mapped to execution tasks. The final task is intentionally verification-only and includes the required throwaway reproduction script, which must be deleted before completion. External DB migration/deploy and live smoke testing are captured as user actions because they require operator access outside repo editing.",
"coverage_complete": true
},
"baseline_test_failures": [],
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_note": "No baseline test run is part of finalization; executor should run the focused and full test commands in T14 after implementation."
}
code
Debt watch items (do not make these worse):
[DEBT] all-locations: all_locations: staging.py:47 calls build_hot_context without the new allow_cross_topic_peek/allow_cross_topic_status_injection flags. since these default to false, staging replay of the mediator bot will not exercise cross-topic paths, diverging from production behavior where mediator has both flags true. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan’s scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standard unique (transport, address, guild_id, channel_id) constraint on raw columns. postgresql on conflict target lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs like coalesce in the target list do not match a raw-column unique constraint and will raise a syntax or 'no unique or exclusion constraint matching the on conflict specification' error at runtime. the seed script will fail unless either (a) the table is changed to use an expression-based unique index with those exact coalesce expressions, or (b) the seed script is rewritten to query-first/insert-if-missing or uses the plain column names and accepts the null-handling semantics of the constraint. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: phase b cte pair (ins and src) requires identical where/order/limit clauses for cursor correctness. both are written aligned but nothing enforces the invariant during executor edits; drift would silently mis-advance cursor. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5.1 says dyad_id is appended before the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed by current_step: turnstep = "respond" at the next line. placement intent is clear (append at end of optional block), but the line reference may drift after the field is added. minor precision wobble; not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: eval baseline capture (step 2) is technically blocked by infra. the plan's approach (write script in main tree, copy to worktree, run there) assumes python scripts/capture_eval_baseline.py can connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserve set search_path across connection acquisitions, so the script would fail with schema lookup errors. the plan should add an alternative path (port 5432 session-mode override, or explicit schema-qualified queries everywhere, or defer entirely). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the lint script scripts/lint_inserts.py has a directory-not-found error path at lines 305-309 that still exits 0. the plan step 13 says to remove the # todo(s2b) marker at line 308 but does not mention changing the sys.exit(0) at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid --dir argument (or when args.dir resolves to a non-existent path) will silently exit 0. this defeats the ci-blocking intent because a typo in the scan directory would be treated as success instead of failure. the fix is trivial: change sys.exit(0) to sys.exit(1) at line 309 (or remove the error-path todo and update the exit code in the same step). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 4.5's _row_matches_topic helper falls back to global behavior when (table, id) is not in self.artifact_topics — explicitly for backward compatibility. this is sensible but creates a subtle hazard: a test that forgets to call link_topic for a new artifact sees global decay behavior with no warning, which could mask the very scoping bug the new test in step 12 is meant to catch. the decay scope test does call link_topic for both topics, so it's safe; future authors may not. worth recording but not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: flag-017 (decay handler backward-compat fallback) is downgraded to accepted maintainability debt with an inline warning comment per step 4.5. the warning text explicitly tells future authors to call link_topic. acceptable, but a noisy assertion (e.g. log a warning when topic_id present in sql but row has no link) would catch silent regressions more loudly. not blocking. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 11 sql returns last_updated_at, but settopicstatusoutput field is named updated_at. the executor needs to alias on read (e.g., row['last_updated_at']). minor mapping point, not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 18 coach botspec writes tool_allowlist=frozenset({...}) - frozenset({'set_topic_status'}) with {...} as a placeholder. the executor needs to know what set to start from (probably the union of step_allowed_tools). this is under-specified; the executor will likely just use 'all tools currently in tool_dispatch minus set_topic_status', which is fine, but worth pinning. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: botspec.render_system_prompt at app/bots/base.py:63-79 unpacks partner.name and partner.cross_thread_sharing_default positionally before delegating to the renderer. plan step 6 passes partner=none for solo turns and assumption #5 says base.py does not need modification. the **kwargs trick in the solo renderer cannot help — attributeerror fires inside botspec.render_system_prompt before the renderer runs. plan must commit to patching base.py (or route solo turn around botspec.render_system_prompt). (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 6 parameterizes topic_id at agentic.py:753 (event metadata) and 778 (turncontext.primary_topic_id) but omits line 737 where _open_turn(..., topic_id=get_relationship_topic_id(), ...) is hardcoded. without patching line 737, persisted turn rows for coach carry topic_id=relationship — directly trips stop condition solo bot writes to mediator's relationship topic in any test. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-041): are the proposed changes technically correct?: botspec.render_system_prompt unpacks partner.name positionally before delegating; partner=none still breaks regardless of solo renderer **kwargs. plan is unchanged from prior critique. carrying as accepted debt per guidance. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-042): are the proposed changes technically correct?: step 6 still omits agentic.py:737 (the _open_turn topic_id kwarg). same gap as prior iteration; trips stop condition if not addressed by executor. carrying as accepted debt. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5's mid-turn refresh refetches user inside the same db transaction (for update held). if the refresh uses fetch_user_by_id rather than dataclasses.replace, it issues a select through the pool while the same connection holds the lock — with asyncpg pools this can deadlock unless the same acquired connection is reused. plan offers both options without specifying which connection the re-fetch uses. dataclasses.replace avoids this entirely; if executor picks fetch_user_by_id, lock contention risk is real. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 2.5 says to copy the 8 new fields through the post-resolve user rebuild in fetch_user_by_id l.152-160. with 8 fields plus existing ones, the constructor call grows long and is easy to miss a field. using dataclasses.replace(user, phone=resolved) would be cleaner and forward-compatible — plan instead keeps the verbose pattern. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the scripts/seed_channels.py plan uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration creates a plain unique (transport, address, guild_id, channel_id) constraint. postgresql requires the on conflict target to match a unique constraint or index exactly; an expression-based target without a matching expression index will raise a runtime error. additionally, the raw unique constraint treats nulls as distinct, so it cannot deduplicate whatsapp channels where guild_id and channel_id are null. the executor must either add a matching unique expression index in 0020, or rewrite the seed script to use a pre-insert select check instead of on conflict. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the 0020 migration plan for user_identities omits the verified_at timestamptz column present in architecture doc §12.2 ddl, while claiming 'exactly per §3/§12 ddl'. since account-linking workflows are deferred beyond s1, the column is not functionally load-bearing yet, but the claim of exact ddl match is incorrect. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the resolve_binding sql in app/services/routing.py uses limit 1 without order by. if a user ever has both a solo binding and a dyad binding to the same bot, the returned row is non-deterministic. the schema has no unique constraint preventing multiple bindings per (bot_id, user_id). since s1 only seeds one dyad binding and the module is not wired into inbound yet, this is latent future risk rather than an immediate s1 blocker. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user notes #1/#2 asked to restructure user_actions.md (split t14, move u1 to after execute). the plan addresses the spirit via execution order but does not enumerate user_actions.md content changes. if the harness consumes a separate user_actions.md, it may still reflect pre-revision ordering. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: verified step 8.1 names the scheduler claim query precisely at scheduled_jobs.py:104 (_claim_due_jobs). the plan cites returning lines 124-125 but the actual file has the returning list at lines 126-127 (off by ~2 because the plan was computed against a stale snapshot). executor will still find the right block, but the precise line offset is wrong. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the user note explicitly directs: t2 (eval baseline capture) is blocked by supabase transaction-mode pooler — set search_path doesn't persist across pooled connections — and must be deferred, with sprint proceeding on t6–t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task with phase 0 must run first execution order. plan body and execution order do not reflect the deferral; executor will block on it. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: validation order steps 1 and 11 still reference the eval baseline (tests/fixtures/eval_baseline/ populated; final python -m evals run diff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-run python -m evals run --prompt-version v1; diff against tests/fixtures/eval_baseline/'. if t2 is deferred there is no baseline to diff against; this step needs to be conditioned on baseline availability or removed. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: advisory: lint_inserts.py line 325 still contains the comment '# always exit 0 in s2a (advisory).' which will become stale after step 13 makes the linter blocking. the adjacent line 326 todo(s2b) is removed, but this stale advisory comment is not mentioned in the plan. it is cosmetic and will be obvious to the executor when editing line 327, but it is a minor maintainability drift. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: q1 resolved by stashing tool_schemas.py first (step 21.2) and q4 resolved by numbered 0031 migration with in-sql guard — but the stash-pop-at-end plan introduces a new risk: sprint edits to tool_schemas.py will conflict with the stashed dirty diff on pop. plan should either drop the stashed tool_schemas.py changes outright or note that conflict resolution is the executor's responsibility. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user note defers t16 (preflight: staging seed + consenting uuid) with explicit instruction to proceed on code-only items 1-8 and treat preflight as pass with todo comments. plan step 9 already gates prod-promotion behind staging verification and falls back to a feedback.md todo — consistent with the deferral. plan does not however explicitly add 'todo comments in coach scaffold code referencing the operator decision' as the user note requests; executor should add a todo marker in app/bots/coach.py per the note. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: recurring debt: did the work fully address: step 11 option b reads enablement from the bots table assuming a row like id='tante_rosi', enabled=true, but migrations/0020_topics_bots_bindings.sql defines bots(id, display_name, created_at) — there is no enabled column. either an extra migration must add the column, or the gate must rely on row existence. plan picks option b as recommended but does neither explicitly. (flagged 1 times across 1 plans)
[DEBT] discord-ingress: exact discord converter/signature edit is not named in the plan. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool with channels, user_identities, bot_bindings, dyads, and dyad_members dicts so the sql patterns in resolve_bot, resolve_sender, and resolve_binding can match against stored rows. however, tests/conftest.py is explicitly listed in the brief as a dirty file that must not be touched. the revised plan says "extend fakepool minimally" twice (step 9 and step 11 assumption) but never specifies how to do so without modifying conftest.py—for example by defining a local routingfakepool(fakepool) subclass inside tests/test_routing.py or by monkeypatching the class in that test module. if the executor follows the plan literally and edits conftest.py, they will violate a locked constraint. if they do not extend fakepool, the routing unit tests cannot be implemented as written. this is a supporting-infrastructure gap. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: step 3 updates scripts/seed_channels.py to import _decode_discord_user_id from the new shared module. the seeder also previously had a regex _discord_bot_user_id_re constant (or similar) inline; if the seeder's local regex remains while the new module redefines it, the two could drift. plan should explicitly say the seeder deletes its local copy. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters but paused_for_user does not currently call logger.* (verified by reading hooks.py). the plan instructs to log extra={user_id, bot_id} — if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: scripts/capture_eval_baseline.py is still listed as a deliverable (step 2.1) and a smoke test (step 2.7 --help invocation). if t2 is deferred, the script could either (a) not be written, or (b) be written but its run deferred. plan should specify which. the smoke test alone (--help) does not require the pooler. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 0 contains both step 1 (parity + identity seeding pre-flight) and step 2 (eval baseline). step 1 is independent of the pooler block — it queries via psql or any working connection — and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: get_relationship_topic_id() is referenced in agentic.py at lines 719, 737, 753, 778. step 6 covers 719/721, 753, 767/778, 793 but not 737. same gap as correctness finding — _open_turn's topic_id kwarg must also be parameterized. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: recurring debt (debt-045): does the change touch all locations: get_relationship_topic_id() at agentic.py:737 still not in step 6's enumeration. same as debt-042. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan does not specify that step 5's coach scaffold should carry a todo comment referencing the deferred t16 preflight (operator-held uuid + staging seed verification) per the new user note. minor scope addition the executor must remember. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan mentions updating app/staging.py:47 'if it calls build_hot_context'. staging.py:47 does call build_hot_context with primary_topic_id=get_relationship_topic_id(). the new allow_cross_topic_peek and allow_cross_topic_status_injection parameters default to false. since staging replay exercises the mediator bot (which has both flags true in its spec), leaving staging.py unchanged means cross-topic peek/status injection is not exercised during staging replay, causing divergence from production behavior. the plan should explicitly state what values to pass. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan's step 7d updates _render_with_counts for dyadic rendering but does not explicitly mention updating _render_solo_with_counts in hot_context_solo.py for the solo cross_topic_peek block. since render_hot_context_solo delegates actual text generation to _render_solo_with_counts, the cross_topic_peek block must be added there. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 8 places the pregnancy block in solo hot context gated on bot_id == 'tante_rosi'. the bot_id is read from where? hot_context_solo.py builders typically take a botspec / topic, not a bare bot_id string. plan doesn't enumerate where the gate condition is plumbed from. minor but executor needs clarity. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: new issue: the 0020 migration ddl defines channels with unique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows with guild_id=null, channel_id=null and the same transport+address would not conflict. however, scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, which requires a matching unique index on those coalesce expressions. without it, the seed script will raise 'there is no unique or exclusion constraint matching the on conflict specification'. the ddl should either use unique nulls not distinct (pg15+, and the repo uses pg16 per test_eval_workflow.py:36) or a unique index on the coalesce expressions. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 adds bot_id kwarg to hooks.paused_for_user. callers grep shows it is called from various places; the plan only enumerates messaging.py:170,335 as new bot_id-passing sites. other callers continue to call without bot_id (none default), which is fine, but plan should call out that all existing callers continue to work without modification. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: evals.runner.run_scenarios is referenced by the deferred step 2.1; plan doesn't enumerate that runner's callers or its schema dependencies. since step 2 is being deferred, this is moot — but if the script is still authored as a step 2.1 deliverable, it must not import anything that hits the pooler at import time. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 strips bot_spec defaults from tests/_scope_helpers.py:make_mediator_ctx, which has six call sites across tests/test_s2a_stamping.py (5 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that rely on the implicit default. the executor must update all six call sites to pass bot_spec explicitly. however, plan step 20's stop-condition nuance lists only steps 14–17 as the 'intentional-update list' and omits step 18. if the executor misses a call site and those tests fail, the stop condition text would classify the failure as 'unexpected' and trigger stop, even though the root cause is an incomplete step 18 execution. the stop condition should explicitly include step 18 (or enumerate test_s2a_stamping.py and test_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 5.3 read-gate behavior on error path: returns <outputmodel>(is_error=true, error=err, ...) with 'populate empty lists'. different read tools have different output shapes (some return single objects e.g. get_theme, get_self_model). plan says 'exact empty-output shape is per-tool' — but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: botspec.render_system_prompt has exactly one caller — agentic.py:721. step 6 passes partner=none for solo. the base method unpacks partner.name positionally; partner=none breaks the call regardless of solo renderer signature. the single caller passes a value the method cannot currently handle without a base.py edit. (flagged 2 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the plan updates agentic.py:722-725 (solo path) and 729-732 (dyad path) to pass allow_cross_topic_peek and allow_cross_topic_status_injection flags. however, the staging.py:47 call site is mentioned only as a vague 'if it calls build_hot_context' note. staging replay for mediator should pass allow_cross_topic_peek=true and allow_cross_topic_status_injection=true to mirror production, but the plan does not commit to this. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 10.3's early-return contract is loose ('analogous early-return matching the tool's return contract'). each of edit_message/delete_message/react_to_message returns a distinct outputmodel; the executor needs to construct the right model with action='unsupported' or similar. minor under-specification but the tools' existing 'unsupported' / 'not_found' return shapes provide an obvious template. (flagged 1 times across 1 plans)
[DEBT] inbound-boundary: full scope construction happens after user resolution rather than literally in gateway handlers. (flagged 1 times across 1 plans)
[DEBT] issue-hints-completeness: issue_hints / completeness: user note explicitly defers t2 (eval baseline capture) due to supabase transaction-mode pooler not preserving set search_path. plan still has step 2 in phase 0 as a gating task, with phase 0 listed first in execution order and the final validation order step diffing against the baseline. plan body must be updated to mark step 2 as deferred, downgrade the related success criterion from 'must' to 'should/deferred', and remove the post-stamp diff from the must-do validation list. (flagged 1 times across 1 plans)
[DEBT] scope: scope: the plan adds cross_topic_peek to hotcontextsolo but does not explicitly update the copy constructor inside render_hot_context_solo (hot_context_solo.py:706-723) or the _render_solo_with_counts rendering function. if the dataclass field is added but the copy constructor omits it, peek data is silently lost during solo rendering. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.2 ddl for user_identities includes a verified_at timestamptz column. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a future alter table user_identities add column verified_at is required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.1 ddl for channels includes config jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. like verified_at, this is a small additive column that should be created now to match the locked schema; deferring it requires a later migration. the executor should add the column to the 0020 ddl. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claims populate_mediator_spec_from_db(pool) reads 'db-populated fields' for primary_topic_slug, participants_shape, read_scopes, etc. however, the bots table ddl in the plan only defines id, display_name, and created_at — none of the botspec scope fields have db columns. in practice the function will hardcode mediator defaults (primary_topic_slug='relationship', participants_shape='dyad') and only read display_name from the db row. the plan's wording could mislead the executor into writing a select * from bots expecting columns that do not exist. the implementation should explicitly select only display_name and hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns on bots, so hardcoding is correct for s1, but the plan text should be clarified. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief §16.1 work item 1 explicitly requires 'channel rows for current discord + whatsapp' seeded inside migration 0020. the revised plan instead moves channel seeding to a runtime script scripts/seed_channels.py. while the rationale (env vars differ across environments) is pragmatic, this is a concrete divergence from the locked architecture-doc brief which the plan must consume, not override. if the executor applies only the sql migrations, the channels table will be empty and routing will have no rows to resolve, breaking the mid-sprint checkpoint 'channel rows for current discord + whatsapp' gate. the runtime script must be documented as a mandatory post-migration step, but the brief expected it in the migration itself. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: debt-005/006/007/010: verified_at and channels.config jsonb added to 0020; step 10 clarifies populate_mediator_spec_from_db reads only display_name; channel seeding documented as mandatory post-migration script. debt-010 remains a literal divergence from §16.1 'channels seeded in migration 0020' wording but is now explicitly explained. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 13.2 adds optional bot_id kwarg to hooks.paused_for_user but the function's body still calls system_state.is_paused(_pool) only (global). the added parameter is wired in but not consumed in s2a — essentially a dead parameter until s2b. plan does not explicitly say so; executor may either leave it unused or call user_bot_paused. worth flagging for clarity. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: user note's deferral applies only to t2 (eval baseline). the core s2a deliverable — stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause — is independent of t2 and proceeds. plan does not currently distinguish; deferring t2 requires explicit text saying 'phase 0 step 2 is deferred to s3 pre-flight or end-of-sprint manual capture'. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: eval-baseline-related criteria in the success_criteria list (criterion 13: 'eval baseline captured by writing scripts/capture_eval_baseline.py ...') will be unmeetable if t2 is deferred. plan should downgrade that criterion's priority from 'must' to 'should' or mark deferred. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 18 instructs the executor to grep for bot_spec= to enumerate fixture defaults, but this pattern misses the actual signature default bot_spec: botspec | none = none in tests/_scope_helpers.py:35. there are 7 call sites across tests/test_s2a_stamping.py (6 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that invoke make_mediator_ctx() without passing bot_spec and rely on that default. because the grep won't surface the signature default, the executor may miss stripping it and updating the call sites, leaving the 'should' criterion partially unmet. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: write_tools.py has direct updates on all six artifact tables. plan defers these to s6 (defensible) but does not note that update-form direct accesses persist by design and the new from-form lint regex will not catch them. worth recording so s6 scope is unambiguous. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: partner_of is also called at inbound.py:130 (_control_recipients for pause/resume) and staging.py:32. plan step 6 only patches the runner. inbound.py:130 catches valueerror with a warning, so solo pause/resume logs a benign warning, but brief stop condition partner_of called for participants_shape==solo in any code path is strictly broader. plan should narrow the stop condition or patch inbound. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: brief locked decision #5 asks to verify resolve_bot returns coach for the coach's transport. migration 0031 explicitly defers channel seeding. plan includes no routing verification step — step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-043): search for related code: partner_of calls at inbound.py:130 and staging.py:32 remain unaddressed by step 6. valueerror catch in inbound makes it benign in practice but the brief stop condition is broader. plan unchanged. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-044): search for related code: resolve_bot routing for coach's transport is still unverified; channel seeding deferred in migration 0031 lines 31-33. plan adds no routing smoke step. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan adds cross_topic_peek to hotcontextsolo and says to update render_hot_context_solo, but render_hot_context_solo (hot_context_solo.py:706-723) constructs an explicit hotcontextsolo(...) copy with field-by-field assignment. if cross_topic_peek is added to the dataclass but not to this copy constructor, the peek data is silently dropped during solo rendering. the plan does not explicitly mention updating the copy constructor inside render_hot_context_solo. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan says 'similarly update render_hot_context_solo in hot_context_solo.py for cross_topic_peek only' but the actual text rendering for solo happens in _render_solo_with_counts (hot_context_solo.py:561), not in render_hot_context_solo (which only handles truncation). the plan does not explicitly mention adding the cross_topic_peek block to _render_solo_with_counts, creating ambiguity about where the solo rendering change belongs. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 2.4 says to grep for select.*from users\|_row_to_user to find other hydration sites. but there are likely selects that go through mediator.users schema-prefixed (per repo conventions) or use from_row/update … returning patterns that the regex would miss. the defensive if col in row fallback in _row_to_user catches missed sites at runtime (returns none) but means renders will silently show no pregnancy state from those code paths. worth surfacing. (flagged 1 times across 1 plans)
[DEBT] tests: old-behavior test file is not explicitly named. (flagged 1 times across 1 plans)
[DEBT] untagged: step 11 (prod-registration via bots table) reads a non-existent enabled column from bots (schema is id, display_name, created_at per 0020_topics_bots_bindings.sql). plan recommends option b but never adds a migration for the column or specifies row-existence as the gate. (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: standard.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T2]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC2]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/Veas/.megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_2.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
app/services/partner_sharing.py
user_bot_state
(user_id, bot_id)
dyads
dyad_members
code
Prior batch deviations (address if applicable):
[
"Full test suite still does not pass: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob fails looking for a fake-pool read:list_themes event; tests/test_decay.py has 3 failures on an unhandled fake-pool UPDATE after Anthropic 401 during observation rescoring. Same failure pattern as prior batch, unrelated to T2 helper changes.",
"Advisory audit finding: Git status shows changed files not claimed by any task: megaplans/, scripts/import_chatgpt.py, supabase/",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC8 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC9 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC10 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC11 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC12 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC13 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC14 is missing an executor acknowledgment.",
"Advisory audit finding: Tasks left pending after execute (executor never started them): T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14"
]
code
User action prerequisites:
No user_action prerequisites for this batch.
Batch-scoped sense checks:
[
{
"id": "SC3",
"task_id": "T3",
"question": "Are User, partner_of, and staging paths free of cross_thread_sharing_default selects/hydration while still supplying prompt code with per-bot partner-share state where needed?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in app/services/partner_sharing.py: normalize partner share values, fetch single/batch states from user_bot_state, upsert scoped (user_id, bot_id) state, resolve dyad partner via dyads/dyad_members, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "done",
"kind": "code",
"executor_notes": "Created app/services/partner_sharing.py with strict partner_share normalization, single and batch fetches keyed by (user_id, bot_id), scoped upsert for one (user_id, bot_id), dyad partner lookup through dyads/dyad_members, and provenance formatting that uses registry display names with bots-table and bot-id fallback. Added focused helper tests covering normalization, missing-row pending behavior, scoped upsert, dyad lookup, and provenance fallback. Focused tests passed. Full pytest was rerun and still fails only in the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures from batch 1.",
"files_changed": [
"app/services/partner_sharing.py",
"tests/test_partner_sharing.py"
],
"commands_run": [
"python -m black app/services/partner_sharing.py tests/test_partner_sharing.py",
"python -m py_compile app/services/partner_sharing.py",
"pytest tests/test_partner_sharing.py -q",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q",
"pytest -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update app/models/user.py, app/services/turn_context.py::partner_of, and app/staging.py so they no longer select, hydrate, pass, or depend on cross_thread_sharing_default; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T4",
"description": "Replace the legacy sharing tool with set_partner_sharing: update root tool_schemas.py, app/services/tools/write_tools.py, app/services/tools/registry.py, and app/services/tools/scope_guard.py; remove/deprecate update_cross_thread_sharing_default; ensure the new tool accepts only opt_in: bool plus optional reason and writes only (ctx.user.id, ctx.bot_id) via the shared helper.",
"depends_on": [
"T2",
"T3"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T5",
"description": "Run and act on a stale-reference sweep before deeper rewrites: use rg \"cross_thread_sharing_default|update_cross_thread_sharing_default|current_user_sharing_default|partner_sharing_default|sharing_default\" app tests tool_schemas.py; rewrite production hits to per-bot partner_share terminology or document intentional historical/test-only references.",
"depends_on": [
"T3",
"T4"
],
"status": "pending",
"kind": "audit",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T6",
"description": "Flip raw privacy decisions to partner-share terminology in app/services/cross_thread_privacy.py: decision inputs/results should use owner partner_share for the relevant message bot, with NULL/unset and opt_out blocking partner-visible raw content and own-owner reads unchanged.",
"depends_on": [
"T2",
"T5"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T7",
"description": "Scope raw-message reads by bot/topic in app/services/hot_context.py and app/services/tools/read_tools.py: recent/trigger/search/recent_activity paths must filter to current bot and active topic before applying privacy; get_distillations and write-tool owner visibility checks must load partner-share keyed by each source row's recorded_by_bot_id or source message bot_id. Treat legacy NULL message bot IDs as hidden from partner raw reads.",
"depends_on": [
"T6"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T8",
"description": "Rewrite dyadic hot context partner-share state and cross-bot summary rendering in app/services/hot_context.py: add current/partner partner_share and partner_sharing_state, emit pending only when current user has a resolved dyad partner and current bot state is missing/NULL, remove the hardcoded urgent sharing block, pull partner dyad_shareable memories/distillations from any opted-in bot, render only shareable_summary with shared provenance prefix, sort by recency across bots, and cap globally (for example 12 rows) with a code comment or test documenting the rule.",
"depends_on": [
"T2",
"T7"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T9",
"description": "Extend solo hot context in app/services/hot_context_solo.py: resolve dyad partner existence through the shared helper, add current-bot partner_share and partner_sharing_state, suppress pending when no partner exists, and keep solo bots from exposing partner raw messages or partner memories.",
"depends_on": [
"T2",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T10",
"description": "Define one canonical pending partner-sharing prompt slot in app/bots/prompts/partner_sharing.py. Keep it domain-agnostic and model-facing: raise the choice naturally this turn unless crisis/time-critical, call set_partner_sharing(opt_in=...) in the record step after an explicit choice, and do not share this bot's rows until opt-in.",
"depends_on": [
"T4",
"T8",
"T9"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T11",
"description": "Wire the canonical prompt slot through every bot prompt path: update app/bots/base.py, app/services/prompts.py, app/services/prompts_solo.py, app/bots/prompts/tante_rosi.py, app/bots/coach.py, and app/bots/tante_rosi.py so mediator, Tante Rosi, coach, and future solo bots receive partner_share/partner_sharing_state; replace stale mediator onboarding language and tool references; add only Rosi-specific guidance for safe pregnancy dyad_shareable facts once opted in.",
"depends_on": [
"T10"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T12",
"description": "Extend memory and distillation write/read contracts: in root tool_schemas.py, add visibility and shareable_summary to AddMemoryInput with a validator requiring non-empty summaries for dyad_shareable; update app/services/tools/write_tools.py to persist and encrypt memory shareable summaries, keep superseded replacement behavior explicit, ensure add_distillation() writes recorded_by_bot_id=ctx.bot_id, and update read/render paths so partner/cross-bot rows expose only summaries.",
"depends_on": [
"T4",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T13",
"description": "Update existing test infrastructure and regression tests in place. Extend fake pool/fixtures for bots, user_bot_state.partner_share, message bot_id/topic_id, and memory sharing fields; update affected existing tests to remove the old user column; add or extend regression coverage for migration SQL, privacy matrix, cross-bot independence, raw-message bot isolation, prompt-slot pending/no-partner behavior, set_partner_sharing scoped Rosi success, and add_memory shareable-summary validation.",
"depends_on": [
"T1",
"T2",
"T7",
"T8",
"T9",
"T11",
"T12"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T14",
"description": "Final verification only: run the stale-reference sweeps and focused tests named by the approved plan, then the full relevant suite. Include commands such as rg \"cross_thread_sharing_default|update_cross_thread_sharing_default\" app tool_schemas.py, rg \"current_user_sharing_default|partner_sharing_default|sharing_default\" app tool_schemas.py, pytest tests/test_tool_schemas_importable.py tests/test_tools.py -q, hot-context/read-tool tests, prompt/allowlist tests, and finally pytest if focused tests pass. Also write a short throwaway script that reproduces the original leak/bug scenario (partner-share per bot: Rosi opt-in exposes only Rosi summaries while mediator opt-out blocks mediator rows and raw cross-bot messages), run it, record the result, and delete the script before finishing. Do not create new permanent test files in this final task; fix failures and rerun until passing or document a concrete blocker.",
"depends_on": [
"T13"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
],
"watch_items": [
"Do not invoke the megaplan CLI, read the megaplan skill, or start nested planning; treat this as a direct execution brief.",
"The migration is the highest-risk piece: seed bots(id='tante_rosi') before any Rosi user_bot_state write, backfill mediator non-NULL values before dropping the old users column, and keep the SQL transactional.",
"Raw messages must remain same-bot/topic scoped. Cross-bot partner sharing is summaries only, never raw content.",
"partner_share IS NULL and missing user_bot_state both mean pending for prompts but silent for read-path sharing; opt_out is silent and suppresses the prompt slot.",
"Partner resolution uses dyads/dyad_members, not users.partner_user_id.",
"Root tool_schemas.py is the schema target; there is no app/services/tools/tool_schemas.py.",
"Use recorded_by_bot_id and source message bot_id as the gate key for artifacts. Do not gate Rosi artifacts with mediator partner-share or vice versa.",
"The provenance prefix must come from a shared helper using bot registry display names with DB/id fallback, not scattered hard-coded strings.",
"Cross-bot shareable rows need a fixed global cap and recency ordering documented in code or tests to avoid context bloat.",
"Do not make unrelated debt items worse, especially staging hot-context divergence and existing bot/topic routing assumptions.",
"Respect the write-access contract: attempt real edits and only report permission failure after an actual OS-level rejection and retry."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does migration 0035_per_bot_partner_sharing.sql run in one transaction, seed tante_rosi, add constrained partner_share, backfill mediator non-NULL values exactly, add memory sharing fields/checks/indexes, and drop the old users column last?",
"executor_note": "Yes. Migration 0035 is transactional, seeds tante_rosi, constrains partner_share, backfills non-NULL mediator sharing values exactly from the legacy user column before dropping it, adds constrained memory sharing fields plus encrypted summary storage and indexes, and drops users.cross_thread_sharing_default last.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do all shared helpers use (user_id, bot_id) without silently creating arbitrary bot IDs, resolve dyad partner through dyads/dyad_members, and produce provenance from registry display names with fallback?",
"executor_note": "Yes. The helper APIs read/write only explicit (user_id, bot_id) keys and do not create bot rows; unknown bot IDs fall through to DB/id display fallback while FK constraints will guard writes. Partner resolution uses dyads/dyad_members, and provenance uses the bot registry display name first with bots.display_name and raw id fallbacks.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are User, partner_of, and staging paths free of cross_thread_sharing_default selects/hydration while still supplying prompt code with per-bot partner-share state where needed?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Is set_partner_sharing the only sharing-state write tool, with no user/bot input override and with allowlist/registry/scope guard wiring for mediator, Rosi, coach, and generic record/write steps?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does the grep sweep show no production dependence on the dropped user field or old tool, and are remaining sharing_default strings intentional historical/test references or rewritten?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does raw_message_visibility() preserve owner-visible behavior while partner visibility depends only on the owner's partner_share for the message's bot, with NULL/unset and opt_out blocking?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Can a mediator opt-in no longer expose Rosi raw messages through hot context, search_messages, or recent_activity, including when legacy messages have NULL bot_id?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC8",
"task_id": "T8",
"question": "Does dyadic hot context emit pending only for current user/current bot with a partner, pull opted-in cross-bot summaries only, use provenance prefixes, enforce recency ordering, and cap total cross-bot rows?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC9",
"task_id": "T9",
"question": "Does solo hot context ask about partner sharing only when a dyad partner exists and avoid exposing partner raw/messages/memories to solo bots?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC10",
"task_id": "T10",
"question": "Is the pending prompt slot defined once, neutral, domain-agnostic, and explicit about set_partner_sharing after an explicit choice?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC11",
"task_id": "T11",
"question": "Do mediator, Tante Rosi, coach, and generic solo prompt paths all render the canonical slot from partner_sharing_state and avoid stale update_cross_thread_sharing_default language?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC12",
"task_id": "T12",
"question": "Does add_memory reject blank/missing shareable_summary for dyad_shareable, persist/encrypt summaries, and do partner/cross-bot renders expose only shareable_summary while own same-bot reads retain full content as appropriate?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC13",
"task_id": "T13",
"question": "Do updated existing tests cover NULL, opt-out, opt-in+private, opt-in+dyad_shareable, independent per-bot gates, raw-message bot isolation, no-partner prompt suppression, Rosi FK success, and memory validation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC14",
"task_id": "T14",
"question": "Do the final grep sweeps, focused pytest commands, full suite or documented subset, and deleted throwaway reproduction script demonstrate the feature works without stale production references?",
"executor_note": "",
"verdict": ""
}
],
"user_actions": [
{
"id": "U1",
"description": "After the code is merged, apply the new database migration to the target staging/production database using the project's normal migration process, then deploy the matching application version atomically with that schema change.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "The repo executor can write and test the migration locally, but applying it to external environments and coordinating deploy order requires operator access.",
"requires_human_only_reason": null
},
{
"id": "U2",
"description": "After deployment, manually smoke test one dyad with mediator and Tante Rosi: pending prompt appears when undecided, set_partner_sharing records opt-in/out for the active bot only, and the partner sees only opted-in shareable summaries with provenance.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "Manual product smoke coverage catches prompt UX and live-data integration issues outside the local test harness.",
"requires_human_only_reason": null
}
],
"meta_commentary": "Execute in schema-first order, then remove the old user field everywhere before relying on the dropping migration. Keep the raw-message boundary strict: current-bot partner_share can unlock only same-bot/topic raw messages, while cross-bot sharing is summary-only and gated by the artifact owner\u2019s partner_share for the artifact\u2019s recorded bot. The main implementation trap is a partial migration/code split: do not leave production code reading users.cross_thread_sharing_default after 0035 drops it. The second trap is prompt inheritance: wire the canonical slot through generic solo prompts so coach and future solo bots get it without bespoke work.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add Tante Rosi bot id constant and replace literals where appropriate.",
"finalize_item_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add migration 0035_per_bot_partner_sharing.sql with Rosi bot seed, partner_share, backfill, memory fields, indexes, and old-column drop.",
"finalize_item_ids": [
"T1",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 3: Add shared partner-sharing service for normalization, fetching, upsert, partner resolution, and provenance.",
"finalize_item_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Update user model, turn context, and staging to remove global sharing field and use per-bot state.",
"finalize_item_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Replace old sharing tool and registry/scope references with set_partner_sharing.",
"finalize_item_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Run stale-reference sweep for old sharing names before deeper rewrites.",
"finalize_item_ids": [
"T5",
"T14"
]
},
{
"plan_step_summary": "Step 7: Flip pure privacy decisions to use per-bot partner_share.",
"finalize_item_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Scope dyadic raw-message reads by bot/topic in hot context and read tools.",
"finalize_item_ids": [
"T7",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 9: Rewrite dyadic hot-context partner-share state and labels.",
"finalize_item_ids": [
"T8"
]
},
{
"plan_step_summary": "Step 10: Add cross-bot shareable-summary pull with provenance, recency ordering, and cap.",
"finalize_item_ids": [
"T8",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 11: Extend solo hot context with current-bot partner-share pending state and no partner content exposure.",
"finalize_item_ids": [
"T9"
]
},
{
"plan_step_summary": "Step 12: Add canonical pending partner-sharing prompt slot once.",
"finalize_item_ids": [
"T10"
]
},
{
"plan_step_summary": "Step 13: Wire canonical slot through mediator, generic solo/coach, and Tante Rosi prompt paths.",
"finalize_item_ids": [
"T11"
]
},
{
"plan_step_summary": "Step 14: Extend memory tool schema/write path with visibility and shareable summary validation/persistence.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 15: Keep distillation contract bot-scoped and render partner/cross-bot rows as summaries only.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 16: Update fake pool and existing fixtures/tests for bots, user_bot_state.partner_share, message bot/topic, and removed users column.",
"finalize_item_ids": [
"T13"
]
},
{
"plan_step_summary": "Step 17: Add focused regression coverage for migration, privacy matrix, cross-bot independence, raw-message isolation, prompt slots, tools, and memory validation.",
"finalize_item_ids": [
"T13",
"T14"
]
},
{
"plan_step_summary": "Execution order and validation order: run stale-reference sweeps, focused pytest commands, full suite, and a throwaway reproduction script before finalizing.",
"finalize_item_ids": [
"T14"
]
},
{
"plan_step_summary": "External rollout: apply migration/deploy and manual smoke test outside the local repo executor.",
"finalize_item_ids": [
"U1",
"U2"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All approved numbered steps are mapped to execution tasks. The final task is intentionally verification-only and includes the required throwaway reproduction script, which must be deleted before completion. External DB migration/deploy and live smoke testing are captured as user actions because they require operator access outside repo editing.",
"coverage_complete": true
},
"baseline_test_failures": [],
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_note": "No baseline test run is part of finalization; executor should run the focused and full test commands in T14 after implementation."
}
code
Debt watch items (do not make these worse):
[DEBT] all-locations: all_locations: staging.py:47 calls build_hot_context without the new allow_cross_topic_peek/allow_cross_topic_status_injection flags. since these default to false, staging replay of the mediator bot will not exercise cross-topic paths, diverging from production behavior where mediator has both flags true. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan’s scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standard unique (transport, address, guild_id, channel_id) constraint on raw columns. postgresql on conflict target lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs like coalesce in the target list do not match a raw-column unique constraint and will raise a syntax or 'no unique or exclusion constraint matching the on conflict specification' error at runtime. the seed script will fail unless either (a) the table is changed to use an expression-based unique index with those exact coalesce expressions, or (b) the seed script is rewritten to query-first/insert-if-missing or uses the plain column names and accepts the null-handling semantics of the constraint. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: phase b cte pair (ins and src) requires identical where/order/limit clauses for cursor correctness. both are written aligned but nothing enforces the invariant during executor edits; drift would silently mis-advance cursor. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5.1 says dyad_id is appended before the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed by current_step: turnstep = "respond" at the next line. placement intent is clear (append at end of optional block), but the line reference may drift after the field is added. minor precision wobble; not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: eval baseline capture (step 2) is technically blocked by infra. the plan's approach (write script in main tree, copy to worktree, run there) assumes python scripts/capture_eval_baseline.py can connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserve set search_path across connection acquisitions, so the script would fail with schema lookup errors. the plan should add an alternative path (port 5432 session-mode override, or explicit schema-qualified queries everywhere, or defer entirely). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the lint script scripts/lint_inserts.py has a directory-not-found error path at lines 305-309 that still exits 0. the plan step 13 says to remove the # todo(s2b) marker at line 308 but does not mention changing the sys.exit(0) at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid --dir argument (or when args.dir resolves to a non-existent path) will silently exit 0. this defeats the ci-blocking intent because a typo in the scan directory would be treated as success instead of failure. the fix is trivial: change sys.exit(0) to sys.exit(1) at line 309 (or remove the error-path todo and update the exit code in the same step). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 4.5's _row_matches_topic helper falls back to global behavior when (table, id) is not in self.artifact_topics — explicitly for backward compatibility. this is sensible but creates a subtle hazard: a test that forgets to call link_topic for a new artifact sees global decay behavior with no warning, which could mask the very scoping bug the new test in step 12 is meant to catch. the decay scope test does call link_topic for both topics, so it's safe; future authors may not. worth recording but not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: flag-017 (decay handler backward-compat fallback) is downgraded to accepted maintainability debt with an inline warning comment per step 4.5. the warning text explicitly tells future authors to call link_topic. acceptable, but a noisy assertion (e.g. log a warning when topic_id present in sql but row has no link) would catch silent regressions more loudly. not blocking. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 11 sql returns last_updated_at, but settopicstatusoutput field is named updated_at. the executor needs to alias on read (e.g., row['last_updated_at']). minor mapping point, not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 18 coach botspec writes tool_allowlist=frozenset({...}) - frozenset({'set_topic_status'}) with {...} as a placeholder. the executor needs to know what set to start from (probably the union of step_allowed_tools). this is under-specified; the executor will likely just use 'all tools currently in tool_dispatch minus set_topic_status', which is fine, but worth pinning. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: botspec.render_system_prompt at app/bots/base.py:63-79 unpacks partner.name and partner.cross_thread_sharing_default positionally before delegating to the renderer. plan step 6 passes partner=none for solo turns and assumption #5 says base.py does not need modification. the **kwargs trick in the solo renderer cannot help — attributeerror fires inside botspec.render_system_prompt before the renderer runs. plan must commit to patching base.py (or route solo turn around botspec.render_system_prompt). (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 6 parameterizes topic_id at agentic.py:753 (event metadata) and 778 (turncontext.primary_topic_id) but omits line 737 where _open_turn(..., topic_id=get_relationship_topic_id(), ...) is hardcoded. without patching line 737, persisted turn rows for coach carry topic_id=relationship — directly trips stop condition solo bot writes to mediator's relationship topic in any test. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-041): are the proposed changes technically correct?: botspec.render_system_prompt unpacks partner.name positionally before delegating; partner=none still breaks regardless of solo renderer **kwargs. plan is unchanged from prior critique. carrying as accepted debt per guidance. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-042): are the proposed changes technically correct?: step 6 still omits agentic.py:737 (the _open_turn topic_id kwarg). same gap as prior iteration; trips stop condition if not addressed by executor. carrying as accepted debt. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5's mid-turn refresh refetches user inside the same db transaction (for update held). if the refresh uses fetch_user_by_id rather than dataclasses.replace, it issues a select through the pool while the same connection holds the lock — with asyncpg pools this can deadlock unless the same acquired connection is reused. plan offers both options without specifying which connection the re-fetch uses. dataclasses.replace avoids this entirely; if executor picks fetch_user_by_id, lock contention risk is real. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 2.5 says to copy the 8 new fields through the post-resolve user rebuild in fetch_user_by_id l.152-160. with 8 fields plus existing ones, the constructor call grows long and is easy to miss a field. using dataclasses.replace(user, phone=resolved) would be cleaner and forward-compatible — plan instead keeps the verbose pattern. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the scripts/seed_channels.py plan uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration creates a plain unique (transport, address, guild_id, channel_id) constraint. postgresql requires the on conflict target to match a unique constraint or index exactly; an expression-based target without a matching expression index will raise a runtime error. additionally, the raw unique constraint treats nulls as distinct, so it cannot deduplicate whatsapp channels where guild_id and channel_id are null. the executor must either add a matching unique expression index in 0020, or rewrite the seed script to use a pre-insert select check instead of on conflict. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the 0020 migration plan for user_identities omits the verified_at timestamptz column present in architecture doc §12.2 ddl, while claiming 'exactly per §3/§12 ddl'. since account-linking workflows are deferred beyond s1, the column is not functionally load-bearing yet, but the claim of exact ddl match is incorrect. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the resolve_binding sql in app/services/routing.py uses limit 1 without order by. if a user ever has both a solo binding and a dyad binding to the same bot, the returned row is non-deterministic. the schema has no unique constraint preventing multiple bindings per (bot_id, user_id). since s1 only seeds one dyad binding and the module is not wired into inbound yet, this is latent future risk rather than an immediate s1 blocker. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user notes #1/#2 asked to restructure user_actions.md (split t14, move u1 to after execute). the plan addresses the spirit via execution order but does not enumerate user_actions.md content changes. if the harness consumes a separate user_actions.md, it may still reflect pre-revision ordering. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: verified step 8.1 names the scheduler claim query precisely at scheduled_jobs.py:104 (_claim_due_jobs). the plan cites returning lines 124-125 but the actual file has the returning list at lines 126-127 (off by ~2 because the plan was computed against a stale snapshot). executor will still find the right block, but the precise line offset is wrong. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the user note explicitly directs: t2 (eval baseline capture) is blocked by supabase transaction-mode pooler — set search_path doesn't persist across pooled connections — and must be deferred, with sprint proceeding on t6–t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task with phase 0 must run first execution order. plan body and execution order do not reflect the deferral; executor will block on it. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: validation order steps 1 and 11 still reference the eval baseline (tests/fixtures/eval_baseline/ populated; final python -m evals run diff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-run python -m evals run --prompt-version v1; diff against tests/fixtures/eval_baseline/'. if t2 is deferred there is no baseline to diff against; this step needs to be conditioned on baseline availability or removed. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: advisory: lint_inserts.py line 325 still contains the comment '# always exit 0 in s2a (advisory).' which will become stale after step 13 makes the linter blocking. the adjacent line 326 todo(s2b) is removed, but this stale advisory comment is not mentioned in the plan. it is cosmetic and will be obvious to the executor when editing line 327, but it is a minor maintainability drift. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: q1 resolved by stashing tool_schemas.py first (step 21.2) and q4 resolved by numbered 0031 migration with in-sql guard — but the stash-pop-at-end plan introduces a new risk: sprint edits to tool_schemas.py will conflict with the stashed dirty diff on pop. plan should either drop the stashed tool_schemas.py changes outright or note that conflict resolution is the executor's responsibility. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user note defers t16 (preflight: staging seed + consenting uuid) with explicit instruction to proceed on code-only items 1-8 and treat preflight as pass with todo comments. plan step 9 already gates prod-promotion behind staging verification and falls back to a feedback.md todo — consistent with the deferral. plan does not however explicitly add 'todo comments in coach scaffold code referencing the operator decision' as the user note requests; executor should add a todo marker in app/bots/coach.py per the note. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: recurring debt: did the work fully address: step 11 option b reads enablement from the bots table assuming a row like id='tante_rosi', enabled=true, but migrations/0020_topics_bots_bindings.sql defines bots(id, display_name, created_at) — there is no enabled column. either an extra migration must add the column, or the gate must rely on row existence. plan picks option b as recommended but does neither explicitly. (flagged 1 times across 1 plans)
[DEBT] discord-ingress: exact discord converter/signature edit is not named in the plan. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool with channels, user_identities, bot_bindings, dyads, and dyad_members dicts so the sql patterns in resolve_bot, resolve_sender, and resolve_binding can match against stored rows. however, tests/conftest.py is explicitly listed in the brief as a dirty file that must not be touched. the revised plan says "extend fakepool minimally" twice (step 9 and step 11 assumption) but never specifies how to do so without modifying conftest.py—for example by defining a local routingfakepool(fakepool) subclass inside tests/test_routing.py or by monkeypatching the class in that test module. if the executor follows the plan literally and edits conftest.py, they will violate a locked constraint. if they do not extend fakepool, the routing unit tests cannot be implemented as written. this is a supporting-infrastructure gap. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: step 3 updates scripts/seed_channels.py to import _decode_discord_user_id from the new shared module. the seeder also previously had a regex _discord_bot_user_id_re constant (or similar) inline; if the seeder's local regex remains while the new module redefines it, the two could drift. plan should explicitly say the seeder deletes its local copy. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters but paused_for_user does not currently call logger.* (verified by reading hooks.py). the plan instructs to log extra={user_id, bot_id} — if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: scripts/capture_eval_baseline.py is still listed as a deliverable (step 2.1) and a smoke test (step 2.7 --help invocation). if t2 is deferred, the script could either (a) not be written, or (b) be written but its run deferred. plan should specify which. the smoke test alone (--help) does not require the pooler. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 0 contains both step 1 (parity + identity seeding pre-flight) and step 2 (eval baseline). step 1 is independent of the pooler block — it queries via psql or any working connection — and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: get_relationship_topic_id() is referenced in agentic.py at lines 719, 737, 753, 778. step 6 covers 719/721, 753, 767/778, 793 but not 737. same gap as correctness finding — _open_turn's topic_id kwarg must also be parameterized. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: recurring debt (debt-045): does the change touch all locations: get_relationship_topic_id() at agentic.py:737 still not in step 6's enumeration. same as debt-042. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan does not specify that step 5's coach scaffold should carry a todo comment referencing the deferred t16 preflight (operator-held uuid + staging seed verification) per the new user note. minor scope addition the executor must remember. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan mentions updating app/staging.py:47 'if it calls build_hot_context'. staging.py:47 does call build_hot_context with primary_topic_id=get_relationship_topic_id(). the new allow_cross_topic_peek and allow_cross_topic_status_injection parameters default to false. since staging replay exercises the mediator bot (which has both flags true in its spec), leaving staging.py unchanged means cross-topic peek/status injection is not exercised during staging replay, causing divergence from production behavior. the plan should explicitly state what values to pass. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan's step 7d updates _render_with_counts for dyadic rendering but does not explicitly mention updating _render_solo_with_counts in hot_context_solo.py for the solo cross_topic_peek block. since render_hot_context_solo delegates actual text generation to _render_solo_with_counts, the cross_topic_peek block must be added there. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 8 places the pregnancy block in solo hot context gated on bot_id == 'tante_rosi'. the bot_id is read from where? hot_context_solo.py builders typically take a botspec / topic, not a bare bot_id string. plan doesn't enumerate where the gate condition is plumbed from. minor but executor needs clarity. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: new issue: the 0020 migration ddl defines channels with unique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows with guild_id=null, channel_id=null and the same transport+address would not conflict. however, scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, which requires a matching unique index on those coalesce expressions. without it, the seed script will raise 'there is no unique or exclusion constraint matching the on conflict specification'. the ddl should either use unique nulls not distinct (pg15+, and the repo uses pg16 per test_eval_workflow.py:36) or a unique index on the coalesce expressions. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 adds bot_id kwarg to hooks.paused_for_user. callers grep shows it is called from various places; the plan only enumerates messaging.py:170,335 as new bot_id-passing sites. other callers continue to call without bot_id (none default), which is fine, but plan should call out that all existing callers continue to work without modification. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: evals.runner.run_scenarios is referenced by the deferred step 2.1; plan doesn't enumerate that runner's callers or its schema dependencies. since step 2 is being deferred, this is moot — but if the script is still authored as a step 2.1 deliverable, it must not import anything that hits the pooler at import time. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 strips bot_spec defaults from tests/_scope_helpers.py:make_mediator_ctx, which has six call sites across tests/test_s2a_stamping.py (5 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that rely on the implicit default. the executor must update all six call sites to pass bot_spec explicitly. however, plan step 20's stop-condition nuance lists only steps 14–17 as the 'intentional-update list' and omits step 18. if the executor misses a call site and those tests fail, the stop condition text would classify the failure as 'unexpected' and trigger stop, even though the root cause is an incomplete step 18 execution. the stop condition should explicitly include step 18 (or enumerate test_s2a_stamping.py and test_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 5.3 read-gate behavior on error path: returns <outputmodel>(is_error=true, error=err, ...) with 'populate empty lists'. different read tools have different output shapes (some return single objects e.g. get_theme, get_self_model). plan says 'exact empty-output shape is per-tool' — but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: botspec.render_system_prompt has exactly one caller — agentic.py:721. step 6 passes partner=none for solo. the base method unpacks partner.name positionally; partner=none breaks the call regardless of solo renderer signature. the single caller passes a value the method cannot currently handle without a base.py edit. (flagged 2 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the plan updates agentic.py:722-725 (solo path) and 729-732 (dyad path) to pass allow_cross_topic_peek and allow_cross_topic_status_injection flags. however, the staging.py:47 call site is mentioned only as a vague 'if it calls build_hot_context' note. staging replay for mediator should pass allow_cross_topic_peek=true and allow_cross_topic_status_injection=true to mirror production, but the plan does not commit to this. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 10.3's early-return contract is loose ('analogous early-return matching the tool's return contract'). each of edit_message/delete_message/react_to_message returns a distinct outputmodel; the executor needs to construct the right model with action='unsupported' or similar. minor under-specification but the tools' existing 'unsupported' / 'not_found' return shapes provide an obvious template. (flagged 1 times across 1 plans)
[DEBT] inbound-boundary: full scope construction happens after user resolution rather than literally in gateway handlers. (flagged 1 times across 1 plans)
[DEBT] issue-hints-completeness: issue_hints / completeness: user note explicitly defers t2 (eval baseline capture) due to supabase transaction-mode pooler not preserving set search_path. plan still has step 2 in phase 0 as a gating task, with phase 0 listed first in execution order and the final validation order step diffing against the baseline. plan body must be updated to mark step 2 as deferred, downgrade the related success criterion from 'must' to 'should/deferred', and remove the post-stamp diff from the must-do validation list. (flagged 1 times across 1 plans)
[DEBT] scope: scope: the plan adds cross_topic_peek to hotcontextsolo but does not explicitly update the copy constructor inside render_hot_context_solo (hot_context_solo.py:706-723) or the _render_solo_with_counts rendering function. if the dataclass field is added but the copy constructor omits it, peek data is silently lost during solo rendering. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.2 ddl for user_identities includes a verified_at timestamptz column. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a future alter table user_identities add column verified_at is required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.1 ddl for channels includes config jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. like verified_at, this is a small additive column that should be created now to match the locked schema; deferring it requires a later migration. the executor should add the column to the 0020 ddl. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claims populate_mediator_spec_from_db(pool) reads 'db-populated fields' for primary_topic_slug, participants_shape, read_scopes, etc. however, the bots table ddl in the plan only defines id, display_name, and created_at — none of the botspec scope fields have db columns. in practice the function will hardcode mediator defaults (primary_topic_slug='relationship', participants_shape='dyad') and only read display_name from the db row. the plan's wording could mislead the executor into writing a select * from bots expecting columns that do not exist. the implementation should explicitly select only display_name and hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns on bots, so hardcoding is correct for s1, but the plan text should be clarified. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief §16.1 work item 1 explicitly requires 'channel rows for current discord + whatsapp' seeded inside migration 0020. the revised plan instead moves channel seeding to a runtime script scripts/seed_channels.py. while the rationale (env vars differ across environments) is pragmatic, this is a concrete divergence from the locked architecture-doc brief which the plan must consume, not override. if the executor applies only the sql migrations, the channels table will be empty and routing will have no rows to resolve, breaking the mid-sprint checkpoint 'channel rows for current discord + whatsapp' gate. the runtime script must be documented as a mandatory post-migration step, but the brief expected it in the migration itself. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: debt-005/006/007/010: verified_at and channels.config jsonb added to 0020; step 10 clarifies populate_mediator_spec_from_db reads only display_name; channel seeding documented as mandatory post-migration script. debt-010 remains a literal divergence from §16.1 'channels seeded in migration 0020' wording but is now explicitly explained. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 13.2 adds optional bot_id kwarg to hooks.paused_for_user but the function's body still calls system_state.is_paused(_pool) only (global). the added parameter is wired in but not consumed in s2a — essentially a dead parameter until s2b. plan does not explicitly say so; executor may either leave it unused or call user_bot_paused. worth flagging for clarity. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: user note's deferral applies only to t2 (eval baseline). the core s2a deliverable — stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause — is independent of t2 and proceeds. plan does not currently distinguish; deferring t2 requires explicit text saying 'phase 0 step 2 is deferred to s3 pre-flight or end-of-sprint manual capture'. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: eval-baseline-related criteria in the success_criteria list (criterion 13: 'eval baseline captured by writing scripts/capture_eval_baseline.py ...') will be unmeetable if t2 is deferred. plan should downgrade that criterion's priority from 'must' to 'should' or mark deferred. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 18 instructs the executor to grep for bot_spec= to enumerate fixture defaults, but this pattern misses the actual signature default bot_spec: botspec | none = none in tests/_scope_helpers.py:35. there are 7 call sites across tests/test_s2a_stamping.py (6 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that invoke make_mediator_ctx() without passing bot_spec and rely on that default. because the grep won't surface the signature default, the executor may miss stripping it and updating the call sites, leaving the 'should' criterion partially unmet. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: write_tools.py has direct updates on all six artifact tables. plan defers these to s6 (defensible) but does not note that update-form direct accesses persist by design and the new from-form lint regex will not catch them. worth recording so s6 scope is unambiguous. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: partner_of is also called at inbound.py:130 (_control_recipients for pause/resume) and staging.py:32. plan step 6 only patches the runner. inbound.py:130 catches valueerror with a warning, so solo pause/resume logs a benign warning, but brief stop condition partner_of called for participants_shape==solo in any code path is strictly broader. plan should narrow the stop condition or patch inbound. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: brief locked decision #5 asks to verify resolve_bot returns coach for the coach's transport. migration 0031 explicitly defers channel seeding. plan includes no routing verification step — step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-043): search for related code: partner_of calls at inbound.py:130 and staging.py:32 remain unaddressed by step 6. valueerror catch in inbound makes it benign in practice but the brief stop condition is broader. plan unchanged. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-044): search for related code: resolve_bot routing for coach's transport is still unverified; channel seeding deferred in migration 0031 lines 31-33. plan adds no routing smoke step. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan adds cross_topic_peek to hotcontextsolo and says to update render_hot_context_solo, but render_hot_context_solo (hot_context_solo.py:706-723) constructs an explicit hotcontextsolo(...) copy with field-by-field assignment. if cross_topic_peek is added to the dataclass but not to this copy constructor, the peek data is silently dropped during solo rendering. the plan does not explicitly mention updating the copy constructor inside render_hot_context_solo. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan says 'similarly update render_hot_context_solo in hot_context_solo.py for cross_topic_peek only' but the actual text rendering for solo happens in _render_solo_with_counts (hot_context_solo.py:561), not in render_hot_context_solo (which only handles truncation). the plan does not explicitly mention adding the cross_topic_peek block to _render_solo_with_counts, creating ambiguity about where the solo rendering change belongs. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 2.4 says to grep for select.*from users\|_row_to_user to find other hydration sites. but there are likely selects that go through mediator.users schema-prefixed (per repo conventions) or use from_row/update … returning patterns that the regex would miss. the defensive if col in row fallback in _row_to_user catches missed sites at runtime (returns none) but means renders will silently show no pregnancy state from those code paths. worth surfacing. (flagged 1 times across 1 plans)
[DEBT] tests: old-behavior test file is not explicitly named. (flagged 1 times across 1 plans)
[DEBT] untagged: step 11 (prod-registration via bots table) reads a non-existent enabled column from bots (schema is id, display_name, created_at per 0020_topics_bots_bindings.sql). plan recommends option b but never adds a migration for the column or specifies row-existence as the gate. (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: standard.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T3]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC3]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/Veas/.megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_3.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
visibility
shareable_summary
app/services/partner_sharing.py
user_bot_state
(user_id, bot_id)
dyads
dyad_members
app/models/user.py
app/services/turn_context.py::partner_of
app/staging.py
cross_thread_sharing_default
code
Prior batch deviations (address if applicable):
[
"Full pytest still fails in the same prior unrelated-looking locations: tests/test_agentic.py::test_agentic_e2e_ordering_cache_spend_and_oob and three tests/test_decay.py failures around the fake-pool observation UPDATE after Anthropic 401.",
"A temporary non-hydrated User.cross_thread_sharing_default compatibility property remains so older tests/callers do not break before the later stale-reference cleanup batch. It is no longer selected from or hydrated from users.",
"Advisory quality: app/services/agentic.py grew by 260 lines (threshold 200).",
"Advisory quality: tests/conftest.py grew by 672 lines (threshold 200).",
"Advisory quality: app/staging.py adds unused imports: render_solo_system_prompt.",
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_3.json",
"Advisory audit finding: Git status shows changed files not claimed by any task: megaplans/, scripts/import_chatgpt.py, supabase/",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC8 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC9 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC10 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC11 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC12 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC13 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC14 is missing an executor acknowledgment.",
"Advisory audit finding: Tasks left pending after execute (executor never started them): T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14"
]
code
User action prerequisites:
No user_action prerequisites for this batch.
Batch-scoped sense checks:
[
{
"id": "SC4",
"task_id": "T4",
"question": "Is set_partner_sharing the only sharing-state write tool, with no user/bot input override and with allowlist/registry/scope guard wiring for mediator, Rosi, coach, and generic record/write steps?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"tasks": [
{
"id": "T1",
"description": "Add bot id constants and schema migration foundation: add TANTE_ROSI_BOT_ID in app/bots/ids.py, replace Python literals where touched, and create migrations/0035_per_bot_partner_sharing.sql as a single transaction that seeds bots(id='tante_rosi'), adds user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default, adds memory visibility/shareable_summary/encrypted summary fields with CHECK constraints and indexes, then drops the old users column at the end.",
"depends_on": [],
"status": "done",
"kind": "code",
"executor_notes": "Added TANTE_ROSI_BOT_ID and used it in the Tante Rosi spec/registry paths touched by this batch. Added migrations/0035_per_bot_partner_sharing.sql with one BEGIN/COMMIT transaction: seeds bots(id='tante_rosi'), adds constrained user_bot_state.partner_share, backfills non-NULL mediator values from users.cross_thread_sharing_default via INSERT ... ON CONFLICT DO UPDATE, adds memory visibility/shareable_summary/shareable_summary_encrypted with checks and indexes, and drops the legacy users column at the end. Verified Python compile and focused tests passed. Full pytest was run and still has unrelated existing-looking failures in tests/test_agentic.py and tests/test_decay.py.",
"files_changed": [
"app/bots/ids.py",
"app/bots/registry.py",
"app/bots/tante_rosi.py",
"migrations/0035_per_bot_partner_sharing.sql"
],
"commands_run": [
"python -m py_compile app/bots/ids.py app/bots/tante_rosi.py app/bots/registry.py",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest -q",
"pytest tests/test_agentic.py -q",
"pytest tests/test_decay.py -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T2",
"description": "Create shared partner-sharing helpers in app/services/partner_sharing.py: normalize partner share values, fetch single/batch states from user_bot_state, upsert scoped (user_id, bot_id) state, resolve dyad partner via dyads/dyad_members, and format provenance using bot registry display names with DB/id fallback.",
"depends_on": [
"T1"
],
"status": "done",
"kind": "code",
"executor_notes": "Created app/services/partner_sharing.py with strict partner_share normalization, single and batch fetches keyed by (user_id, bot_id), scoped upsert for one (user_id, bot_id), dyad partner lookup through dyads/dyad_members, and provenance formatting that uses registry display names with bots-table and bot-id fallback. Added focused helper tests covering normalization, missing-row pending behavior, scoped upsert, dyad lookup, and provenance fallback. Focused tests passed. Full pytest was rerun and still fails only in the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures from batch 1.",
"files_changed": [
"app/services/partner_sharing.py",
"tests/test_partner_sharing.py"
],
"commands_run": [
"python -m black app/services/partner_sharing.py tests/test_partner_sharing.py",
"python -m py_compile app/services/partner_sharing.py",
"pytest tests/test_partner_sharing.py -q",
"pytest tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py tests/test_partner_sharing.py -q",
"pytest -q"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T3",
"description": "Remove the global sharing field from user and turn/staging context: update app/models/user.py, app/services/turn_context.py::partner_of, and app/staging.py so they no longer select, hydrate, pass, or depend on cross_thread_sharing_default; load per-bot partner-share state where prompt rendering needs it.",
"depends_on": [
"T2"
],
"status": "done",
"kind": "code",
"executor_notes": "Removed production DB selection/hydration/use of users.cross_thread_sharing_default from User, partner_of, staging, and prompt rendering paths. Added per-bot partner-share loading for prompt rendering in agentic and staging via app.services.partner_sharing.get_partner_share, while keeping a temporary non-hydrated User compatibility shim for old callers until the later stale-reference cleanup batch. Updated FakePool for the new user SELECT shape and partner_share lookup. Verified focused user/partner-sharing/pregnancy/schema tests, hot-context/tools tests, and agentic/staging modules; full pytest was rerun and still only shows the same prior unrelated-looking tests/test_agentic.py and tests/test_decay.py failures.",
"files_changed": [
"app/models/user.py",
"app/services/turn_context.py",
"app/staging.py",
"app/bots/base.py",
"app/services/agentic.py",
"tests/conftest.py"
],
"commands_run": [
"python -m black app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py tests/conftest.py",
"python -m py_compile app/models/user.py app/services/turn_context.py app/bots/base.py app/services/agentic.py app/staging.py",
"pytest tests/test_pregnancy_user_model.py tests/test_partner_sharing.py tests/test_pregnancy_persona.py tests/test_tool_schemas_importable.py -q",
"pytest tests/test_agentic.py tests/test_agentic_lifecycle.py tests/test_staging.py -q",
"pytest tests/test_hot_context.py tests/test_tools.py -q",
"pytest -q",
"rg -n "SELECT[^\n]*cross_thread_sharing_default|cross_thread_sharing_default=row|cross_thread_sharing_default=user|user\.cross_thread_sharing_default|partner\.cross_thread_sharing_default" app/models/user.py app/services/turn_context.py app/staging.py app/bots/base.py app/services/agentic.py"
],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T4",
"description": "Replace the legacy sharing tool with set_partner_sharing: update root tool_schemas.py, app/services/tools/write_tools.py, app/services/tools/registry.py, and app/services/tools/scope_guard.py; remove/deprecate update_cross_thread_sharing_default; ensure the new tool accepts only opt_in: bool plus optional reason and writes only (ctx.user.id, ctx.bot_id) via the shared helper.",
"depends_on": [
"T2",
"T3"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T5",
"description": "Run and act on a stale-reference sweep before deeper rewrites: use rg \"cross_thread_sharing_default|update_cross_thread_sharing_default|current_user_sharing_default|partner_sharing_default|sharing_default\" app tests tool_schemas.py; rewrite production hits to per-bot partner_share terminology or document intentional historical/test-only references.",
"depends_on": [
"T3",
"T4"
],
"status": "pending",
"kind": "audit",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T6",
"description": "Flip raw privacy decisions to partner-share terminology in app/services/cross_thread_privacy.py: decision inputs/results should use owner partner_share for the relevant message bot, with NULL/unset and opt_out blocking partner-visible raw content and own-owner reads unchanged.",
"depends_on": [
"T2",
"T5"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T7",
"description": "Scope raw-message reads by bot/topic in app/services/hot_context.py and app/services/tools/read_tools.py: recent/trigger/search/recent_activity paths must filter to current bot and active topic before applying privacy; get_distillations and write-tool owner visibility checks must load partner-share keyed by each source row's recorded_by_bot_id or source message bot_id. Treat legacy NULL message bot IDs as hidden from partner raw reads.",
"depends_on": [
"T6"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T8",
"description": "Rewrite dyadic hot context partner-share state and cross-bot summary rendering in app/services/hot_context.py: add current/partner partner_share and partner_sharing_state, emit pending only when current user has a resolved dyad partner and current bot state is missing/NULL, remove the hardcoded urgent sharing block, pull partner dyad_shareable memories/distillations from any opted-in bot, render only shareable_summary with shared provenance prefix, sort by recency across bots, and cap globally (for example 12 rows) with a code comment or test documenting the rule.",
"depends_on": [
"T2",
"T7"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T9",
"description": "Extend solo hot context in app/services/hot_context_solo.py: resolve dyad partner existence through the shared helper, add current-bot partner_share and partner_sharing_state, suppress pending when no partner exists, and keep solo bots from exposing partner raw messages or partner memories.",
"depends_on": [
"T2",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T10",
"description": "Define one canonical pending partner-sharing prompt slot in app/bots/prompts/partner_sharing.py. Keep it domain-agnostic and model-facing: raise the choice naturally this turn unless crisis/time-critical, call set_partner_sharing(opt_in=...) in the record step after an explicit choice, and do not share this bot's rows until opt-in.",
"depends_on": [
"T4",
"T8",
"T9"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T11",
"description": "Wire the canonical prompt slot through every bot prompt path: update app/bots/base.py, app/services/prompts.py, app/services/prompts_solo.py, app/bots/prompts/tante_rosi.py, app/bots/coach.py, and app/bots/tante_rosi.py so mediator, Tante Rosi, coach, and future solo bots receive partner_share/partner_sharing_state; replace stale mediator onboarding language and tool references; add only Rosi-specific guidance for safe pregnancy dyad_shareable facts once opted in.",
"depends_on": [
"T10"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T12",
"description": "Extend memory and distillation write/read contracts: in root tool_schemas.py, add visibility and shareable_summary to AddMemoryInput with a validator requiring non-empty summaries for dyad_shareable; update app/services/tools/write_tools.py to persist and encrypt memory shareable summaries, keep superseded replacement behavior explicit, ensure add_distillation() writes recorded_by_bot_id=ctx.bot_id, and update read/render paths so partner/cross-bot rows expose only summaries.",
"depends_on": [
"T4",
"T8"
],
"status": "pending",
"kind": "code",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T13",
"description": "Update existing test infrastructure and regression tests in place. Extend fake pool/fixtures for bots, user_bot_state.partner_share, message bot_id/topic_id, and memory sharing fields; update affected existing tests to remove the old user column; add or extend regression coverage for migration SQL, privacy matrix, cross-bot independence, raw-message bot isolation, prompt-slot pending/no-partner behavior, set_partner_sharing scoped Rosi success, and add_memory shareable-summary validation.",
"depends_on": [
"T1",
"T2",
"T7",
"T8",
"T9",
"T11",
"T12"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
},
{
"id": "T14",
"description": "Final verification only: run the stale-reference sweeps and focused tests named by the approved plan, then the full relevant suite. Include commands such as rg \"cross_thread_sharing_default|update_cross_thread_sharing_default\" app tool_schemas.py, rg \"current_user_sharing_default|partner_sharing_default|sharing_default\" app tool_schemas.py, pytest tests/test_tool_schemas_importable.py tests/test_tools.py -q, hot-context/read-tool tests, prompt/allowlist tests, and finally pytest if focused tests pass. Also write a short throwaway script that reproduces the original leak/bug scenario (partner-share per bot: Rosi opt-in exposes only Rosi summaries while mediator opt-out blocks mediator rows and raw cross-bot messages), run it, record the result, and delete the script before finishing. Do not create new permanent test files in this final task; fix failures and rerun until passing or document a concrete blocker.",
"depends_on": [
"T13"
],
"status": "pending",
"kind": "test",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"auto_attributed_files": null,
"evidence_files": [],
"reviewer_verdict": "",
"stance": null,
"stop_signal": null
}
],
"watch_items": [
"Do not invoke the megaplan CLI, read the megaplan skill, or start nested planning; treat this as a direct execution brief.",
"The migration is the highest-risk piece: seed bots(id='tante_rosi') before any Rosi user_bot_state write, backfill mediator non-NULL values before dropping the old users column, and keep the SQL transactional.",
"Raw messages must remain same-bot/topic scoped. Cross-bot partner sharing is summaries only, never raw content.",
"partner_share IS NULL and missing user_bot_state both mean pending for prompts but silent for read-path sharing; opt_out is silent and suppresses the prompt slot.",
"Partner resolution uses dyads/dyad_members, not users.partner_user_id.",
"Root tool_schemas.py is the schema target; there is no app/services/tools/tool_schemas.py.",
"Use recorded_by_bot_id and source message bot_id as the gate key for artifacts. Do not gate Rosi artifacts with mediator partner-share or vice versa.",
"The provenance prefix must come from a shared helper using bot registry display names with DB/id fallback, not scattered hard-coded strings.",
"Cross-bot shareable rows need a fixed global cap and recency ordering documented in code or tests to avoid context bloat.",
"Do not make unrelated debt items worse, especially staging hot-context divergence and existing bot/topic routing assumptions.",
"Respect the write-access contract: attempt real edits and only report permission failure after an actual OS-level rejection and retry."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does migration 0035_per_bot_partner_sharing.sql run in one transaction, seed tante_rosi, add constrained partner_share, backfill mediator non-NULL values exactly, add memory sharing fields/checks/indexes, and drop the old users column last?",
"executor_note": "Yes. Migration 0035 is transactional, seeds tante_rosi, constrains partner_share, backfills non-NULL mediator sharing values exactly from the legacy user column before dropping it, adds constrained memory sharing fields plus encrypted summary storage and indexes, and drops users.cross_thread_sharing_default last.",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Do all shared helpers use (user_id, bot_id) without silently creating arbitrary bot IDs, resolve dyad partner through dyads/dyad_members, and produce provenance from registry display names with fallback?",
"executor_note": "Yes. The helper APIs read/write only explicit (user_id, bot_id) keys and do not create bot rows; unknown bot IDs fall through to DB/id display fallback while FK constraints will guard writes. Partner resolution uses dyads/dyad_members, and provenance uses the bot registry display name first with bots.display_name and raw id fallbacks.",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Are User, partner_of, and staging paths free of cross_thread_sharing_default selects/hydration while still supplying prompt code with per-bot partner-share state where needed?",
"executor_note": "Yes for the production paths in scope. User, partner_of, staging, base prompt rendering, and agentic prompt construction no longer select, hydrate, or pass users.cross_thread_sharing_default; prompt rendering now receives per-bot partner_share loaded by (user_id, bot_id). A temporary User compatibility property remains non-hydrated for legacy test/caller tolerance and is not a DB dependency.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Is set_partner_sharing the only sharing-state write tool, with no user/bot input override and with allowlist/registry/scope guard wiring for mediator, Rosi, coach, and generic record/write steps?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "Does the grep sweep show no production dependence on the dropped user field or old tool, and are remaining sharing_default strings intentional historical/test references or rewritten?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Does raw_message_visibility() preserve owner-visible behavior while partner visibility depends only on the owner's partner_share for the message's bot, with NULL/unset and opt_out blocking?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Can a mediator opt-in no longer expose Rosi raw messages through hot context, search_messages, or recent_activity, including when legacy messages have NULL bot_id?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC8",
"task_id": "T8",
"question": "Does dyadic hot context emit pending only for current user/current bot with a partner, pull opted-in cross-bot summaries only, use provenance prefixes, enforce recency ordering, and cap total cross-bot rows?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC9",
"task_id": "T9",
"question": "Does solo hot context ask about partner sharing only when a dyad partner exists and avoid exposing partner raw/messages/memories to solo bots?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC10",
"task_id": "T10",
"question": "Is the pending prompt slot defined once, neutral, domain-agnostic, and explicit about set_partner_sharing after an explicit choice?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC11",
"task_id": "T11",
"question": "Do mediator, Tante Rosi, coach, and generic solo prompt paths all render the canonical slot from partner_sharing_state and avoid stale update_cross_thread_sharing_default language?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC12",
"task_id": "T12",
"question": "Does add_memory reject blank/missing shareable_summary for dyad_shareable, persist/encrypt summaries, and do partner/cross-bot renders expose only shareable_summary while own same-bot reads retain full content as appropriate?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC13",
"task_id": "T13",
"question": "Do updated existing tests cover NULL, opt-out, opt-in+private, opt-in+dyad_shareable, independent per-bot gates, raw-message bot isolation, no-partner prompt suppression, Rosi FK success, and memory validation?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC14",
"task_id": "T14",
"question": "Do the final grep sweeps, focused pytest commands, full suite or documented subset, and deleted throwaway reproduction script demonstrate the feature works without stale production references?",
"executor_note": "",
"verdict": ""
}
],
"user_actions": [
{
"id": "U1",
"description": "After the code is merged, apply the new database migration to the target staging/production database using the project's normal migration process, then deploy the matching application version atomically with that schema change.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "The repo executor can write and test the migration locally, but applying it to external environments and coordinating deploy order requires operator access.",
"requires_human_only_reason": null
},
{
"id": "U2",
"description": "After deployment, manually smoke test one dyad with mediator and Tante Rosi: pending prompt appears when undecided, set_partner_sharing records opt-in/out for the active bot only, and the partner sees only opted-in shareable summaries with provenance.",
"phase": "after_execute",
"blocks_task_ids": null,
"rationale": "Manual product smoke coverage catches prompt UX and live-data integration issues outside the local test harness.",
"requires_human_only_reason": null
}
],
"meta_commentary": "Execute in schema-first order, then remove the old user field everywhere before relying on the dropping migration. Keep the raw-message boundary strict: current-bot partner_share can unlock only same-bot/topic raw messages, while cross-bot sharing is summary-only and gated by the artifact owner\u2019s partner_share for the artifact\u2019s recorded bot. The main implementation trap is a partial migration/code split: do not leave production code reading users.cross_thread_sharing_default after 0035 drops it. The second trap is prompt inheritance: wire the canonical slot through generic solo prompts so coach and future solo bots get it without bespoke work.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add Tante Rosi bot id constant and replace literals where appropriate.",
"finalize_item_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Add migration 0035_per_bot_partner_sharing.sql with Rosi bot seed, partner_share, backfill, memory fields, indexes, and old-column drop.",
"finalize_item_ids": [
"T1",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 3: Add shared partner-sharing service for normalization, fetching, upsert, partner resolution, and provenance.",
"finalize_item_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 4: Update user model, turn context, and staging to remove global sharing field and use per-bot state.",
"finalize_item_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 5: Replace old sharing tool and registry/scope references with set_partner_sharing.",
"finalize_item_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 6: Run stale-reference sweep for old sharing names before deeper rewrites.",
"finalize_item_ids": [
"T5",
"T14"
]
},
{
"plan_step_summary": "Step 7: Flip pure privacy decisions to use per-bot partner_share.",
"finalize_item_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 8: Scope dyadic raw-message reads by bot/topic in hot context and read tools.",
"finalize_item_ids": [
"T7",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 9: Rewrite dyadic hot-context partner-share state and labels.",
"finalize_item_ids": [
"T8"
]
},
{
"plan_step_summary": "Step 10: Add cross-bot shareable-summary pull with provenance, recency ordering, and cap.",
"finalize_item_ids": [
"T8",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 11: Extend solo hot context with current-bot partner-share pending state and no partner content exposure.",
"finalize_item_ids": [
"T9"
]
},
{
"plan_step_summary": "Step 12: Add canonical pending partner-sharing prompt slot once.",
"finalize_item_ids": [
"T10"
]
},
{
"plan_step_summary": "Step 13: Wire canonical slot through mediator, generic solo/coach, and Tante Rosi prompt paths.",
"finalize_item_ids": [
"T11"
]
},
{
"plan_step_summary": "Step 14: Extend memory tool schema/write path with visibility and shareable summary validation/persistence.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 15: Keep distillation contract bot-scoped and render partner/cross-bot rows as summaries only.",
"finalize_item_ids": [
"T12",
"T13",
"T14"
]
},
{
"plan_step_summary": "Step 16: Update fake pool and existing fixtures/tests for bots, user_bot_state.partner_share, message bot/topic, and removed users column.",
"finalize_item_ids": [
"T13"
]
},
{
"plan_step_summary": "Step 17: Add focused regression coverage for migration, privacy matrix, cross-bot independence, raw-message isolation, prompt slots, tools, and memory validation.",
"finalize_item_ids": [
"T13",
"T14"
]
},
{
"plan_step_summary": "Execution order and validation order: run stale-reference sweeps, focused pytest commands, full suite, and a throwaway reproduction script before finalizing.",
"finalize_item_ids": [
"T14"
]
},
{
"plan_step_summary": "External rollout: apply migration/deploy and manual smoke test outside the local repo executor.",
"finalize_item_ids": [
"U1",
"U2"
]
}
],
"orphan_tasks": [],
"completeness_notes": "All approved numbered steps are mapped to execution tasks. The final task is intentionally verification-only and includes the required throwaway reproduction script, which must be deleted before completion. External DB migration/deploy and live smoke testing are captured as user actions because they require operator access outside repo editing.",
"coverage_complete": true
},
"baseline_test_failures": [],
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_note": "No baseline test run is part of finalization; executor should run the focused and full test commands in T14 after implementation."
}
code
Debt watch items (do not make these worse):
[DEBT] all-locations: all_locations: staging.py:47 calls build_hot_context without the new allow_cross_topic_peek/allow_cross_topic_status_injection flags. since these default to false, staging replay of the mediator bot will not exercise cross-topic paths, diverging from production behavior where mediator has both flags true. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan’s scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standard unique (transport, address, guild_id, channel_id) constraint on raw columns. postgresql on conflict target lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs like coalesce in the target list do not match a raw-column unique constraint and will raise a syntax or 'no unique or exclusion constraint matching the on conflict specification' error at runtime. the seed script will fail unless either (a) the table is changed to use an expression-based unique index with those exact coalesce expressions, or (b) the seed script is rewritten to query-first/insert-if-missing or uses the plain column names and accepts the null-handling semantics of the constraint. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: phase b cte pair (ins and src) requires identical where/order/limit clauses for cursor correctness. both are written aligned but nothing enforces the invariant during executor edits; drift would silently mis-advance cursor. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5.1 says dyad_id is appended before the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed by current_step: turnstep = "respond" at the next line. placement intent is clear (append at end of optional block), but the line reference may drift after the field is added. minor precision wobble; not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: eval baseline capture (step 2) is technically blocked by infra. the plan's approach (write script in main tree, copy to worktree, run there) assumes python scripts/capture_eval_baseline.py can connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserve set search_path across connection acquisitions, so the script would fail with schema lookup errors. the plan should add an alternative path (port 5432 session-mode override, or explicit schema-qualified queries everywhere, or defer entirely). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the lint script scripts/lint_inserts.py has a directory-not-found error path at lines 305-309 that still exits 0. the plan step 13 says to remove the # todo(s2b) marker at line 308 but does not mention changing the sys.exit(0) at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid --dir argument (or when args.dir resolves to a non-existent path) will silently exit 0. this defeats the ci-blocking intent because a typo in the scan directory would be treated as success instead of failure. the fix is trivial: change sys.exit(0) to sys.exit(1) at line 309 (or remove the error-path todo and update the exit code in the same step). (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 4.5's _row_matches_topic helper falls back to global behavior when (table, id) is not in self.artifact_topics — explicitly for backward compatibility. this is sensible but creates a subtle hazard: a test that forgets to call link_topic for a new artifact sees global decay behavior with no warning, which could mask the very scoping bug the new test in step 12 is meant to catch. the decay scope test does call link_topic for both topics, so it's safe; future authors may not. worth recording but not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: flag-017 (decay handler backward-compat fallback) is downgraded to accepted maintainability debt with an inline warning comment per step 4.5. the warning text explicitly tells future authors to call link_topic. acceptable, but a noisy assertion (e.g. log a warning when topic_id present in sql but row has no link) would catch silent regressions more loudly. not blocking. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 11 sql returns last_updated_at, but settopicstatusoutput field is named updated_at. the executor needs to alias on read (e.g., row['last_updated_at']). minor mapping point, not a blocker. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 18 coach botspec writes tool_allowlist=frozenset({...}) - frozenset({'set_topic_status'}) with {...} as a placeholder. the executor needs to know what set to start from (probably the union of step_allowed_tools). this is under-specified; the executor will likely just use 'all tools currently in tool_dispatch minus set_topic_status', which is fine, but worth pinning. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: botspec.render_system_prompt at app/bots/base.py:63-79 unpacks partner.name and partner.cross_thread_sharing_default positionally before delegating to the renderer. plan step 6 passes partner=none for solo turns and assumption #5 says base.py does not need modification. the **kwargs trick in the solo renderer cannot help — attributeerror fires inside botspec.render_system_prompt before the renderer runs. plan must commit to patching base.py (or route solo turn around botspec.render_system_prompt). (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 6 parameterizes topic_id at agentic.py:753 (event metadata) and 778 (turncontext.primary_topic_id) but omits line 737 where _open_turn(..., topic_id=get_relationship_topic_id(), ...) is hardcoded. without patching line 737, persisted turn rows for coach carry topic_id=relationship — directly trips stop condition solo bot writes to mediator's relationship topic in any test. (flagged 2 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-041): are the proposed changes technically correct?: botspec.render_system_prompt unpacks partner.name positionally before delegating; partner=none still breaks regardless of solo renderer **kwargs. plan is unchanged from prior critique. carrying as accepted debt per guidance. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: recurring debt (debt-042): are the proposed changes technically correct?: step 6 still omits agentic.py:737 (the _open_turn topic_id kwarg). same gap as prior iteration; trips stop condition if not addressed by executor. carrying as accepted debt. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 5's mid-turn refresh refetches user inside the same db transaction (for update held). if the refresh uses fetch_user_by_id rather than dataclasses.replace, it issues a select through the pool while the same connection holds the lock — with asyncpg pools this can deadlock unless the same acquired connection is reused. plan offers both options without specifying which connection the re-fetch uses. dataclasses.replace avoids this entirely; if executor picks fetch_user_by_id, lock contention risk is real. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: step 2.5 says to copy the 8 new fields through the post-resolve user rebuild in fetch_user_by_id l.152-160. with 8 fields plus existing ones, the constructor call grows long and is easy to miss a field. using dataclasses.replace(user, phone=resolved) would be cleaner and forward-compatible — plan instead keeps the verbose pattern. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the scripts/seed_channels.py plan uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration creates a plain unique (transport, address, guild_id, channel_id) constraint. postgresql requires the on conflict target to match a unique constraint or index exactly; an expression-based target without a matching expression index will raise a runtime error. additionally, the raw unique constraint treats nulls as distinct, so it cannot deduplicate whatsapp channels where guild_id and channel_id are null. the executor must either add a matching unique expression index in 0020, or rewrite the seed script to use a pre-insert select check instead of on conflict. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the 0020 migration plan for user_identities omits the verified_at timestamptz column present in architecture doc §12.2 ddl, while claiming 'exactly per §3/§12 ddl'. since account-linking workflows are deferred beyond s1, the column is not functionally load-bearing yet, but the claim of exact ddl match is incorrect. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the resolve_binding sql in app/services/routing.py uses limit 1 without order by. if a user ever has both a solo binding and a dyad binding to the same bot, the returned row is non-deterministic. the schema has no unique constraint preventing multiple bindings per (bot_id, user_id). since s1 only seeds one dyad binding and the module is not wired into inbound yet, this is latent future risk rather than an immediate s1 blocker. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user notes #1/#2 asked to restructure user_actions.md (split t14, move u1 to after execute). the plan addresses the spirit via execution order but does not enumerate user_actions.md content changes. if the harness consumes a separate user_actions.md, it may still reflect pre-revision ordering. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: verified step 8.1 names the scheduler claim query precisely at scheduled_jobs.py:104 (_claim_due_jobs). the plan cites returning lines 124-125 but the actual file has the returning list at lines 126-127 (off by ~2 because the plan was computed against a stale snapshot). executor will still find the right block, but the precise line offset is wrong. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the user note explicitly directs: t2 (eval baseline capture) is blocked by supabase transaction-mode pooler — set search_path doesn't persist across pooled connections — and must be deferred, with sprint proceeding on t6–t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task with phase 0 must run first execution order. plan body and execution order do not reflect the deferral; executor will block on it. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: validation order steps 1 and 11 still reference the eval baseline (tests/fixtures/eval_baseline/ populated; final python -m evals run diff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-run python -m evals run --prompt-version v1; diff against tests/fixtures/eval_baseline/'. if t2 is deferred there is no baseline to diff against; this step needs to be conditioned on baseline availability or removed. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: advisory: lint_inserts.py line 325 still contains the comment '# always exit 0 in s2a (advisory).' which will become stale after step 13 makes the linter blocking. the adjacent line 326 todo(s2b) is removed, but this stale advisory comment is not mentioned in the plan. it is cosmetic and will be obvious to the executor when editing line 327, but it is a minor maintainability drift. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: q1 resolved by stashing tool_schemas.py first (step 21.2) and q4 resolved by numbered 0031 migration with in-sql guard — but the stash-pop-at-end plan introduces a new risk: sprint edits to tool_schemas.py will conflict with the stashed dirty diff on pop. plan should either drop the stashed tool_schemas.py changes outright or note that conflict resolution is the executor's responsibility. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: user note defers t16 (preflight: staging seed + consenting uuid) with explicit instruction to proceed on code-only items 1-8 and treat preflight as pass with todo comments. plan step 9 already gates prod-promotion behind staging verification and falls back to a feedback.md todo — consistent with the deferral. plan does not however explicitly add 'todo comments in coach scaffold code referencing the operator decision' as the user note requests; executor should add a todo marker in app/bots/coach.py per the note. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: recurring debt: did the work fully address: step 11 option b reads enablement from the bots table assuming a row like id='tante_rosi', enabled=true, but migrations/0020_topics_bots_bindings.sql defines bots(id, display_name, created_at) — there is no enabled column. either an extra migration must add the column, or the gate must rely on row existence. plan picks option b as recommended but does neither explicitly. (flagged 1 times across 1 plans)
[DEBT] discord-ingress: exact discord converter/signature edit is not named in the plan. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool with channels, user_identities, bot_bindings, dyads, and dyad_members dicts so the sql patterns in resolve_bot, resolve_sender, and resolve_binding can match against stored rows. however, tests/conftest.py is explicitly listed in the brief as a dirty file that must not be touched. the revised plan says "extend fakepool minimally" twice (step 9 and step 11 assumption) but never specifies how to do so without modifying conftest.py—for example by defining a local routingfakepool(fakepool) subclass inside tests/test_routing.py or by monkeypatching the class in that test module. if the executor follows the plan literally and edits conftest.py, they will violate a locked constraint. if they do not extend fakepool, the routing unit tests cannot be implemented as written. this is a supporting-infrastructure gap. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: step 3 updates scripts/seed_channels.py to import _decode_discord_user_id from the new shared module. the seeder also previously had a regex _discord_bot_user_id_re constant (or similar) inline; if the seeder's local regex remains while the new module redefines it, the two could drift. plan should explicitly say the seeder deletes its local copy. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters but paused_for_user does not currently call logger.* (verified by reading hooks.py). the plan instructs to log extra={user_id, bot_id} — if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: scripts/capture_eval_baseline.py is still listed as a deliverable (step 2.1) and a smoke test (step 2.7 --help invocation). if t2 is deferred, the script could either (a) not be written, or (b) be written but its run deferred. plan should specify which. the smoke test alone (--help) does not require the pooler. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 0 contains both step 1 (parity + identity seeding pre-flight) and step 2 (eval baseline). step 1 is independent of the pooler block — it queries via psql or any working connection — and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: get_relationship_topic_id() is referenced in agentic.py at lines 719, 737, 753, 778. step 6 covers 719/721, 753, 767/778, 793 but not 737. same gap as correctness finding — _open_turn's topic_id kwarg must also be parameterized. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: recurring debt (debt-045): does the change touch all locations: get_relationship_topic_id() at agentic.py:737 still not in step 6's enumeration. same as debt-042. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan does not specify that step 5's coach scaffold should carry a todo comment referencing the deferred t16 preflight (operator-held uuid + staging seed verification) per the new user note. minor scope addition the executor must remember. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan mentions updating app/staging.py:47 'if it calls build_hot_context'. staging.py:47 does call build_hot_context with primary_topic_id=get_relationship_topic_id(). the new allow_cross_topic_peek and allow_cross_topic_status_injection parameters default to false. since staging replay exercises the mediator bot (which has both flags true in its spec), leaving staging.py unchanged means cross-topic peek/status injection is not exercised during staging replay, causing divergence from production behavior. the plan should explicitly state what values to pass. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the plan's step 7d updates _render_with_counts for dyadic rendering but does not explicitly mention updating _render_solo_with_counts in hot_context_solo.py for the solo cross_topic_peek block. since render_hot_context_solo delegates actual text generation to _render_solo_with_counts, the cross_topic_peek block must be added there. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: plan step 8 places the pregnancy block in solo hot context gated on bot_id == 'tante_rosi'. the bot_id is read from where? hot_context_solo.py builders typically take a botspec / topic, not a bare bot_id string. plan doesn't enumerate where the gate condition is plumbed from. minor but executor needs clarity. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: new issue: the 0020 migration ddl defines channels with unique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows with guild_id=null, channel_id=null and the same transport+address would not conflict. however, scripts/seed_channels.py uses on conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, which requires a matching unique index on those coalesce expressions. without it, the seed script will raise 'there is no unique or exclusion constraint matching the on conflict specification'. the ddl should either use unique nulls not distinct (pg15+, and the repo uses pg16 per test_eval_workflow.py:36) or a unique index on the coalesce expressions. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 adds bot_id kwarg to hooks.paused_for_user. callers grep shows it is called from various places; the plan only enumerates messaging.py:170,335 as new bot_id-passing sites. other callers continue to call without bot_id (none default), which is fine, but plan should call out that all existing callers continue to work without modification. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: evals.runner.run_scenarios is referenced by the deferred step 2.1; plan doesn't enumerate that runner's callers or its schema dependencies. since step 2 is being deferred, this is moot — but if the script is still authored as a step 2.1 deliverable, it must not import anything that hits the pooler at import time. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 strips bot_spec defaults from tests/_scope_helpers.py:make_mediator_ctx, which has six call sites across tests/test_s2a_stamping.py (5 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that rely on the implicit default. the executor must update all six call sites to pass bot_spec explicitly. however, plan step 20's stop-condition nuance lists only steps 14–17 as the 'intentional-update list' and omits step 18. if the executor misses a call site and those tests fail, the stop condition text would classify the failure as 'unexpected' and trigger stop, even though the root cause is an incomplete step 18 execution. the stop condition should explicitly include step 18 (or enumerate test_s2a_stamping.py and test_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 5.3 read-gate behavior on error path: returns <outputmodel>(is_error=true, error=err, ...) with 'populate empty lists'. different read tools have different output shapes (some return single objects e.g. get_theme, get_self_model). plan says 'exact empty-output shape is per-tool' — but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: botspec.render_system_prompt has exactly one caller — agentic.py:721. step 6 passes partner=none for solo. the base method unpacks partner.name positionally; partner=none breaks the call regardless of solo renderer signature. the single caller passes a value the method cannot currently handle without a base.py edit. (flagged 2 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the plan updates agentic.py:722-725 (solo path) and 729-732 (dyad path) to pass allow_cross_topic_peek and allow_cross_topic_status_injection flags. however, the staging.py:47 call site is mentioned only as a vague 'if it calls build_hot_context' note. staging replay for mediator should pass allow_cross_topic_peek=true and allow_cross_topic_status_injection=true to mirror production, but the plan does not commit to this. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 10.3's early-return contract is loose ('analogous early-return matching the tool's return contract'). each of edit_message/delete_message/react_to_message returns a distinct outputmodel; the executor needs to construct the right model with action='unsupported' or similar. minor under-specification but the tools' existing 'unsupported' / 'not_found' return shapes provide an obvious template. (flagged 1 times across 1 plans)
[DEBT] inbound-boundary: full scope construction happens after user resolution rather than literally in gateway handlers. (flagged 1 times across 1 plans)
[DEBT] issue-hints-completeness: issue_hints / completeness: user note explicitly defers t2 (eval baseline capture) due to supabase transaction-mode pooler not preserving set search_path. plan still has step 2 in phase 0 as a gating task, with phase 0 listed first in execution order and the final validation order step diffing against the baseline. plan body must be updated to mark step 2 as deferred, downgrade the related success criterion from 'must' to 'should/deferred', and remove the post-stamp diff from the must-do validation list. (flagged 1 times across 1 plans)
[DEBT] scope: scope: the plan adds cross_topic_peek to hotcontextsolo but does not explicitly update the copy constructor inside render_hot_context_solo (hot_context_solo.py:706-723) or the _render_solo_with_counts rendering function. if the dataclass field is added but the copy constructor omits it, peek data is silently lost during solo rendering. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.2 ddl for user_identities includes a verified_at timestamptz column. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a future alter table user_identities add column verified_at is required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc §12.1 ddl for channels includes config jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. like verified_at, this is a small additive column that should be created now to match the locked schema; deferring it requires a later migration. the executor should add the column to the 0020 ddl. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claims populate_mediator_spec_from_db(pool) reads 'db-populated fields' for primary_topic_slug, participants_shape, read_scopes, etc. however, the bots table ddl in the plan only defines id, display_name, and created_at — none of the botspec scope fields have db columns. in practice the function will hardcode mediator defaults (primary_topic_slug='relationship', participants_shape='dyad') and only read display_name from the db row. the plan's wording could mislead the executor into writing a select * from bots expecting columns that do not exist. the implementation should explicitly select only display_name and hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns on bots, so hardcoding is correct for s1, but the plan text should be clarified. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief §16.1 work item 1 explicitly requires 'channel rows for current discord + whatsapp' seeded inside migration 0020. the revised plan instead moves channel seeding to a runtime script scripts/seed_channels.py. while the rationale (env vars differ across environments) is pragmatic, this is a concrete divergence from the locked architecture-doc brief which the plan must consume, not override. if the executor applies only the sql migrations, the channels table will be empty and routing will have no rows to resolve, breaking the mid-sprint checkpoint 'channel rows for current discord + whatsapp' gate. the runtime script must be documented as a mandatory post-migration step, but the brief expected it in the migration itself. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: debt-005/006/007/010: verified_at and channels.config jsonb added to 0020; step 10 clarifies populate_mediator_spec_from_db reads only display_name; channel seeding documented as mandatory post-migration script. debt-010 remains a literal divergence from §16.1 'channels seeded in migration 0020' wording but is now explicitly explained. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 13.2 adds optional bot_id kwarg to hooks.paused_for_user but the function's body still calls system_state.is_paused(_pool) only (global). the added parameter is wired in but not consumed in s2a — essentially a dead parameter until s2b. plan does not explicitly say so; executor may either leave it unused or call user_bot_paused. worth flagging for clarity. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: user note's deferral applies only to t2 (eval baseline). the core s2a deliverable — stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause — is independent of t2 and proceeds. plan does not currently distinguish; deferring t2 requires explicit text saying 'phase 0 step 2 is deferred to s3 pre-flight or end-of-sprint manual capture'. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: eval-baseline-related criteria in the success_criteria list (criterion 13: 'eval baseline captured by writing scripts/capture_eval_baseline.py ...') will be unmeetable if t2 is deferred. plan should downgrade that criterion's priority from 'must' to 'should' or mark deferred. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 18 instructs the executor to grep for bot_spec= to enumerate fixture defaults, but this pattern misses the actual signature default bot_spec: botspec | none = none in tests/_scope_helpers.py:35. there are 7 call sites across tests/test_s2a_stamping.py (6 calls) and tests/test_s2a_artifact_topics_same_stmt.py (1 call) that invoke make_mediator_ctx() without passing bot_spec and rely on that default. because the grep won't surface the signature default, the executor may miss stripping it and updating the call sites, leaving the 'should' criterion partially unmet. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: write_tools.py has direct updates on all six artifact tables. plan defers these to s6 (defensible) but does not note that update-form direct accesses persist by design and the new from-form lint regex will not catch them. worth recording so s6 scope is unambiguous. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: partner_of is also called at inbound.py:130 (_control_recipients for pause/resume) and staging.py:32. plan step 6 only patches the runner. inbound.py:130 catches valueerror with a warning, so solo pause/resume logs a benign warning, but brief stop condition partner_of called for participants_shape==solo in any code path is strictly broader. plan should narrow the stop condition or patch inbound. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: brief locked decision #5 asks to verify resolve_bot returns coach for the coach's transport. migration 0031 explicitly defers channel seeding. plan includes no routing verification step — step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-043): search for related code: partner_of calls at inbound.py:130 and staging.py:32 remain unaddressed by step 6. valueerror catch in inbound makes it benign in practice but the brief stop condition is broader. plan unchanged. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: recurring debt (debt-044): search for related code: resolve_bot routing for coach's transport is still unverified; channel seeding deferred in migration 0031 lines 31-33. plan adds no routing smoke step. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan adds cross_topic_peek to hotcontextsolo and says to update render_hot_context_solo, but render_hot_context_solo (hot_context_solo.py:706-723) constructs an explicit hotcontextsolo(...) copy with field-by-field assignment. if cross_topic_peek is added to the dataclass but not to this copy constructor, the peek data is silently dropped during solo rendering. the plan does not explicitly mention updating the copy constructor inside render_hot_context_solo. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: the plan says 'similarly update render_hot_context_solo in hot_context_solo.py for cross_topic_peek only' but the actual text rendering for solo happens in _render_solo_with_counts (hot_context_solo.py:561), not in render_hot_context_solo (which only handles truncation). the plan does not explicitly mention adding the cross_topic_peek block to _render_solo_with_counts, creating ambiguity about where the solo rendering change belongs. (flagged 1 times across 1 plans)
[DEBT] search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader: search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 2.4 says to grep for select.*from users\|_row_to_user to find other hydration sites. but there are likely selects that go through mediator.users schema-prefixed (per repo conventions) or use from_row/update … returning patterns that the regex would miss. the defensive if col in row fallback in _row_to_user catches missed sites at runtime (returns none) but means renders will silently show no pregnancy state from those code paths. worth surfacing. (flagged 1 times across 1 plans)
[DEBT] tests: old-behavior test file is not explicitly named. (flagged 1 times across 1 plans)
[DEBT] untagged: step 11 (prod-registration via bots table) reads a non-existent enabled column from bots (schema is id, display_name, created_at per 0020_topics_bots_bindings.sql). plan recommends option b but never adds a migration for the column or specifies row-existence as the gate. (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: standard.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T4]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC4]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/Veas/.megaplan/plans/per-bot-partner-sharing-20260514-0024/execution_batch_4.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.