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

7.5 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 or cloud publication. Later explicit trial-update request authorizes a background Renderer refresh only. 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; installed into the running trial after the explicit follow-up request. 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.

Trial Update Follow-up — 2026-09-30

  • User authorized installing this fix into the existing temporary application. Same task/branch/base resumed with official task_context; ownership verified, canonical lock remains foreign and read-only. Preserve current composite overlays, all live chats/drafts and desktop focus. No main merge/push or cloud publication.
  • Plan: apply only the two product-file changes from 36202e0 to a staged copy of the latest trial composite; build and typecheck; take private live-state backup, reload only the Renderer in the background and verify assets, storage, drafts, messages and focus.

Trial update result

  • Installed only the CodingChatPanel/TeacherChatPanel reference-isolation changes from 36202e0 onto the latest sidebar-left-33d87a81 composite. Three-way patching preserved existing teacher textarea/navigation overlays and the older live Main conversation API; no whole-file replacement or Main restart. Composite source: /private/var/folders/mx/ltbgwsks5_n8zllj69p_wbcw0000gn/T/makelore-trial-tdq_nuah/teacher-reference-70b4a183/source.
  • Composite production build and typecheck passed. Initial imported branch tests used the newer project-scoped API and two fixtures failed against the older trial signature. Adapted only the temporary test fixture API arguments/draft keys to the existing trial interface; all 34 CodingChatPanel tests passed, including both reference regressions. Product protocol unchanged.
  • Background Renderer refresh loaded index-mR-oHKNI.js in existing Main PID 32583. Verified all 14 operation message contents, selected conversation, route/tab, teacher-panel state, inputs, operation drafts, teacher draft storage, window bounds and both scroll positions retained. Restored sidebar expansion after normal preference hydration. Only user-profile cache version/timestamp refreshed; no history or draft deletion.
  • Verification: trial stage verification.json; build.log, typecheck.log, unit-composite.log. Private before/after snapshots use mode 0600. launch.json and guidance-preview.json point to the new composite and preserve previous overlays/Main entries. Main-owned verification lease released (0 remaining), background throttling restored and inspector closed. No show/focus call, model request, cloud deployment, merge or push. Existing saved misquotes remain explicitly removable by the user.