Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL — cut Lock R3-8 (a)#173

Merged
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL
May 24, 2026
Merged

KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL — cut Lock R3-8 (a)#173
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL

Conversation

@rafe-walker

Copy link
Copy Markdown
Owner

Summary

Lock R3-8 (a) execution per operator confirmation during the R3 walkthrough. Cuts the auto-reply-to-sender branch in EmailInboundHandler along with the KORA_EMAIL_AUTO_REPLY env. Both directions of email stay — inbound parsing (for the future KR-INTENT-EMAIL-TO-SEA-TICKET consumer) + outbound send for Kora-originated artifacts. Only the AI-drafted reply path goes.

Bucket spec: 17_cc_bucket_prompts/KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL_r3_lock_8a_execution.md.

K-DG verification: self-contained?

Yes. All auto-reply helpers cascade from _send_auto_reply. Grep confirmed no other module imports should_reply, CANNED_FALLBACK_TEXT, AUTO_REPLY_ENV, _send_auto_reply, _build_reply_and_meta, _call_reasoning_engine, _resolve_reasoning_engine, _resolve_purelymail_client, _email_caller_session_id, _empty_reasoning_meta, or _reasoning_meta_from_result outside this handler + its test surface. Safe to excise without unraveling unrelated flow.

LOC removed

Layer Files Adds Deletes Net
Handler kora_cli/handlers/email_inbound_handler.py ~80 ~470 −390
Handler tests tests/kora_cli/handlers/test_email_inbound_handler.py ~30 ~510 −480
Comment crumbs purelymail_client.py, probes/fix_envelopes.py, alerts/aggregator.py, audit/reasoning_xref.py ~10 ~15 −5
IMAP listener tests test_email_inbound_imap_listener.py (drop should_reply= kwargs) ~0 ~3 −3
Docs (sweep below) 2 files ~25 ~75 −50
Code-only LOC delta 117 841 −724
Total incl. docs 180 954 −774

Docs swept

Per spec §2(b):

  • kora_docs/15_status_and_roadmap/kora_runtime_doppler_env_mapping.md — removed the KORA_EMAIL_AUTO_REPLY row from the env table; added a "Removed" note pointing to Lock R3-8 (a); updated KORA_EMAIL_JOSHUA_ADDRESS description to drop the "drive AUTO_REPLY" phrase.
  • kora_docs/15_status_and_roadmap/purelymail_runbook.md — removed:
    • The KORA_EMAIL_AUTO_REPLY Doppler set + validation loop from Part 2 Step 2 (now 7 envs / 3 handler envs instead of 8 / 4)
    • Part 2 Step 4 (the full-loop AUTO_REPLY smoke test) — replaced with a "REMOVED — Lock R3-8 (a)" note explaining what's gone vs preserved
    • Part 2 Step 5 (AUTO_REPLY opt-in cost trade-off section) — folded into the removal note
    • The "Inbound emails are received but AUTO_REPLY never sends" troubleshooting section — replaced with a "this is expected" note for legacy env values
    • Trail comments in the cross-references section.
  • The spec also referenced an EOD doc (2026-05-23_eod_phase2_complete.md) but no such file exists in this branch — no update needed.

Telemetry route literal — preserved

Confirmed cost_telemetry.ROUTE_EMAIL_INBOUND = "email_inbound" is intact (3 references in kora_cli/telemetry/cost_telemetry.py). Reserved for future KR-EMAIL-COST-BILL wiring once KR-INTENT-EMAIL-TO-SEA-TICKET ships a real consumer.

Test plan

  • All test_auto_reply_* tests deleted; inbound parsing + filter precedence + JSONL emission tests retained verbatim.
  • New regression: test_legacy_auto_reply_env_is_ignored_no_send (parametrized over true / 1 / yes / on / TRUE) — handler ignores legacy env cleanly; reasoning engine + purelymail client accessors are wired to fail loudly if the handler ever touches them post-removal.
  • New test_handler_constructor_accepts_only_log_path + test_handler_result_has_no_should_reply_field pin the reduced API surface.
  • IMAP listener tests updated to drop the removed should_reply= kwarg (2 sites).
  • Focused regression set (tests/kora_cli/handlers/ tests/kora_cli/audit/ tests/kora_cli/telemetry/ tests/kora_cli/clients/ tests/kora_cli/test_listeners/test_email_inbound_imap_listener.py): 332 passed.
  • ruff check clean on all changed files.

