Files
makelore/.project-docs/30-worklog/tasks/20260930-teacher-reference-isolation-70b4a183.md
T

5.1 KiB

Task: Isolate pending teacher message references

Identity

  • Task ID: 20260930-teacher-reference-isolation-70b4a183
  • Mode: Feature
  • Branch: codex/20260930-teacher-reference-isolation-70b4a183-teacher-reference-isolation
  • Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20260930-teacher-reference-isolation-70b4a183
  • Base commit: c55e9c7182
  • Owner: codex
  • Status: Ready for Integration

Scope

  • Diagnose and fix unintended quotation of text from another teacher when opening/switching the teacher consultation panel.

Intent And Constraints

  • Preserve history, existing saved drafts, cloud teacher configuration, operation messages, billing and send identity. No subagents, live model calls, main merge/push, cloud publication or app restart. Never remove persisted references by guessing their origin.

Outcome

  • Confirmed the screenshot mechanism: openTeacher captured the global DOM selection, including another teacher's message, then stored it in the newly selected teacher's draft. Ordinary typed sends include draft references; configured shortcuts intentionally send none. Also reproduced consumed quote resurrection after reopening the dock.
  • Restricted new capture to ranges entirely inside the currently visible operation conversation; bound one-time quote handoff to account/project/source/target teacher and consume it after acceptance. Existing teacher drafts remain independent. Clear/send no longer revives the original prop on reopen. Cloud configurations, history and saved drafts are untouched.

Verification

  • Added two integrated CodingChatPanel regressions using real DOM Range/Selection; both failed against the original code and pass after the fix. They cover cross-teacher capture, independent outgoing references, valid operation quote, switching recipients, removal/reopen and send/reopen.
  • 125 relevant unit tests passed across four files. Added and passed one Electron production-Renderer scenario confirming selection/click behavior and actual captured Host API request references. E2E used a temporary generated-entry focus guard; restored original compiled bytes afterward. No live app/model calls.
  • Typecheck, full lint (0 errors / 8 existing warnings), final scoped lint, production build and whitespace checks passed. Logs /tmp/teacher-reference-{repro,focused,unit,typecheck,lint,build,electron,scoped-lint}.log. Task-aware docs check passed.

Follow-ups

  • Fix is on this feature branch, not merged/pushed or installed into the running trial. Existing persisted misquoted draft references are not automatically deleted because they lack reliable source metadata; the user can remove the visible item explicitly. No historical message rewrite or cloud deployment.

Promotion Candidates

  • Target: canonical consultation draft/reference boundaries. New selection capture must originate wholly in the visible operation conversation and be a one-time handoff to an account/project/source/teacher recipient. Evidence: reproducible cross-teacher failure and 125 unit plus one Electron regression pass. This enforces existing chat isolation without changing teacher permissions; canonical promotion remains deferred.

Project Context Loaded

  • Exact feature owner/worktree/branch/base c55e9c7 verified with official start/status. App worktree API unavailable in parent non-Git workspace; official isolation succeeded. Reused unchanged entry/memory/positioning/system/decision/domain/success context from the preceding merge; reread active record, teacher ADR and data-flow reference boundaries, evidence and commitments indexes. Latest main is clean and equal to fetched origin/main.
  • Read all peer task records, assessing Scope/Intent/Promotion. Remaining active release/help-label tasks do not modify quotation capture; undefined child-language scope has no concrete dependency. No canonical writes.
  • Source: CodingChatPanel.openTeacher reads the whole window selection, without source validation. TeacherChatPanel persists incoming quote in the selected agent draft; normal free-input sends include references, configured shortcuts deliberately send an empty list. Existing per-account/project/teacher draft isolation works, but the global selection can import another teacher's text. Parent quote also lacks recipient scope and one-time consumption.
  • Existing policy: teachers have separate project chats/drafts, explicit references retain operation-project/source identity and must not cross source boundaries. Retain legitimate operation-chat selection quoting and saved data.
  • Gate: Passed.

Plan

  1. Reproduce selection from teacher A entering teacher B using real DOM selection in the existing CodingChatPanel test.
  2. Restrict capture to the visible operation conversation, bind a new quote to account/project/source/recipient, and consume the one-time quote after the panel accepts it so removal/sending does not resurrect it on reopen.
  3. Cover independent saved drafts, switch/remove/reopen and actual send references; run relevant units, typecheck/lint/build and available browser integration. Report cause and distinguish code fix from existing stored draft cleanup.