You are already running inside the megaplan harness for this step. Do the requested…
- User
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the
megaplanCLI, do NOT read or activate themegaplanskill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are an independent reviewer. Critique the plan against the actual repository.
codeProject directory: /Users/user_c042661f/Documents/Veas Idea:Sprint 5 — First solo bot (code)
Orchestration
Working dir.
/Users/user_c042661f/Documents/Veason branchs5-solo-bot-code(you create it as last task froms4-auth-status-preflighttip 02f84d4). Do NOT modifydocs/multi-agent-architecture.md— read-only reference.Pre-existing dirty files (still off-limits unless directly needed for the solo bot work):
tests/test_hot_context.py,tests/test_time_context.py,tests/test_tools.py,migrations/0019_feedback_reaction_context.sql. Most other dirty files have been touched in prior sprints and are now normal sprint files.app/services/prompts.py,app/services/hot_context.py,app/services/time_context.pyare fair game.Profile (locked).
--profile thoughtful --depth medium --phase-model finalize=claude:medium. Reason: this is pure code work on a known shape (mirror of mediator's existing code path). Medium depth, medium finalize is enough.Locked decisions (do not relitigate during plan/critique):
- Bot identity:
bot_id = "coach",primary_topic_slug = "career"(matches S4 staging seed in migration 0031). cross_topic_policy = "peek"(matches mediator pattern; §16.6 recommendation).- Solo crisis default: refer to dyadic bot + external resources. No silent failure.
- Onboarding: idempotent first-contact renderer. Use upsert on
user_bot_stateto avoid the simultaneous-first-message race (§16.6 risk). - Routing:
resolve_botalready resolves from channel (S2a wired this). Verify the assumption holds for solo bot's transport but don't redesign. - Prod promotion: prod insertion of coach rows can happen IF S4's staging seed is verified clean. If it's not, defer prod promotion via TODO. Don't block S5 on prod promotion.
- No cross-topic writes from coach. That's S6.
- No second dyadic bot, no account-linking UI. (§16.6 deliberate exclusions.)
Sprint 5 — §16.6 verbatim
Goal. Ship the solo prompt renderer, hot context builder, onboarding renderer, crisis handler, and
BotSpec. Wire to the pre-provisioned transport from S4 and deploy to the consenting target user.Infrastructure already exists in staging from S4. This sprint is pure code work + cutover to prod.
Pre-flight context.
- S4 left coach scaffold in staging via migration 0031_coach_staging_seed.sql (in-SQL guarded). Coach BotSpec exists at
app/bots/coach.pyfrom S4. cross_topic_policyfor the new bot:"peek"(locked).- Read
prompts.py:122-186, 217-222, 335-370for dyad-only sections to skip in solo renderer. - Read
agentic.py:686— the runner callspartner_ofunconditionally before building context. This is the single line that breaks for solo bots; confirm work item 6 covers it.
Work items, ordered.
app/services/prompts_solo.py— solo system prompt renderer. No partner placeholder, no bridges, no in-person redirect, no partner crisis escalation.app/services/hot_context_solo.py— solo hot context builder. Single about-user bucket. Status block for own topic for the bound user. Peek block (still no other topics for this user unless the dyadic mediator also serves them — but for the brief one-user dyad relationship in current prod, peek = empty).app/services/onboarding_solo.py— first-contact renderer per §10.2 of architecture doc. Use upsert on user_bot_state to prevent duplicate onboarding states.app/services/crisis_solo.py— default handler: refer to dyadic bot + external resources. NEVER silent.- Augment
app/bots/coach.py(already exists from S4) — soloBotSpec,participants_shape="solo", primary topic="career", tool registry that excludes bridge tools,create_bridge_candidate, in-person redirect. agentic.py:686runner fix: skippartner_ofresolution whenparticipants_shape == "solo".TurnContext.partner = None. Hot context dispatch picks the solo builder.- Tool registry: filter dyadic-only tools at registration time per
participants_shape. §5.2 enforcement — solo bot literally doesn't see the tools. - Solo participant-shape validation in write tools: reject
about_user_id != bound_user_id, rejectabout_user_id IS NULL. - Prod-promotion migration (optional, gated): if S4's staging seed verified clean, write
migrations/0032_coach_prod_seed.sqlfor production rows. SAFETY: same in-SQL guard pattern as 0031 — only run if database name matches prod. If staging seed unverified, write TODO in feedback.md and skip. - End-to-end test (
tests/test_coach_e2e.py): solo bot turn against test user produces response, writes a memory, writes status, attempts a bridge tool call and FAILS at the boundary. - (DEFER — out of automated-sprint scope) Deploy to the consenting user. Monitor closely for ≥3 days. — Brief: do not auto-deploy. Leave a
MONITOR.mddoc atdocs/coach-monitor.mddescribing the monitoring plan.
Dependencies: (1–4) parallel; (5) gates (6); (7–8) gate (10, 11).
Definition of done.
- Solo bot turn shape works end-to-end in test (work item 10).
- Mediator unaffected: existing tests on s4 still pass.
- Per-(user, bot) pause works (S4 already delivered the write path).
- Onboarding flow renders on first contact (work item 3).
- NOT included: 3-day production soak; that's monitored offline.
S1-S4 lessons the executor must honor
- CLI scripts: invoke with
--helpto confirm parseable. - SQL fragments in Python strings: dry-run via
EXPLAINor sanity-check types. - asyncpg pool against
DATABASE_URL: passstatement_cache_size=0for Supabase port 6543. - No
hash()for deterministic IDs — usehashlib.sha1. - Schema filters in validation queries use
'mediator'not'public'. - No defensive fallbacks (per S3): don't add permissive filters.
- Read tools go through
topic_filter.join_artifact_topics(S3 commit 52d6dab). New solo hot_context must follow the pattern. - Scope guard runs on every read/write (S4 commit 02f84d4). Solo write tools must use it.
- NEW S4 LESSON: Review state-machine gotcha — if reviewer produces partial task verdicts but verdict="approved", state may not transition past
executed. Pre-emptive force-proceed after first approval signal is acceptable. - Pytest baseline: 563 pass / 0 fail / 5 skip on s4-auth-status-preflight HEAD. S5 must maintain or improve.
Stop conditions
-
Any test that was passing on
s4-auth-status-preflightHEAD (commit 02f84d4) starts failing — STOP, report. -
Solo bot writes to mediator's
relationshiptopic in any test — scope guard failure, STOP. -
Bridge tool registered for coach (should be filtered out at registration) — STOP.
-
partner_ofcalled forparticipants_shape == "solo"in any code path — STOP. -
Migration 0032 runs against prod without the in-SQL guard — STOP, revert.
codePlan: # Implementation Plan: Sprint 5 — First Solo Bot (Coach)
Overview
Sprint 5 ships the coach solo bot end-to-end in code on
s5-solo-bot-code(branched froms4-auth-status-preflighttip02f84d4). All infrastructure (BotSpec stub atapp/bots/coach.py, staging seed migration0031_coach_staging_seed.sql, routing viaresolve_bot, scope guards) already exists from S4. This sprint adds the four solo-specific renderers (system prompt, hot context, onboarding, crisis), fixes the single unconditionalpartner_ofcall in the runner (agentic.py:718), filters bridge tools out of the coach tool allowlist, enforces solo participant-shape in write tools, and proves it with an e2e test.Locked decisions (from brief, do not relitigate): bot_id=
coach, primary_topic=career,cross_topic_policy="peek", crisis default = refer to dyadic bot + external resources, onboarding via idempotent upsert onuser_bot_state, prod-promotion gated on S4 staging seed verification, no cross-topic writes (S6), no second solo bot, no account-linking UI.Key existing code shape:
BotSpecatapp/bots/base.py:43already supportsparticipants_shape,tool_allowlist,read_scopes,write_scopes,cross_topic_policy.- Coach spec at
app/bots/coach.pyis the S4 stub with_coach_prompt_rendererraisingNotImplementedError. agentic._run_agentic(app/services/agentic.py:696) unconditionally callspartner_ofat line 718 and passespartnerintobuild_hot_context,render_system_prompt, andTurnContext.- Tool allowlist is enforced at
app/services/tools/registry.py:281(_step_allowed) via intersection withbot_spec.tool_allowlist. - S4 already excluded
set_topic_statusfrom coach's allowlist; S5 must also exclude bridge tools. BotSpec.render_system_promptatapp/bots/base.py:63acceptspartner: User(positional). Solo path must toleratepartner=None.
Phase 1 — Pure Solo Renderers (parallel)
Step 1: Solo system prompt renderer (
app/services/prompts_solo.py)Scope: Medium
- Create
app/services/prompts_solo.pyexportingrender_solo_system_prompt(assistant_name, user_name, *, prompt_version, onboarding_state, sharing_default, topic_display_name)and constantsSOLO_SYSTEM_PROMPT_VERSION = "v1",SOLO_SYSTEM_PROMPT_V1,SOLO_FIRST_CONTACT_V1. - Author a new system prompt template that:
- Names the assistant as a solo
{topic_display_name}(e.g. "career") reflection coach for{user_name}— no partner placeholder. - Omits the dyad-only sections present in
prompts.py:122–186, 217–222, 335–370:# Cross-Thread Sharing Defaults/# Surfacing The Partner's Perspective/# Bridge Candidates# In-Person Redirection(no partner to redirect to)- Dyadic crisis escalation language about
escalate_to_partner/ "alert partner" gates.
- Keeps Role/Identity (rewritten solo), Operating Principles, Relational Voice (light edit — drop "shift empathy between them"), Frameworks (drop NVC translation framing), Six Knowledge Primitives (single about-user bucket), Two-Phase Turn Shape, OOB Rules (own-user only), Tool Usage Philosophy (drop
escalate_to_partner/ bridge bullets), Scheduling Judgment, Multi-Message Handling, Voice Notes, Conversation Closure, Solo Crisis Handling (see Step 4), Output Style.
- Names the assistant as a solo
- Include the first-contact placeholder
{first_contact_section}and inline it fromSOLO_FIRST_CONTACT_V1whenonboarding_state == "pending"— mirror the registry pattern inprompts.py:380. - Do not add
{partner_a_name}/{partner_b_name}/{cross_thread_section}/{partner_perspective_section}placeholders.
Step 2: Solo hot context builder (
app/services/hot_context_solo.py)Scope: Medium
- Create
app/services/hot_context_solo.pyexportingasync def build_hot_context_solo(pool, user, triggering_message_ids, trigger_metadata=None, *, primary_topic_id, bot_id)anddef render_hot_context_solo(hc) -> str. Reuse the existingHotContextdataclass fromhot_context.pywithpartner_user={}(empty dict — renderer must tolerate empty partner block). - Reuse existing helpers from
hot_context.pyfor: temporal context, conversation_load (filter bysender_id = user.id OR recipient_id = user.id), memories/observations/themes/watch_items/distillations scoped to the user-only and totopic_id = primary_topic_idviatopic_filter.join_artifact_topics(S3 commit52d6dabpattern, per lesson #7). - Single about-user bucket: all primitives filter on
about_user_id = user.id(no partner-perspective lookups). Status block from_fetch_topic_statusfor(primary_topic, user.id, dyad_id=None). - Peek block: per locked decision and §16.6, peek = empty for solo coach against the brief one-user dyad. Render an explicit empty section so the absence is auditable.
- Omit: bridge candidates list, partner OOB, partner sharing-default branches, partner perspective text, "soft_nudge"/
opt_outblocks. - No defensive fallbacks per S3 lesson #6: if
primary_topic_idis None, raise; do not silently swap to relationship topic.
Step 3: Solo onboarding renderer (
app/services/onboarding_solo.py)Scope: Small
- Create
app/services/onboarding_solo.pyexportingasync def ensure_onboarding_state(pool, *, user_id, bot_id) -> stranddef render_first_contact(topic_display_name) -> str. - Idempotent upsert to defeat the simultaneous-first-message race:
Return the resultingsql
INSERT INTO user_bot_state (user_id, bot_id, onboarding_state, updated_at) VALUES ($1, $2, 'pending', now()) ON CONFLICT (user_id, bot_id) DO UPDATE SET updated_at = user_bot_state.updated_at RETURNING onboarding_stateonboarding_state. (Verifyuser_bot_statehas columnsonboarding_stateand a(user_id, bot_id)unique constraint — if not present, this becomes a migration task; flag in questions.) - No silent failure: raise on upsert error; do not catch.
Step 4: Solo crisis handler text (
app/services/crisis_solo.py)Scope: Small
- Create
app/services/crisis_solo.pyexportingSOLO_CRISIS_SECTION_V1: strconsumed by Step 1's template. - Content: drop coach role entirely on crisis charge; surface region-appropriate external resources (988, Samaritans, local equivalents — judgment-based, not a fixed list); explicitly refer to the dyadic mediator bot by name for relationship-domain crisis; NEVER silent on crisis charge (justify silence requirement carries over from main prompt). No
escalate_to_partnergate text — that tool is unavailable to coach.
Phase 2 — Runner & Tool Boundary
Step 5: Augment coach BotSpec (
app/bots/coach.py)Scope: Small (gates Step 6)
- Replace
_coach_prompt_rendererstub with a real renderer that callsrender_solo_system_prompt. Signature must match whatBotSpec.render_system_promptcalls (seebase.py:63–79). Since the base acceptspartnerand passespartner.name, also patchBotSpec.render_system_promptto skip partner-name passing whenparticipants_shape == "solo"— or have the solo renderer accept and ignore the partner kwarg. Prefer the latter for minimal surface change: accept*args, **kwargsand pull only what's needed. - Set
cross_topic_policy="peek"(currentlyNone). - Tighten
tool_allowlist: start fromfrozenset(TOOL_DISPATCH)and subtract{"set_topic_status", "create_bridge_candidate", "update_bridge_candidate", "send_bridge_candidate", "list_bridge_candidates", "escalate_to_partner"}. These are the dyadic-only tools per §5.2. - Bump
bot_spec_version = "1.2.0".
Step 6: Runner partner-skip + dispatch (
app/services/agentic.py:718)Scope: Medium
- Branch on
bot_spec.participants_shapeat line 718:pythonif bot_spec.participants_shape == "solo": partner = None hot_context = await build_hot_context_solo( active_pool, user, triggering_message_ids, trigger_metadata, primary_topic_id=primary_topic_id_for(bot_spec), bot_id=bot_spec.bot_id) rendered_hot_context = render_hot_context_solo(hot_context) else: partner = await partner_of(active_pool, user) hot_context = await build_hot_context(...) rendered_hot_context = render_hot_context(hot_context) primary_topic_id_for(bot_spec): resolve via a lookup inapp/bots/registry.pykeyed onbot_spec.primary_topic_slug. For mediator, returnsget_relationship_topic_id(); for coach, fetch thecareertopic id (cache on first lookup). Avoidhash()for ids per lesson #4.render_system_promptcall (line 721): passpartner=partneras before; the solo renderer ignores it via**kwargs. No further change.TurnContextconstruction (line 767):partnerfield becomesUser | None; already declared atturn_context.py:21.protected_owner_ids(line 793) must droppartner.idwhenpartner is None— use[user.id].- Open turn event metadata (line 753):
topic_iduses the resolved primary topic id, not hard-codedget_relationship_topic_id().
Step 7: Tool registration filter (already wired)
Scope: Small (verification only)
- Verify
registry._step_allowedat line 281 already intersects withbot_spec.tool_allowlist. No code change required; Step 5's allowlist tightening makes bridge tools andescalate_to_partnerunreachable for coach. - Add test in Step 10 that asserts
"create_bridge_candidate" not in to_anthropic_tools(_step_allowed(coach_ctx))for every step.
Step 8: Solo participant-shape validation in write tools
Scope: Medium
- Locate write tools that accept
about_user_id(grepabout_user_idinapp/services/tools/write_tools.py): memory/observation/distillation/theme/watch_item adders. - Add a shared validator (call it
_assert_solo_about_user(ctx, about_user_id)): whenctx.participants_shape == "solo", rejectabout_user_id != ctx.user.idand rejectabout_user_id is None. Return tool-error dict ({"error": ..., "is_error": True}) — same shape as_tool_errorinregistry.py:306. - Wire into each affected tool BEFORE the scope guard (the scope guard at S4 commit
02f84d4already runs per lesson #8; this is the solo-shape pre-check).
Phase 3 — Migrations, Tests, Monitor
Step 9: Prod promotion migration (conditional) (
migrations/0032_coach_prod_seed.sql)Scope: Small, gated
- Verify S4 staging seed is clean: run a sanity check against staging (
SELECT * FROM bots WHERE id='coach'; SELECT * FROM topics WHERE slug='career';). If clean and the executor has prod-readable credentials available, proceed; otherwise write a TODO infeedback.mdand skip the migration entirely (per locked decision #6). - If proceeding: create
migrations/0032_coach_prod_seed.sqlmirroring 0031's in-SQL guard pattern, withIF current_database() NOT LIKE '%prod%' THEN RAISE NOTICE ...; RETURN; END IF;. Insertbots('coach', 'Coach'),topics('career', ...), and thebot_bindingfor the consenting prod user (id sourced from S4 prep — confirm in questions). - STOP condition: if migration would run against prod without the guard, revert immediately (per brief stop conditions).
Step 10: End-to-end test (
tests/test_coach_e2e.py)Scope: Medium
- Create
tests/test_coach_e2e.pywith one main test:- Seed an isolated test user + the coach bot + career topic (use existing test fixtures; check
tests/conftest.pyfor the pattern). - Stub the LLM client to return a deterministic plan: read → respond → record → done.
- Drive a single inbound message through
_run_agenticwithbot_id="coach". - Assert:
- A user-facing message was sent.
partner_ofwas NOT called (patch and assertnot_called).- At least one
add_memorywrite landed scoped totopic_id = career_topic_idandabout_user_id = user.id. topic_statuswrite happened (or skipped per allowlist — confirm with the test).- A stubbed
create_bridge_candidateinvocation by the model results intool.rejectedwith reasonstep_not_allowed(orunknown_tool); the assertion is that the tool call fails at the boundary, not that the model abstains.
- Seed an isolated test user + the coach bot + career topic (use existing test fixtures; check
- Idempotent onboarding test: call
ensure_onboarding_statetwice concurrently viaasyncio.gather; assert exactly one row and no exception.
Step 11: Monitor doc (
docs/coach-monitor.md)Scope: Small
- Create
docs/coach-monitor.mddescribing the 3-day soak plan: what dashboards/logs to watch, whichturn_eventtypes matter (tool.rejected,turn.openedwithbot_id=coach, scope-guard violations), rollback procedure (revert0032if it landed, comment coach out of BOT_SPECS). - DO NOT auto-deploy. Brief is explicit: monitoring is offline. This file is the only artifact for work item 11.
Execution Order
- Phase 1 Steps 1–4 in parallel — pure code, no dependencies between them.
- Step 5 (coach BotSpec) — depends on Steps 1–4 being importable.
- Step 6 (runner fix) — depends on Step 5.
- Steps 7–8 (tool filter verify + solo validation) — Step 7 is verification, Step 8 is independent of Step 6 but blocks Step 10.
- Step 9 (prod migration) — gated on staging verification; can run in parallel with Step 10.
- Step 10 (e2e test) — blocks done.
- Step 11 (monitor doc) — last, independent.
Validation Order
- Cheap first:
python -c "from app.services.prompts_solo import render_solo_system_prompt; print(render_solo_system_prompt('Coach','Test', prompt_version='v1', onboarding_state='pending', sharing_default=None, topic_display_name='Career')[:200])"to confirm import shape. - Targeted:
pytest tests/test_coach_e2e.py -xvs. - Coach allowlist assertion:
pytest tests/ -k "coach and allowlist" -xvs. - Mediator regression:
pytest tests/ -x— baseline is 563 pass / 0 fail / 5 skip on s4 HEAD (lesson #10). Must maintain. partner_ofaudit:grep -rn "partner_of\(" app/— every call site must be either inside aparticipants_shape == "dyad"branch or unreachable from solo.- Migration dry-run (if Step 9 lands):
psql -f migrations/0032_coach_prod_seed.sqlagainst a non-prod DB — must RAISE NOTICE and no-op.
Stop Conditions (from brief, restated)
-
Any test passing on s4 HEAD (
02f84d4) fails → STOP, report. -
Solo bot writes to mediator's
relationshiptopic → scope-guard failure, STOP. -
Bridge tool reachable from coach → STOP.
-
partner_ofcalled whenparticipants_shape == "solo"→ STOP. -
Migration 0032 runs against prod without guard → STOP, revert.
codePlan metadata: {"version": 1, "timestamp": "2026-05-12T05:08:12Z", "hash": "sha256:312b968631b876ac1a669949af6e2a0fc47e364d5bd1349674f7c5b80a50f5bc", "questions": [ "Does the
user_bot_statetable already have anonboarding_statecolumn and aUNIQUE(user_id, bot_id)constraint? If not, Step 3 needs a small precursor migration (likely0032_user_bot_state_onboarding.sql) before the prod-seed migration0033_coach_prod_seed.sql. The S4 system_state.py snippet only readspaused\u2014 the onboarding column may not yet exist.", "For Step 9 (prod promotion), is the target consenting user's UUID already known and recorded somewhere (e.g. a.envvalue, a fixture, or S4 notes)? If not, the migration cannot insert thebot_bindingrow and we should defer prod promotion to a follow-up.", "Shouldrender_system_promptonBotSpec(app/bots/base.py:63) be updated to handlepartner: User | None, or should the solo prompt renderer accept**kwargsand discard the partner argument? The latter is a smaller diff but slightly less honest about the contract. Default assumption in plan: solo renderer accepts and ignorespartnervia**kwargs.", "Is there an existing helper to resolveprimary_topic_idfrombot_spec.primary_topic_slug, or should Step 6 introduce a new lookup function inapp/bots/registry.py? The plan assumes the latter." ], "success_criteria": [ { "criterion": "app/services/prompts_solo.py,app/services/hot_context_solo.py,app/services/onboarding_solo.py, andapp/services/crisis_solo.pyall exist and are importable from a fresh Python session", "priority": "must", "requires": [ "run_shell", "read_files" ] }, { "criterion": "Coach BotSpec atapp/bots/coach.pyhascross_topic_policy=\"peek\",participants_shape=\"solo\", and atool_allowlistthat excludescreate_bridge_candidate,update_bridge_candidate,send_bridge_candidate,list_bridge_candidates,escalate_to_partner, andset_topic_status", "priority": "must", "requires": [ "read_files", "run_tests" ] }, { "criterion": "agentic.pyrunner skipspartner_ofwhenbot_spec.participants_shape == \"solo\"\u2014 verified by a unit test that patchespartner_ofand asserts not-called for a coach turn", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "tests/test_coach_e2e.pypasses: drives one inbound through_run_agenticwithbot_id=\"coach\", asserts a memory write scoped totopic_id=careerandabout_user_id=user.id, and asserts a model-issuedcreate_bridge_candidatecall is rejected at the registry boundary", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Idempotent-onboarding test: two concurrentensure_onboarding_statecalls produce exactly oneuser_bot_staterow and no exception", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Solo write-tool validation: a write tool called withabout_user_id != ctx.user.idorabout_user_id is Nonewhenparticipants_shape==\"solo\"returns anis_errorresult and writes nothing", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Full test suite passes at or above the s4 HEAD baseline (563 pass / 0 fail / 5 skip)", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "No code path callspartner_offorparticipants_shape==\"solo\"\u2014 confirmed by grep audit ofapp/", "priority": "must", "requires": [ "run_shell", "read_files" ] }, { "criterion": "Ifmigrations/0032_coach_prod_seed.sqlexists, it carries the samecurrent_database() NOT LIKE '%prod%' THEN RETURNin-SQL guard pattern as 0031", "priority": "must", "requires": [ "read_files" ] }, { "criterion": "docs/coach-monitor.mdexists and describes the 3-day soak plan and rollback steps", "priority": "must", "requires": [ "read_files" ] }, { "criterion": "Solo system prompt omits bridge, in-person-redirection, partner-perspective, and cross-thread-sharing sections (verifiable by string-absence assertions in a unit test)", "priority": "should", "requires": [ "run_tests" ] }, { "criterion": "Solo hot context renderer omits partner OOB, partner sharing-default, and bridge candidates blocks", "priority": "should", "requires": [ "run_tests" ] }, { "criterion": "Solo crisis section explicitly references the dyadic mediator bot and external resources, and never permits silence on crisis charge", "priority": "should", "requires": [ "read_files", "subjective_judgment" ] }, { "criterion": "3-day production soak completed cleanly with no scope-guard violations or bridge-tool rejections from coach", "priority": "info", "requires": [ "observe_runtime_logs" ] }, { "criterion": "Consenting target user reports the coach bot is usable in production", "priority": "info", "requires": [ "subjective_judgment" ] } ], "assumptions": [ "Branchs5-solo-bot-codealready exists and is checked out at the working directory tip (confirmed: branch is current, on commit 02f84d4-derived state).", "user_bot_statealready has columns(user_id, bot_id, paused, onboarding_state, updated_at)and aUNIQUE(user_id, bot_id)constraint \u2014 flagged as a question; if absent, a precursor migration is needed before Step 3 can be deployed.", "The S4 staging seed migration 0031 has been applied to staging and abots('coach')+topics('career')row exist there; prod-promotion is otherwise deferred via TODO.", "Per locked decision #5,resolve_botalready returns'coach'for the coach's transport channel and the inbound path passes that into_run_agentic. No routing redesign attempted.", "The solo renderer accepts a partner kwarg and ignores it, soBotSpec.render_system_promptinbase.py:63does not need to be modified \u2014 minimizes blast radius.", "primary_topic_id_for(bot_spec)introduced inapp/bots/registry.pyis acceptable; it caches a slug\u2192UUID lookup on first hit.", "Solo crisis copy is authored by the executor at draft time and reviewed for content; subjective and not auto-verifiable.", "The test stub for the LLM client follows the existing pattern intests/test_agentic*.py(not opened during planning, but assumed to exist based on a 563-test baseline).", "statement_cache_size=0for asyncpg against Supabase port 6543 is already handled in test fixtures; no new pool code introduced here.", "Bridge tools andescalate_to_partnerare the complete set of dyadic-only tools to exclude.set_topic_statusis already excluded by S4. No other tool needs filtering for solo shape." ], "structure_warnings": [] }codePlan structure warnings from validator: [] Existing flags: [] Known accepted debt grouped by subsystem: {"are-the-proposed-changes-technically-correct": [ { "id": "DEBT-002", "concern": "are the proposed changes technically correct?: the plan\u2019s
scripts/seed_channels.pyuseson conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standardunique (transport, address, guild_id, channel_id)constraint on raw columns. postgresqlon conflicttarget lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs likecoalescein 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-011", "concern": "are the proposed changes technically correct?: phase b cte pair (insandsrc) 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-019", "concern": "are the proposed changes technically correct?: step 5.1 saysdyad_idis appendedbefore the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed bycurrent_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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-026", "concern": "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) assumespython scripts/capture_eval_baseline.pycan connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserveset search_pathacross 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).", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-031", "concern": "are the proposed changes technically correct?: the lint scriptscripts/lint_inserts.pyhas 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 thesys.exit(0)at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid--dirargument (or whenargs.dirresolves 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: changesys.exit(0)tosys.exit(1)at line 309 (or remove the error-path todo and update the exit code in the same step).", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-034", "concern": "are the proposed changes technically correct?: step 4.5's_row_matches_topichelper falls back to global behavior when (table, id) is not in self.artifact_topics \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-036", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-037", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-038", "concern": "are the proposed changes technically correct?: step 18 coach botspec writestool_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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ], "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [ { "id": "DEBT-001", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-004", "concern": "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 \u00a712.2 ddl, while claiming 'exactly per \u00a73/\u00a712 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-009", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-013", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-018", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-020", "concern": "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 \u2014 set search_path doesn't persist across pooled connections \u2014 and must be deferred, with sprint proceeding on t6\u2013t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task withphase 0 must run firstexecution order. plan body and execution order do not reflect the deferral; executor will block on it.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-021", "concern": "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; finalpython -m evals rundiff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-022", "concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-runpython -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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-030", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-039", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ], "does-the-change-touch-all-locations-and-supporting-infrastructure": [ { "id": "DEBT-008", "concern": "does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool withchannels,user_identities,bot_bindings,dyads, anddyad_membersdicts so the sql patterns inresolve_bot,resolve_sender, andresolve_bindingcan match against stored rows. however,tests/conftest.pyis 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 modifyingconftest.py\u2014for example by defining a localroutingfakepool(fakepool)subclass insidetests/test_routing.pyor by monkeypatching the class in that test module. if the executor follows the plan literally and editsconftest.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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-015", "concern": "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_reconstant (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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-016", "concern": "does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters butpaused_for_userdoes not currently calllogger.*(verified by reading hooks.py). the plan instructs to logextra={user_id, bot_id}\u2014 if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-023", "concern": "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--helpinvocation). 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-024", "concern": "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 \u2014 it queries viapsqlor any working connection \u2014 and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] } ], "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them": [ { "id": "DEBT-003", "concern": "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 defineschannelswithunique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows withguild_id=null, channel_id=nulland the same transport+address would not conflict. however,scripts/seed_channels.pyuseson 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 useunique nulls not distinct(pg15+, and the repo uses pg16 pertest_eval_workflow.py:36) or a unique index on the coalesce expressions.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-017", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 addsbot_idkwarg 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-025", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-033", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 stripsbot_specdefaults fromtests/_scope_helpers.py:make_mediator_ctx, which has six call sites acrosstests/test_s2a_stamping.py(5 calls) andtests/test_s2a_artifact_topics_same_stmt.py(1 call) that rely on the implicit default. the executor must update all six call sites to passbot_specexplicitly. however, plan step 20's stop-condition nuance lists only steps 14\u201317 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 enumeratetest_s2a_stamping.pyandtest_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-040", "concern": "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' \u2014 but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ], "issue-hints-completeness": [ { "id": "DEBT-027", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] } ], "search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader": [ { "id": "DEBT-005", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.2 ddl foruser_identitiesincludes averified_at timestamptzcolumn. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a futurealter table user_identities add column verified_atis required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-006", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.1 ddl forchannelsincludesconfig jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. likeverified_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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-007", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claimspopulate_mediator_spec_from_db(pool)reads 'db-populated fields' forprimary_topic_slug,participants_shape,read_scopes, etc. however, thebotstable ddl in the plan only definesid,display_name, andcreated_at\u2014 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 readdisplay_namefrom the db row. the plan's wording could mislead the executor into writing aselect * from botsexpecting columns that do not exist. the implementation should explicitly select onlydisplay_nameand hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns onbots, so hardcoding is correct for s1, but the plan text should be clarified.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-010", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief \u00a716.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 scriptscripts/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, thechannelstable 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-012", "concern": "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 \u00a716.1 'channels seeded in migration 0020' wording but is now explicitly explained.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-014", "concern": "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 callssystem_state.is_paused(_pool)only (global). the added parameter is wired in but not consumed in s2a \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-028", "concern": "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 \u2014 stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause \u2014 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'.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-029", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-032", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-035", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] } ] }codeEscalated debt subsystems: [{ "subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements", "total_occurrences": 10, "plan_count": 4, "entries": [ { "id": "DEBT-001", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-004", "concern": "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 \u00a712.2 ddl, while claiming 'exactly per \u00a73/\u00a712 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-009", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-013", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-018", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-020", "concern": "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 \u2014 set search_path doesn't persist across pooled connections \u2014 and must be deferred, with sprint proceeding on t6\u2013t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task withphase 0 must run firstexecution order. plan body and execution order do not reflect the deferral; executor will block on it.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-021", "concern": "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; finalpython -m evals rundiff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-022", "concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-runpython -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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-030", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-039", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ] }, { "subsystem": "search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader", "total_occurrences": 10, "plan_count": 4, "entries": [ { "id": "DEBT-005", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.2 ddl foruser_identitiesincludes averified_at timestamptzcolumn. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a futurealter table user_identities add column verified_atis required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-006", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.1 ddl forchannelsincludesconfig jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. likeverified_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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-007", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claimspopulate_mediator_spec_from_db(pool)reads 'db-populated fields' forprimary_topic_slug,participants_shape,read_scopes, etc. however, thebotstable ddl in the plan only definesid,display_name, andcreated_at\u2014 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 readdisplay_namefrom the db row. the plan's wording could mislead the executor into writing aselect * from botsexpecting columns that do not exist. the implementation should explicitly select onlydisplay_nameand hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns onbots, so hardcoding is correct for s1, but the plan text should be clarified.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-010", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief \u00a716.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 scriptscripts/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, thechannelstable 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-012", "concern": "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 \u00a716.1 'channels seeded in migration 0020' wording but is now explicitly explained.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-014", "concern": "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 callssystem_state.is_paused(_pool)only (global). the added parameter is wired in but not consumed in s2a \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-028", "concern": "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 \u2014 stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause \u2014 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'.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-029", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-032", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-035", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] } ] }, { "subsystem": "are-the-proposed-changes-technically-correct", "total_occurrences": 9, "plan_count": 5, "entries": [ { "id": "DEBT-002", "concern": "are the proposed changes technically correct?: the plan\u2019sscripts/seed_channels.pyuseson conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standardunique (transport, address, guild_id, channel_id)constraint on raw columns. postgresqlon conflicttarget lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs likecoalescein 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-011", "concern": "are the proposed changes technically correct?: phase b cte pair (insandsrc) 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-019", "concern": "are the proposed changes technically correct?: step 5.1 saysdyad_idis appendedbefore the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed bycurrent_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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-026", "concern": "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) assumespython scripts/capture_eval_baseline.pycan connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserveset search_pathacross 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).", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-031", "concern": "are the proposed changes technically correct?: the lint scriptscripts/lint_inserts.pyhas 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 thesys.exit(0)at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid--dirargument (or whenargs.dirresolves 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: changesys.exit(0)tosys.exit(1)at line 309 (or remove the error-path todo and update the exit code in the same step).", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-034", "concern": "are the proposed changes technically correct?: step 4.5's_row_matches_topichelper falls back to global behavior when (table, id) is not in self.artifact_topics \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-036", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-037", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-038", "concern": "are the proposed changes technically correct?: step 18 coach botspec writestool_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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ] }, { "subsystem": "does-the-change-touch-all-locations-and-supporting-infrastructure", "total_occurrences": 5, "plan_count": 2, "entries": [ { "id": "DEBT-008", "concern": "does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool withchannels,user_identities,bot_bindings,dyads, anddyad_membersdicts so the sql patterns inresolve_bot,resolve_sender, andresolve_bindingcan match against stored rows. however,tests/conftest.pyis 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 modifyingconftest.py\u2014for example by defining a localroutingfakepool(fakepool)subclass insidetests/test_routing.pyor by monkeypatching the class in that test module. if the executor follows the plan literally and editsconftest.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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-015", "concern": "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_reconstant (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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-016", "concern": "does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters butpaused_for_userdoes not currently calllogger.*(verified by reading hooks.py). the plan instructs to logextra={user_id, bot_id}\u2014 if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-023", "concern": "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--helpinvocation). 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-024", "concern": "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 \u2014 it queries viapsqlor any working connection \u2014 and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] } ] }, { "subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them", "total_occurrences": 5, "plan_count": 4, "entries": [ { "id": "DEBT-003", "concern": "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 defineschannelswithunique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows withguild_id=null, channel_id=nulland the same transport+address would not conflict. however,scripts/seed_channels.pyuseson 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 useunique nulls not distinct(pg15+, and the repo uses pg16 pertest_eval_workflow.py:36) or a unique index on the coalesce expressions.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-017", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 addsbot_idkwarg 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-025", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-033", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 stripsbot_specdefaults fromtests/_scope_helpers.py:make_mediator_ctx, which has six call sites acrosstests/test_s2a_stamping.py(5 calls) andtests/test_s2a_artifact_topics_same_stmt.py(1 call) that rely on the implicit default. the executor must update all six call sites to passbot_specexplicitly. however, plan step 20's stop-condition nuance lists only steps 14\u201317 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 enumeratetest_s2a_stamping.pyandtest_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-040", "concern": "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' \u2014 but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ] } ]codeDebt guidance: - These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them. - Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`. - When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`. Your output template is at: /Users/user_c042661f/Documents/Veas/.megaplan/plans/sprint-5-solo-bot/critique_output.json
Read this file first — it contains 5 checks, each with a question and guidance. For each check, investigate the codebase, then add your findings to the
findingsarray for that check.Each finding needs:
- "detail": what you specifically checked and what you found (at least a full sentence)
- "flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
- Every check must end with at least one finding. Never leave a
findingsarray empty. If you found no issue, add one detailedflagged: falsefinding explaining what you checked and why it appears clear.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false} Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true} Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the
flagsarray (e.g., security, performance, dependencies). Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
codeAdditional guidelines: - Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate. - Over-engineering: prefer the simplest approach that fully solves the problem. - Reuse existing flag IDs when the same concern is still open. - `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess. - Verify that the plan follows the expected structure when validator warnings or the outline suggest drift. - Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other. - Focus on concrete issues, not structural formatting. - Bot identity:
Assistant
Critique submitted via StructuredOutput. Key flags:
- FLAG-001 (significant):
BotSpec.render_system_promptat base.py:71-79 unpackspartner.namepositionally before the renderer runs — plan assumption #5 (no base.py change needed) is wrong;partner=Nonewill AttributeError regardless of**kwargsin the solo renderer. - FLAG-002 (significant): Plan Step 6 misses
agentic.py:737where_open_turn(..., topic_id=get_relationship_topic_id())is also hardcoded — leaving it unpatched persists wrong topic_id on coach turn rows and trips a stop condition. - FLAG-003 (minor):
partner_ofalso called atinbound.py:130andstaging.py:32; strict reading of the stop condition flags these too. - FLAG-004 (minor): No routing/
resolve_botverification for coach's transport; channel seeding deferred in 0031.
Note: I was unable to write
critique_output.jsonto disk — both Write and Bash heredoc were rejected despite the contract claim of auto-approved writes. The findings are delivered via the StructuredOutput tool only.- FLAG-001 (significant):
- User
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the
megaplanCLI, do NOT read or activate themegaplanskill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are an independent reviewer. Critique the plan against the actual repository.
codeProject directory: /Users/user_c042661f/Documents/Veas Idea:Sprint 5 — First solo bot (code)
Orchestration
Working dir.
/Users/user_c042661f/Documents/Veason branchs5-solo-bot-code(you create it as last task froms4-auth-status-preflighttip 02f84d4). Do NOT modifydocs/multi-agent-architecture.md— read-only reference.Pre-existing dirty files (still off-limits unless directly needed for the solo bot work):
tests/test_hot_context.py,tests/test_time_context.py,tests/test_tools.py,migrations/0019_feedback_reaction_context.sql. Most other dirty files have been touched in prior sprints and are now normal sprint files.app/services/prompts.py,app/services/hot_context.py,app/services/time_context.pyare fair game.Profile (locked).
--profile thoughtful --depth medium --phase-model finalize=claude:medium. Reason: this is pure code work on a known shape (mirror of mediator's existing code path). Medium depth, medium finalize is enough.Locked decisions (do not relitigate during plan/critique):
- Bot identity:
bot_id = "coach",primary_topic_slug = "career"(matches S4 staging seed in migration 0031). cross_topic_policy = "peek"(matches mediator pattern; §16.6 recommendation).- Solo crisis default: refer to dyadic bot + external resources. No silent failure.
- Onboarding: idempotent first-contact renderer. Use upsert on
user_bot_stateto avoid the simultaneous-first-message race (§16.6 risk). - Routing:
resolve_botalready resolves from channel (S2a wired this). Verify the assumption holds for solo bot's transport but don't redesign. - Prod promotion: prod insertion of coach rows can happen IF S4's staging seed is verified clean. If it's not, defer prod promotion via TODO. Don't block S5 on prod promotion.
- No cross-topic writes from coach. That's S6.
- No second dyadic bot, no account-linking UI. (§16.6 deliberate exclusions.)
Sprint 5 — §16.6 verbatim
Goal. Ship the solo prompt renderer, hot context builder, onboarding renderer, crisis handler, and
BotSpec. Wire to the pre-provisioned transport from S4 and deploy to the consenting target user.Infrastructure already exists in staging from S4. This sprint is pure code work + cutover to prod.
Pre-flight context.
- S4 left coach scaffold in staging via migration 0031_coach_staging_seed.sql (in-SQL guarded). Coach BotSpec exists at
app/bots/coach.pyfrom S4. cross_topic_policyfor the new bot:"peek"(locked).- Read
prompts.py:122-186, 217-222, 335-370for dyad-only sections to skip in solo renderer. - Read
agentic.py:686— the runner callspartner_ofunconditionally before building context. This is the single line that breaks for solo bots; confirm work item 6 covers it.
Work items, ordered.
app/services/prompts_solo.py— solo system prompt renderer. No partner placeholder, no bridges, no in-person redirect, no partner crisis escalation.app/services/hot_context_solo.py— solo hot context builder. Single about-user bucket. Status block for own topic for the bound user. Peek block (still no other topics for this user unless the dyadic mediator also serves them — but for the brief one-user dyad relationship in current prod, peek = empty).app/services/onboarding_solo.py— first-contact renderer per §10.2 of architecture doc. Use upsert on user_bot_state to prevent duplicate onboarding states.app/services/crisis_solo.py— default handler: refer to dyadic bot + external resources. NEVER silent.- Augment
app/bots/coach.py(already exists from S4) — soloBotSpec,participants_shape="solo", primary topic="career", tool registry that excludes bridge tools,create_bridge_candidate, in-person redirect. agentic.py:686runner fix: skippartner_ofresolution whenparticipants_shape == "solo".TurnContext.partner = None. Hot context dispatch picks the solo builder.- Tool registry: filter dyadic-only tools at registration time per
participants_shape. §5.2 enforcement — solo bot literally doesn't see the tools. - Solo participant-shape validation in write tools: reject
about_user_id != bound_user_id, rejectabout_user_id IS NULL. - Prod-promotion migration (optional, gated): if S4's staging seed verified clean, write
migrations/0032_coach_prod_seed.sqlfor production rows. SAFETY: same in-SQL guard pattern as 0031 — only run if database name matches prod. If staging seed unverified, write TODO in feedback.md and skip. - End-to-end test (
tests/test_coach_e2e.py): solo bot turn against test user produces response, writes a memory, writes status, attempts a bridge tool call and FAILS at the boundary. - (DEFER — out of automated-sprint scope) Deploy to the consenting user. Monitor closely for ≥3 days. — Brief: do not auto-deploy. Leave a
MONITOR.mddoc atdocs/coach-monitor.mddescribing the monitoring plan.
Dependencies: (1–4) parallel; (5) gates (6); (7–8) gate (10, 11).
Definition of done.
- Solo bot turn shape works end-to-end in test (work item 10).
- Mediator unaffected: existing tests on s4 still pass.
- Per-(user, bot) pause works (S4 already delivered the write path).
- Onboarding flow renders on first contact (work item 3).
- NOT included: 3-day production soak; that's monitored offline.
S1-S4 lessons the executor must honor
- CLI scripts: invoke with
--helpto confirm parseable. - SQL fragments in Python strings: dry-run via
EXPLAINor sanity-check types. - asyncpg pool against
DATABASE_URL: passstatement_cache_size=0for Supabase port 6543. - No
hash()for deterministic IDs — usehashlib.sha1. - Schema filters in validation queries use
'mediator'not'public'. - No defensive fallbacks (per S3): don't add permissive filters.
- Read tools go through
topic_filter.join_artifact_topics(S3 commit 52d6dab). New solo hot_context must follow the pattern. - Scope guard runs on every read/write (S4 commit 02f84d4). Solo write tools must use it.
- NEW S4 LESSON: Review state-machine gotcha — if reviewer produces partial task verdicts but verdict="approved", state may not transition past
executed. Pre-emptive force-proceed after first approval signal is acceptable. - Pytest baseline: 563 pass / 0 fail / 5 skip on s4-auth-status-preflight HEAD. S5 must maintain or improve.
Stop conditions
- Any test that was passing on
s4-auth-status-preflightHEAD (commit 02f84d4) starts failing — STOP, report. - Solo bot writes to mediator's
relationshiptopic in any test — scope guard failure, STOP. - Bridge tool registered for coach (should be filtered out at registration) — STOP.
partner_ofcalled forparticipants_shape == "solo"in any code path — STOP.- Migration 0032 runs against prod without the in-SQL guard — STOP, revert.
User notes and answers:
-
T16 (preflight: staging seed verification + consenting user UUID) is BLOCKED by operator-held facts. PER BRIEF: items dependent on staging access or consent UUID can be deferred via TODO. ACTION: defer T16 by treating its preflight checks as PASS with explicit TODO comments in coach scaffold code referencing the operator decision. Skip mechanical verification; proceed with code-only deliverables (work items 1-8 of brief). Do NOT block on T16. Continue with execute for remaining 15 tasks.
codePlan: # Implementation Plan: Sprint 5 — First Solo Bot (Coach)
Overview
Sprint 5 ships the coach solo bot end-to-end in code on
s5-solo-bot-code(branched froms4-auth-status-preflighttip02f84d4). All infrastructure (BotSpec stub atapp/bots/coach.py, staging seed migration0031_coach_staging_seed.sql, routing viaresolve_bot, scope guards) already exists from S4. This sprint adds the four solo-specific renderers (system prompt, hot context, onboarding, crisis), fixes the single unconditionalpartner_ofcall in the runner (agentic.py:718), filters bridge tools out of the coach tool allowlist, enforces solo participant-shape in write tools, and proves it with an e2e test.Locked decisions (from brief, do not relitigate): bot_id=
coach, primary_topic=career,cross_topic_policy="peek", crisis default = refer to dyadic bot + external resources, onboarding via idempotent upsert onuser_bot_state, prod-promotion gated on S4 staging seed verification, no cross-topic writes (S6), no second solo bot, no account-linking UI.Key existing code shape:
BotSpecatapp/bots/base.py:43already supportsparticipants_shape,tool_allowlist,read_scopes,write_scopes,cross_topic_policy.- Coach spec at
app/bots/coach.pyis the S4 stub with_coach_prompt_rendererraisingNotImplementedError. agentic._run_agentic(app/services/agentic.py:696) unconditionally callspartner_ofat line 718 and passespartnerintobuild_hot_context,render_system_prompt, andTurnContext.- Tool allowlist is enforced at
app/services/tools/registry.py:281(_step_allowed) via intersection withbot_spec.tool_allowlist. - S4 already excluded
set_topic_statusfrom coach's allowlist; S5 must also exclude bridge tools. BotSpec.render_system_promptatapp/bots/base.py:63acceptspartner: User(positional). Solo path must toleratepartner=None.
Phase 1 — Pure Solo Renderers (parallel)
Step 1: Solo system prompt renderer (
app/services/prompts_solo.py)Scope: Medium
- Create
app/services/prompts_solo.pyexportingrender_solo_system_prompt(assistant_name, user_name, *, prompt_version, onboarding_state, sharing_default, topic_display_name)and constantsSOLO_SYSTEM_PROMPT_VERSION = "v1",SOLO_SYSTEM_PROMPT_V1,SOLO_FIRST_CONTACT_V1. - Author a new system prompt template that:
- Names the assistant as a solo
{topic_display_name}(e.g. "career") reflection coach for{user_name}— no partner placeholder. - Omits the dyad-only sections present in
prompts.py:122–186, 217–222, 335–370:# Cross-Thread Sharing Defaults/# Surfacing The Partner's Perspective/# Bridge Candidates# In-Person Redirection(no partner to redirect to)- Dyadic crisis escalation language about
escalate_to_partner/ "alert partner" gates.
- Keeps Role/Identity (rewritten solo), Operating Principles, Relational Voice (light edit — drop "shift empathy between them"), Frameworks (drop NVC translation framing), Six Knowledge Primitives (single about-user bucket), Two-Phase Turn Shape, OOB Rules (own-user only), Tool Usage Philosophy (drop
escalate_to_partner/ bridge bullets), Scheduling Judgment, Multi-Message Handling, Voice Notes, Conversation Closure, Solo Crisis Handling (see Step 4), Output Style.
- Names the assistant as a solo
- Include the first-contact placeholder
{first_contact_section}and inline it fromSOLO_FIRST_CONTACT_V1whenonboarding_state == "pending"— mirror the registry pattern inprompts.py:380. - Do not add
{partner_a_name}/{partner_b_name}/{cross_thread_section}/{partner_perspective_section}placeholders.
Step 2: Solo hot context builder (
app/services/hot_context_solo.py)Scope: Medium
- Create
app/services/hot_context_solo.pyexportingasync def build_hot_context_solo(pool, user, triggering_message_ids, trigger_metadata=None, *, primary_topic_id, bot_id)anddef render_hot_context_solo(hc) -> str. Reuse the existingHotContextdataclass fromhot_context.pywithpartner_user={}(empty dict — renderer must tolerate empty partner block). - Reuse existing helpers from
hot_context.pyfor: temporal context, conversation_load (filter bysender_id = user.id OR recipient_id = user.id), memories/observations/themes/watch_items/distillations scoped to the user-only and totopic_id = primary_topic_idviatopic_filter.join_artifact_topics(S3 commit52d6dabpattern, per lesson #7). - Single about-user bucket: all primitives filter on
about_user_id = user.id(no partner-perspective lookups). Status block from_fetch_topic_statusfor(primary_topic, user.id, dyad_id=None). - Peek block: per locked decision and §16.6, peek = empty for solo coach against the brief one-user dyad. Render an explicit empty section so the absence is auditable.
- Omit: bridge candidates list, partner OOB, partner sharing-default branches, partner perspective text, "soft_nudge"/
opt_outblocks. - No defensive fallbacks per S3 lesson #6: if
primary_topic_idis None, raise; do not silently swap to relationship topic.
Step 3: Solo onboarding renderer (
app/services/onboarding_solo.py)Scope: Small
- Create
app/services/onboarding_solo.pyexportingasync def ensure_onboarding_state(pool, *, user_id, bot_id) -> stranddef render_first_contact(topic_display_name) -> str. - Idempotent upsert to defeat the simultaneous-first-message race:
Return the resultingsql
INSERT INTO user_bot_state (user_id, bot_id, onboarding_state, updated_at) VALUES ($1, $2, 'pending', now()) ON CONFLICT (user_id, bot_id) DO UPDATE SET updated_at = user_bot_state.updated_at RETURNING onboarding_stateonboarding_state. (Verifyuser_bot_statehas columnsonboarding_stateand a(user_id, bot_id)unique constraint — if not present, this becomes a migration task; flag in questions.) - No silent failure: raise on upsert error; do not catch.
Step 4: Solo crisis handler text (
app/services/crisis_solo.py)Scope: Small
- Create
app/services/crisis_solo.pyexportingSOLO_CRISIS_SECTION_V1: strconsumed by Step 1's template. - Content: drop coach role entirely on crisis charge; surface region-appropriate external resources (988, Samaritans, local equivalents — judgment-based, not a fixed list); explicitly refer to the dyadic mediator bot by name for relationship-domain crisis; NEVER silent on crisis charge (justify silence requirement carries over from main prompt). No
escalate_to_partnergate text — that tool is unavailable to coach.
Phase 2 — Runner & Tool Boundary
Step 5: Augment coach BotSpec (
app/bots/coach.py)Scope: Small (gates Step 6)
- Replace
_coach_prompt_rendererstub with a real renderer that callsrender_solo_system_prompt. Signature must match whatBotSpec.render_system_promptcalls (seebase.py:63–79). Since the base acceptspartnerand passespartner.name, also patchBotSpec.render_system_promptto skip partner-name passing whenparticipants_shape == "solo"— or have the solo renderer accept and ignore the partner kwarg. Prefer the latter for minimal surface change: accept*args, **kwargsand pull only what's needed. - Set
cross_topic_policy="peek"(currentlyNone). - Tighten
tool_allowlist: start fromfrozenset(TOOL_DISPATCH)and subtract{"set_topic_status", "create_bridge_candidate", "update_bridge_candidate", "send_bridge_candidate", "list_bridge_candidates", "escalate_to_partner"}. These are the dyadic-only tools per §5.2. - Bump
bot_spec_version = "1.2.0".
Step 6: Runner partner-skip + dispatch (
app/services/agentic.py:718)Scope: Medium
- Branch on
bot_spec.participants_shapeat line 718:pythonif bot_spec.participants_shape == "solo": partner = None hot_context = await build_hot_context_solo( active_pool, user, triggering_message_ids, trigger_metadata, primary_topic_id=primary_topic_id_for(bot_spec), bot_id=bot_spec.bot_id) rendered_hot_context = render_hot_context_solo(hot_context) else: partner = await partner_of(active_pool, user) hot_context = await build_hot_context(...) rendered_hot_context = render_hot_context(hot_context) primary_topic_id_for(bot_spec): resolve via a lookup inapp/bots/registry.pykeyed onbot_spec.primary_topic_slug. For mediator, returnsget_relationship_topic_id(); for coach, fetch thecareertopic id (cache on first lookup). Avoidhash()for ids per lesson #4.render_system_promptcall (line 721): passpartner=partneras before; the solo renderer ignores it via**kwargs. No further change.TurnContextconstruction (line 767):partnerfield becomesUser | None; already declared atturn_context.py:21.protected_owner_ids(line 793) must droppartner.idwhenpartner is None— use[user.id].- Open turn event metadata (line 753):
topic_iduses the resolved primary topic id, not hard-codedget_relationship_topic_id().
Step 7: Tool registration filter (already wired)
Scope: Small (verification only)
- Verify
registry._step_allowedat line 281 already intersects withbot_spec.tool_allowlist. No code change required; Step 5's allowlist tightening makes bridge tools andescalate_to_partnerunreachable for coach. - Add test in Step 10 that asserts
"create_bridge_candidate" not in to_anthropic_tools(_step_allowed(coach_ctx))for every step.
Step 8: Solo participant-shape validation in write tools
Scope: Medium
- Locate write tools that accept
about_user_id(grepabout_user_idinapp/services/tools/write_tools.py): memory/observation/distillation/theme/watch_item adders. - Add a shared validator (call it
_assert_solo_about_user(ctx, about_user_id)): whenctx.participants_shape == "solo", rejectabout_user_id != ctx.user.idand rejectabout_user_id is None. Return tool-error dict ({"error": ..., "is_error": True}) — same shape as_tool_errorinregistry.py:306. - Wire into each affected tool BEFORE the scope guard (the scope guard at S4 commit
02f84d4already runs per lesson #8; this is the solo-shape pre-check).
Phase 3 — Migrations, Tests, Monitor
Step 9: Prod promotion migration (conditional) (
migrations/0032_coach_prod_seed.sql)Scope: Small, gated
- Verify S4 staging seed is clean: run a sanity check against staging (
SELECT * FROM bots WHERE id='coach'; SELECT * FROM topics WHERE slug='career';). If clean and the executor has prod-readable credentials available, proceed; otherwise write a TODO infeedback.mdand skip the migration entirely (per locked decision #6). - If proceeding: create
migrations/0032_coach_prod_seed.sqlmirroring 0031's in-SQL guard pattern, withIF current_database() NOT LIKE '%prod%' THEN RAISE NOTICE ...; RETURN; END IF;. Insertbots('coach', 'Coach'),topics('career', ...), and thebot_bindingfor the consenting prod user (id sourced from S4 prep — confirm in questions). - STOP condition: if migration would run against prod without the guard, revert immediately (per brief stop conditions).
Step 10: End-to-end test (
tests/test_coach_e2e.py)Scope: Medium
- Create
tests/test_coach_e2e.pywith one main test:- Seed an isolated test user + the coach bot + career topic (use existing test fixtures; check
tests/conftest.pyfor the pattern). - Stub the LLM client to return a deterministic plan: read → respond → record → done.
- Drive a single inbound message through
_run_agenticwithbot_id="coach". - Assert:
- A user-facing message was sent.
partner_ofwas NOT called (patch and assertnot_called).- At least one
add_memorywrite landed scoped totopic_id = career_topic_idandabout_user_id = user.id. topic_statuswrite happened (or skipped per allowlist — confirm with the test).- A stubbed
create_bridge_candidateinvocation by the model results intool.rejectedwith reasonstep_not_allowed(orunknown_tool); the assertion is that the tool call fails at the boundary, not that the model abstains.
- Seed an isolated test user + the coach bot + career topic (use existing test fixtures; check
- Idempotent onboarding test: call
ensure_onboarding_statetwice concurrently viaasyncio.gather; assert exactly one row and no exception.
Step 11: Monitor doc (
docs/coach-monitor.md)Scope: Small
- Create
docs/coach-monitor.mddescribing the 3-day soak plan: what dashboards/logs to watch, whichturn_eventtypes matter (tool.rejected,turn.openedwithbot_id=coach, scope-guard violations), rollback procedure (revert0032if it landed, comment coach out of BOT_SPECS). - DO NOT auto-deploy. Brief is explicit: monitoring is offline. This file is the only artifact for work item 11.
Execution Order
- Phase 1 Steps 1–4 in parallel — pure code, no dependencies between them.
- Step 5 (coach BotSpec) — depends on Steps 1–4 being importable.
- Step 6 (runner fix) — depends on Step 5.
- Steps 7–8 (tool filter verify + solo validation) — Step 7 is verification, Step 8 is independent of Step 6 but blocks Step 10.
- Step 9 (prod migration) — gated on staging verification; can run in parallel with Step 10.
- Step 10 (e2e test) — blocks done.
- Step 11 (monitor doc) — last, independent.
Validation Order
- Cheap first:
python -c "from app.services.prompts_solo import render_solo_system_prompt; print(render_solo_system_prompt('Coach','Test', prompt_version='v1', onboarding_state='pending', sharing_default=None, topic_display_name='Career')[:200])"to confirm import shape. - Targeted:
pytest tests/test_coach_e2e.py -xvs. - Coach allowlist assertion:
pytest tests/ -k "coach and allowlist" -xvs. - Mediator regression:
pytest tests/ -x— baseline is 563 pass / 0 fail / 5 skip on s4 HEAD (lesson #10). Must maintain. partner_ofaudit:grep -rn "partner_of\(" app/— every call site must be either inside aparticipants_shape == "dyad"branch or unreachable from solo.- Migration dry-run (if Step 9 lands):
psql -f migrations/0032_coach_prod_seed.sqlagainst a non-prod DB — must RAISE NOTICE and no-op.
Stop Conditions (from brief, restated)
-
Any test passing on s4 HEAD (
02f84d4) fails → STOP, report. -
Solo bot writes to mediator's
relationshiptopic → scope-guard failure, STOP. -
Bridge tool reachable from coach → STOP.
-
partner_ofcalled whenparticipants_shape == "solo"→ STOP. -
Migration 0032 runs against prod without guard → STOP, revert.
codePlan metadata: {"version": 1, "timestamp": "2026-05-12T05:08:12Z", "hash": "sha256:312b968631b876ac1a669949af6e2a0fc47e364d5bd1349674f7c5b80a50f5bc", "questions": [ "Does the
user_bot_statetable already have anonboarding_statecolumn and aUNIQUE(user_id, bot_id)constraint? If not, Step 3 needs a small precursor migration (likely0032_user_bot_state_onboarding.sql) before the prod-seed migration0033_coach_prod_seed.sql. The S4 system_state.py snippet only readspaused\u2014 the onboarding column may not yet exist.", "For Step 9 (prod promotion), is the target consenting user's UUID already known and recorded somewhere (e.g. a.envvalue, a fixture, or S4 notes)? If not, the migration cannot insert thebot_bindingrow and we should defer prod promotion to a follow-up.", "Shouldrender_system_promptonBotSpec(app/bots/base.py:63) be updated to handlepartner: User | None, or should the solo prompt renderer accept**kwargsand discard the partner argument? The latter is a smaller diff but slightly less honest about the contract. Default assumption in plan: solo renderer accepts and ignorespartnervia**kwargs.", "Is there an existing helper to resolveprimary_topic_idfrombot_spec.primary_topic_slug, or should Step 6 introduce a new lookup function inapp/bots/registry.py? The plan assumes the latter." ], "success_criteria": [ { "criterion": "app/services/prompts_solo.py,app/services/hot_context_solo.py,app/services/onboarding_solo.py, andapp/services/crisis_solo.pyall exist and are importable from a fresh Python session", "priority": "must", "requires": [ "run_shell", "read_files" ] }, { "criterion": "Coach BotSpec atapp/bots/coach.pyhascross_topic_policy=\"peek\",participants_shape=\"solo\", and atool_allowlistthat excludescreate_bridge_candidate,update_bridge_candidate,send_bridge_candidate,list_bridge_candidates,escalate_to_partner, andset_topic_status", "priority": "must", "requires": [ "read_files", "run_tests" ] }, { "criterion": "agentic.pyrunner skipspartner_ofwhenbot_spec.participants_shape == \"solo\"\u2014 verified by a unit test that patchespartner_ofand asserts not-called for a coach turn", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "tests/test_coach_e2e.pypasses: drives one inbound through_run_agenticwithbot_id=\"coach\", asserts a memory write scoped totopic_id=careerandabout_user_id=user.id, and asserts a model-issuedcreate_bridge_candidatecall is rejected at the registry boundary", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Idempotent-onboarding test: two concurrentensure_onboarding_statecalls produce exactly oneuser_bot_staterow and no exception", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Solo write-tool validation: a write tool called withabout_user_id != ctx.user.idorabout_user_id is Nonewhenparticipants_shape==\"solo\"returns anis_errorresult and writes nothing", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "Full test suite passes at or above the s4 HEAD baseline (563 pass / 0 fail / 5 skip)", "priority": "must", "requires": [ "run_tests" ] }, { "criterion": "No code path callspartner_offorparticipants_shape==\"solo\"\u2014 confirmed by grep audit ofapp/", "priority": "must", "requires": [ "run_shell", "read_files" ] }, { "criterion": "Ifmigrations/0032_coach_prod_seed.sqlexists, it carries the samecurrent_database() NOT LIKE '%prod%' THEN RETURNin-SQL guard pattern as 0031", "priority": "must", "requires": [ "read_files" ] }, { "criterion": "docs/coach-monitor.mdexists and describes the 3-day soak plan and rollback steps", "priority": "must", "requires": [ "read_files" ] }, { "criterion": "Solo system prompt omits bridge, in-person-redirection, partner-perspective, and cross-thread-sharing sections (verifiable by string-absence assertions in a unit test)", "priority": "should", "requires": [ "run_tests" ] }, { "criterion": "Solo hot context renderer omits partner OOB, partner sharing-default, and bridge candidates blocks", "priority": "should", "requires": [ "run_tests" ] }, { "criterion": "Solo crisis section explicitly references the dyadic mediator bot and external resources, and never permits silence on crisis charge", "priority": "should", "requires": [ "read_files", "subjective_judgment" ] }, { "criterion": "3-day production soak completed cleanly with no scope-guard violations or bridge-tool rejections from coach", "priority": "info", "requires": [ "observe_runtime_logs" ] }, { "criterion": "Consenting target user reports the coach bot is usable in production", "priority": "info", "requires": [ "subjective_judgment" ] } ], "assumptions": [ "Branchs5-solo-bot-codealready exists and is checked out at the working directory tip (confirmed: branch is current, on commit 02f84d4-derived state).", "user_bot_statealready has columns(user_id, bot_id, paused, onboarding_state, updated_at)and aUNIQUE(user_id, bot_id)constraint \u2014 flagged as a question; if absent, a precursor migration is needed before Step 3 can be deployed.", "The S4 staging seed migration 0031 has been applied to staging and abots('coach')+topics('career')row exist there; prod-promotion is otherwise deferred via TODO.", "Per locked decision #5,resolve_botalready returns'coach'for the coach's transport channel and the inbound path passes that into_run_agentic. No routing redesign attempted.", "The solo renderer accepts a partner kwarg and ignores it, soBotSpec.render_system_promptinbase.py:63does not need to be modified \u2014 minimizes blast radius.", "primary_topic_id_for(bot_spec)introduced inapp/bots/registry.pyis acceptable; it caches a slug\u2192UUID lookup on first hit.", "Solo crisis copy is authored by the executor at draft time and reviewed for content; subjective and not auto-verifiable.", "The test stub for the LLM client follows the existing pattern intests/test_agentic*.py(not opened during planning, but assumed to exist based on a 563-test baseline).", "statement_cache_size=0for asyncpg against Supabase port 6543 is already handled in test fixtures; no new pool code introduced here.", "Bridge tools andescalate_to_partnerare the complete set of dyadic-only tools to exclude.set_topic_statusis already excluded by S4. No other tool needs filtering for solo shape." ], "structure_warnings": [] }codePlan structure warnings from validator: [] Existing flags: [{ "id": "FLAG-003", "concern": "Search for related code: partner_of is also called at app/services/inbound.py:130 and app/staging.py:32. inbound.py catches ValueError with warning (solo pause/resume logs benign warning), but brief stop condition partner_of called for participants_shape==solo in any code path is strictly broader than the runner. Plan should patch _control_recipients to skip partner_of for solo or narrow the stop condition.", "status": "open", "severity": "minor" }, { "id": "FLAG-004", "concern": "Search for related code: Brief locked decision #5 directs verification that resolve_bot returns coach for the coach's transport. Migration 0031 defers channel seeding. Plan includes no routing verification step; Step 10 e2e uses fixtures that bypass channel lookup. Real inbound routing to coach remains unverified by this sprint.", "status": "open", "severity": "minor" }, { "id": "verifiability-0", "concern": "Criterion 12: requires human verification (subjective_judgment).", "status": "open", "severity": "minor" }, { "id": "verifiability-1", "concern": "Criterion 13: requires human verification (observe_runtime_logs).", "status": "open", "severity": "minor" }, { "id": "verifiability-2", "concern": "Criterion 14: requires human verification (subjective_judgment).", "status": "open", "severity": "minor" } ]
codeKnown accepted debt grouped by subsystem: {"are-the-proposed-changes-technically-correct": [ { "id": "DEBT-002", "concern": "are the proposed changes technically correct?: the plan\u2019s
scripts/seed_channels.pyuseson conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standardunique (transport, address, guild_id, channel_id)constraint on raw columns. postgresqlon conflicttarget lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs likecoalescein 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-011", "concern": "are the proposed changes technically correct?: phase b cte pair (insandsrc) 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-019", "concern": "are the proposed changes technically correct?: step 5.1 saysdyad_idis appendedbefore the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed bycurrent_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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-026", "concern": "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) assumespython scripts/capture_eval_baseline.pycan connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserveset search_pathacross 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).", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-031", "concern": "are the proposed changes technically correct?: the lint scriptscripts/lint_inserts.pyhas 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 thesys.exit(0)at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid--dirargument (or whenargs.dirresolves 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: changesys.exit(0)tosys.exit(1)at line 309 (or remove the error-path todo and update the exit code in the same step).", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-034", "concern": "are the proposed changes technically correct?: step 4.5's_row_matches_topichelper falls back to global behavior when (table, id) is not in self.artifact_topics \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-036", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-037", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-038", "concern": "are the proposed changes technically correct?: step 18 coach botspec writestool_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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-041", "concern": "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 \u2014 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).", "occurrence_count": 2, "plan_ids": [ "sprint-5-solo-bot" ] }, { "id": "DEBT-042", "concern": "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 \u2014 directly trips stop condition solo bot writes to mediator's relationship topic in any test.", "occurrence_count": 2, "plan_ids": [ "sprint-5-solo-bot" ] } ], "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [ { "id": "DEBT-001", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-004", "concern": "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 \u00a712.2 ddl, while claiming 'exactly per \u00a73/\u00a712 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-009", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-013", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-018", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-020", "concern": "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 \u2014 set search_path doesn't persist across pooled connections \u2014 and must be deferred, with sprint proceeding on t6\u2013t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task withphase 0 must run firstexecution order. plan body and execution order do not reflect the deferral; executor will block on it.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-021", "concern": "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; finalpython -m evals rundiff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-022", "concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-runpython -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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-030", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-039", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ], "does-the-change-touch-all-locations-and-supporting-infrastructure": [ { "id": "DEBT-008", "concern": "does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool withchannels,user_identities,bot_bindings,dyads, anddyad_membersdicts so the sql patterns inresolve_bot,resolve_sender, andresolve_bindingcan match against stored rows. however,tests/conftest.pyis 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 modifyingconftest.py\u2014for example by defining a localroutingfakepool(fakepool)subclass insidetests/test_routing.pyor by monkeypatching the class in that test module. if the executor follows the plan literally and editsconftest.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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-015", "concern": "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_reconstant (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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-016", "concern": "does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters butpaused_for_userdoes not currently calllogger.*(verified by reading hooks.py). the plan instructs to logextra={user_id, bot_id}\u2014 if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-023", "concern": "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--helpinvocation). 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-024", "concern": "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 \u2014 it queries viapsqlor any working connection \u2014 and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-045", "concern": "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 \u2014 _open_turn's topic_id kwarg must also be parameterized.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ], "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them": [ { "id": "DEBT-003", "concern": "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 defineschannelswithunique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows withguild_id=null, channel_id=nulland the same transport+address would not conflict. however,scripts/seed_channels.pyuseson 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 useunique nulls not distinct(pg15+, and the repo uses pg16 pertest_eval_workflow.py:36) or a unique index on the coalesce expressions.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-017", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 addsbot_idkwarg 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-025", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-033", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 stripsbot_specdefaults fromtests/_scope_helpers.py:make_mediator_ctx, which has six call sites acrosstests/test_s2a_stamping.py(5 calls) andtests/test_s2a_artifact_topics_same_stmt.py(1 call) that rely on the implicit default. the executor must update all six call sites to passbot_specexplicitly. however, plan step 20's stop-condition nuance lists only steps 14\u201317 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 enumeratetest_s2a_stamping.pyandtest_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-040", "concern": "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' \u2014 but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-046", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ], "issue-hints-completeness": [ { "id": "DEBT-027", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] } ], "search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader": [ { "id": "DEBT-005", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.2 ddl foruser_identitiesincludes averified_at timestamptzcolumn. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a futurealter table user_identities add column verified_atis required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-006", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.1 ddl forchannelsincludesconfig jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. likeverified_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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-007", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claimspopulate_mediator_spec_from_db(pool)reads 'db-populated fields' forprimary_topic_slug,participants_shape,read_scopes, etc. however, thebotstable ddl in the plan only definesid,display_name, andcreated_at\u2014 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 readdisplay_namefrom the db row. the plan's wording could mislead the executor into writing aselect * from botsexpecting columns that do not exist. the implementation should explicitly select onlydisplay_nameand hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns onbots, so hardcoding is correct for s1, but the plan text should be clarified.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-010", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief \u00a716.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 scriptscripts/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, thechannelstable 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-012", "concern": "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 \u00a716.1 'channels seeded in migration 0020' wording but is now explicitly explained.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-014", "concern": "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 callssystem_state.is_paused(_pool)only (global). the added parameter is wired in but not consumed in s2a \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-028", "concern": "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 \u2014 stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause \u2014 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'.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-029", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-032", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-035", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-043", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] }, { "id": "DEBT-044", "concern": "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 \u2014 step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ] }codeEscalated debt subsystems: [{ "subsystem": "are-the-proposed-changes-technically-correct", "total_occurrences": 13, "plan_count": 6, "entries": [ { "id": "DEBT-002", "concern": "are the proposed changes technically correct?: the plan\u2019s
scripts/seed_channels.pyuseson conflict (transport, address, coalesce(guild_id,''), coalesce(channel_id,'')) do nothing, but the 0020 migration defines the table with a standardunique (transport, address, guild_id, channel_id)constraint on raw columns. postgresqlon conflicttarget lists must reference the exact column names of a unique constraint or a matching unique index; expression constructs likecoalescein 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-011", "concern": "are the proposed changes technically correct?: phase b cte pair (insandsrc) 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-019", "concern": "are the proposed changes technically correct?: step 5.1 saysdyad_idis appendedbefore the existing-fields preserved block beginning at line 34. actual line 34 in turn_context.py is a blank/comment line followed bycurrent_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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-026", "concern": "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) assumespython scripts/capture_eval_baseline.pycan connect to the supabase pooler. per user note, the pooler's transaction-mode does not preserveset search_pathacross 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).", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-031", "concern": "are the proposed changes technically correct?: the lint scriptscripts/lint_inserts.pyhas 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 thesys.exit(0)at line 309 to a non-zero exit code. after the script is flipped to blocking mode, invoking it with an invalid--dirargument (or whenargs.dirresolves 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: changesys.exit(0)tosys.exit(1)at line 309 (or remove the error-path todo and update the exit code in the same step).", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-034", "concern": "are the proposed changes technically correct?: step 4.5's_row_matches_topichelper falls back to global behavior when (table, id) is not in self.artifact_topics \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-036", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-037", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-038", "concern": "are the proposed changes technically correct?: step 18 coach botspec writestool_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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-041", "concern": "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 \u2014 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).", "occurrence_count": 2, "plan_ids": [ "sprint-5-solo-bot" ] }, { "id": "DEBT-042", "concern": "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 \u2014 directly trips stop condition solo bot writes to mediator's relationship topic in any test.", "occurrence_count": 2, "plan_ids": [ "sprint-5-solo-bot" ] } ] }, { "subsystem": "search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader", "total_occurrences": 12, "plan_count": 5, "entries": [ { "id": "DEBT-005", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.2 ddl foruser_identitiesincludes averified_at timestamptzcolumn. the plan's 0020 migration ddl omits this column entirely. while account-linking is deferred to s4+, omitting the column now means a futurealter table user_identities add column verified_atis required, creating unnecessary schema churn. the column can safely be created nullable with no data in s1, matching the architecture doc verbatim.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-006", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the architecture doc \u00a712.1 ddl forchannelsincludesconfig jsonb not null default '{}'::jsonb. the plan's 0020 migration ddl omits this column. likeverified_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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-007", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: step 10 claimspopulate_mediator_spec_from_db(pool)reads 'db-populated fields' forprimary_topic_slug,participants_shape,read_scopes, etc. however, thebotstable ddl in the plan only definesid,display_name, andcreated_at\u2014 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 readdisplay_namefrom the db row. the plan's wording could mislead the executor into writing aselect * from botsexpecting columns that do not exist. the implementation should explicitly select onlydisplay_nameand hardcode the rest, or the ddl should be expanded to store bot config. the architecture doc does not specify these columns onbots, so hardcoding is correct for s1, but the plan text should be clarified.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-010", "concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the locked brief \u00a716.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 scriptscripts/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, thechannelstable 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-012", "concern": "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 \u00a716.1 'channels seeded in migration 0020' wording but is now explicitly explained.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-014", "concern": "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 callssystem_state.is_paused(_pool)only (global). the added parameter is wired in but not consumed in s2a \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-028", "concern": "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 \u2014 stamping insert sites, rekeying coalescer/suppression, observability, per-bot pause \u2014 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'.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-029", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-032", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-035", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-3-join-cutover" ] }, { "id": "DEBT-043", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] }, { "id": "DEBT-044", "concern": "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 \u2014 step 10 e2e bypasses real channel resolution via fixtures. resolve_bot for coach inbound remains unverified by this sprint.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ] }, { "subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements", "total_occurrences": 10, "plan_count": 4, "entries": [ { "id": "DEBT-001", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-004", "concern": "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 \u00a712.2 ddl, while claiming 'exactly per \u00a73/\u00a712 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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-009", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-013", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-018", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-020", "concern": "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 \u2014 set search_path doesn't persist across pooled connections \u2014 and must be deferred, with sprint proceeding on t6\u2013t17. the plan still presents step 2 (eval baseline in d4c2a7c worktree) as the gating phase 0 task withphase 0 must run firstexecution order. plan body and execution order do not reflect the deferral; executor will block on it.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-021", "concern": "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; finalpython -m evals rundiff vs baseline). these references should be marked optional / deferred per the user note. currently they read as gates.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-022", "concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: plan step 17.2 still says 're-runpython -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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-030", "concern": "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.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-039", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] } ] }, { "subsystem": "does-the-change-touch-all-locations-and-supporting-infrastructure", "total_occurrences": 6, "plan_count": 3, "entries": [ { "id": "DEBT-008", "concern": "does the change touch all locations and supporting infrastructure?: routing unit tests require extending fakepool withchannels,user_identities,bot_bindings,dyads, anddyad_membersdicts so the sql patterns inresolve_bot,resolve_sender, andresolve_bindingcan match against stored rows. however,tests/conftest.pyis 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 modifyingconftest.py\u2014for example by defining a localroutingfakepool(fakepool)subclass insidetests/test_routing.pyor by monkeypatching the class in that test module. if the executor follows the plan literally and editsconftest.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.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-015", "concern": "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_reconstant (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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-016", "concern": "does the change touch all locations and supporting infrastructure?: plan step 14.3 lists hooks.py emitters butpaused_for_userdoes not currently calllogger.*(verified by reading hooks.py). the plan instructs to logextra={user_id, bot_id}\u2014 if there is no existing log call, the executor must add one, which is a behavior change rather than an annotation. minor scope creep.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-023", "concern": "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--helpinvocation). 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-024", "concern": "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 \u2014 it queries viapsqlor any working connection \u2014 and should not be deferred. plan should make clear step 1 still gates phase 1, but step 2 is parked.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-045", "concern": "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 \u2014 _open_turn's topic_id kwarg must also be parameterized.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ] }, { "subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them", "total_occurrences": 6, "plan_count": 5, "entries": [ { "id": "DEBT-003", "concern": "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 defineschannelswithunique (transport, address, guild_id, channel_id). postgresql treats null != null under standard unique constraints, so two whatsapp rows withguild_id=null, channel_id=nulland the same transport+address would not conflict. however,scripts/seed_channels.pyuseson 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 useunique nulls not distinct(pg15+, and the repo uses pg16 pertest_eval_workflow.py:36) or a unique index on the coalesce expressions.", "occurrence_count": 1, "plan_ids": [ "sprint-1-foundation" ] }, { "id": "DEBT-017", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: step 13.2 addsbot_idkwarg 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-025", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-2a-stamp-rekey" ] }, { "id": "DEBT-033", "concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: plan step 18 stripsbot_specdefaults fromtests/_scope_helpers.py:make_mediator_ctx, which has six call sites acrosstests/test_s2a_stamping.py(5 calls) andtests/test_s2a_artifact_topics_same_stmt.py(1 call) that rely on the implicit default. the executor must update all six call sites to passbot_specexplicitly. however, plan step 20's stop-condition nuance lists only steps 14\u201317 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 enumeratetest_s2a_stamping.pyandtest_s2a_artifact_topics_same_stmt.py) so the executor has permission to fix residual failures in those files.", "occurrence_count": 1, "plan_ids": [ "sprint-2b-constraints" ] }, { "id": "DEBT-040", "concern": "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' \u2014 but if get_theme returns a non-optional theme dict, the executor needs guidance. minor specificity gap.", "occurrence_count": 1, "plan_ids": [ "sprint-4-auth-topic-status" ] }, { "id": "DEBT-046", "concern": "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 \u2014 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.", "occurrence_count": 1, "plan_ids": [ "sprint-5-solo-bot" ] } ] } ]codeDebt guidance: - These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them. - Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`. - When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`. Your output template is at: /Users/user_c042661f/Documents/Veas/.megaplan/plans/sprint-5-solo-bot/critique_output.json
Read this file first — it contains 5 checks, each with a question and guidance. For each check, investigate the codebase, then add your findings to the
findingsarray for that check.Each finding needs:
- "detail": what you specifically checked and what you found (at least a full sentence)
- "flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
- Every check must end with at least one finding. Never leave a
findingsarray empty. If you found no issue, add one detailedflagged: falsefinding explaining what you checked and why it appears clear.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false} Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true} Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the
flagsarray (e.g., security, performance, dependencies). Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
codeAdditional guidelines: - Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate. - Over-engineering: prefer the simplest approach that fully solves the problem. - Reuse existing flag IDs when the same concern is still open. - `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess. - Verify that the plan follows the expected structure when validator warnings or the outline suggest drift. - Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other. - Focus on concrete issues, not structural formatting. - Bot identity:
Assistant
Critique submitted. Plan is unchanged from prior iteration; prior FLAG-001/002/003/004 are now accepted debt (DEBT-041–046) and carried as recurring findings per guidance. One new minor flag: the user note's instruction to add explicit T16-deferral TODO comments in the coach scaffold is not reflected in plan Step 5.