🤖 Generated with Claude Code

Operator lock during R3 walkthrough: cut the auto-reply-to-sender
branch in EmailInboundHandler. Keep both directions of email but
remove the AI-drafted reply path.

Removed
-------
* `EmailInboundHandler._send_auto_reply` + supporting private
  methods: `_build_reply_and_meta`, `_call_reasoning_engine`,
  `_resolve_reasoning_engine`, `_resolve_purelymail_client`.
* Module-level `AUTO_REPLY_ENV` / `_auto_reply_enabled` /
  `_empty_reasoning_meta` / `_reasoning_meta_from_result` /
  `_email_caller_session_id` / `CANNED_FALLBACK_TEXT`.
* `HandlerResult.should_reply` field — consumers now only care
  about `status` + `should_mark_seen`.
* `purelymail_client` + `reasoning_engine` constructor kwargs.
* The AUTO_REPLY branch in `_handle_event_inner` (no env read,
  no engine invocation, no outbound send).
* Auto-reply test surface: `test_auto_reply_*` (16 tests),
  `test_caller_session_id_matches_engine_derivation_shape`.
* `KORA_EMAIL_AUTO_REPLY` env from `kora_runtime_doppler_env_mapping.md`
  + `purelymail_runbook.md` (Part 2 Step 2 secrets + validation,
  Step 4 + 5 entirely, troubleshooting section).
* Dangling AUTO_REPLY comment crumbs in `purelymail_client.py`,
  `probes/fix_envelopes.py`, `alerts/aggregator.py`,
  `audit/reasoning_xref.py`.

Preserved
---------
* 5-step inbound filter precedence + JSONL emission + chain-event
  `[kora.email_inbound.received]`.
* IMAP listener (`email_inbound_imap_listener`) — unchanged.
* Outbound `PurelymailClient` for non-inbound-reply paths (Kora
  emailing artifacts / reports from other modules).
* Email-thread context loader.
* `cost_telemetry.ROUTE_EMAIL_INBOUND = "email_inbound"` route
  literal — reserved for the future KR-EMAIL-COST-BILL wiring
  when KR-INTENT-EMAIL-TO-SEA-TICKET ships a real consumer.

Regression coverage
-------------------
* Parametrized `test_legacy_auto_reply_env_is_ignored_no_send`
  pins that any legacy `KORA_EMAIL_AUTO_REPLY` value in operator
  config is ignored cleanly (reasoning engine + purelymail client
  accessors are wired to fail loudly if the handler ever calls
  them post-removal).
* `test_handler_constructor_accepts_only_log_path` pins the
  reduced constructor surface.
* `test_handler_result_has_no_should_reply_field` pins the
  dataclass shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafe-walker rafe-walker merged commit 38b7b3d into feature/phase2-upgrades May 24, 2026
@rafe-walker rafe-walker deleted the feat/kora-KR-EMAIL-AUTOREPLY-BRANCH-REMOVAL branch May 24, 2026 03:32
rafe-walker added a commit that referenced this pull request May 24, 2026
…n + revert (#177)

Operator now edits phrasebook from cockpit. PUT + revert + backups list endpoints (BE) + edit-mode UI in PhrasebookPage (FE). Validation: regex compiles, snapshot-path placeholders, catastrophic-backtracking check, no duplicate (pattern, category). Backup-on-write with env-tunable rotation.

All 3 spec §4 STOP-ASK candidates resolved inline (static-list snapshot-path validation, audit seam Literal extension, free-form category v1).

New audit seam phrasebook.updated with actor field deliberately shaped for future promotion-loop (kora_proposal_approved/pending). Sets UX foundation KR-FE-PROMOTION-REVIEW-PANEL will reuse.

Rebased onto current feature/phase2-upgrades (post #173 / #176) to resolve SeamName Literal adjacent-addition conflict — both intent.email_to_sea_ticket (#176) and phrasebook.updated (#177) preserved in sequence.

76/76 phrasebook tests + tsc + vite build clean.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant