5.2 KiB
5.2 KiB
Task: Fix AI programming input context menu
Identity
- Task ID: 20260907-input-context-menu-a7c31e
- Mode: Feature
- Branch: codex/20260907-input-context-menu-a7c31e-input-context-menu
- Worktree: D:\Datas\OthersProjects.codex-worktrees\makelore\20260907-input-context-menu-a7c31e
- Base commit:
8c13ae76db - Owner: codex
- Status: Ready for Integration
Scope
- Reproduce the AI Programming composer symptom where right-clicking editable text exposes no native editing menu.
- Compare the current integrated primary-window wiring with completed task
20260819-context-menu-impl-c7d4a2e1and reuse only behavior still compatible with the current window lifecycle. - Restore the smallest Main-owned native text-editing context-menu behavior and add focused regression coverage at the real window/event seam.
- Verify that the AI Design
design-chat-composertextarea shares the same primary Renderer seam, and extend the Electron regression to cover both Code and Design textarea controls without adding a duplicate listener. - Update user-facing documentation or Electron E2E coverage only where current behavior and the shared fixture require it.
Intent And Constraints
- Electron Main owns desktop context-menu integration. Do not add Renderer, Preload, IPC, Host API, or direct clipboard access for this fix.
- Use the primary window's
webContentscontext-menuevent and native editing roles when that remains the confirmed compatible seam. - Show a menu only for editable controls or an existing text selection; derive enabled actions from the actual Electron edit context.
- Preserve Renderer-owned custom menus, Monaco behavior, the detached Agent Browser, existing application-menu behavior, Chinese-only UI, and the single light visual system.
- Build a deterministic red-capable feedback loop for the reported input symptom before selecting a cause or changing production code.
- Work only in the isolated task worktree; do not modify, adopt, clean, or merge the
occupied root
mainworktree or any peer worktree.
Outcome
- Confirmed the failure at the real Electron window seam: a renderer right-click
produced no native menu because the primary
webContentshad zerocontext-menulisteners. The earlier implementation in task20260819-context-menu-impl-c7d4a2e1exists only on its isolated branch and was never integrated into the currentmainhistory. - Added a Main-owned text context-menu module that builds native Chinese
cut,copy,paste, andselectAllroles from Electron's actualisEditable,selectionText, andeditFlagscontext. Ordinary non-editable content still produces no menu. - Registered the listener once during primary-window creation without adding Renderer, Preload, IPC, Host API, or direct clipboard access.
- Confirmed
DesignConversationPanerenders the AI Design composer as the ordinary<textarea id="design-chat-composer">produced by the sharedTextareacomponent inside that same primary Renderer. The window-level listener therefore covers both AI Code and AI Design without a second production listener. - Added five focused unit cases and an Electron E2E regression that dispatches real right-clicks on Code and Design textarea controls inside the primary Renderer window and observes two native menu popups with the expected editing actions.
- Synchronized
README.mdwith the restored desktop behavior and ownership boundary.
Verification
- Red phase:
corepack pnpm exec playwright test tests/e2e/context-menu.spec.tsfailed twice withpopupCount: 0before the production change.- A temporary targeted probe reported zero
context-menulisteners on the primarywebContents; the probe was removed before completion. corepack pnpm exec vitest run tests/unit/context-menu.test.tsfailed to resolve the absent Main module before implementation.
- Green phase:
corepack pnpm exec vitest run tests/unit/context-menu.test.ts— 5 passed.corepack pnpm exec playwright test tests/e2e/context-menu.spec.ts— 1 passed, covering both Code and Design textareas with two observed native popups.corepack pnpm run typecheck— passed.corepack pnpm exec eslint electron/main/context-menu.ts electron/main/index.ts tests/unit/context-menu.test.ts tests/e2e/context-menu.spec.ts— passed.corepack pnpm run lint:check— passed with 5 pre-existing warnings in untouched files and no errors.corepack pnpm run build:vite— passed for Renderer, Main, Preload, and release utility bundles; only existing chunk/dynamic-import warnings were reported.corepack pnpm test— 226 test files passed; one unrelated real-process timing assertion inpi-agent-server-process-real.test.tsmeasured 2323ms against a 2000ms threshold. Its isolated rerun withcorepack pnpm exec vitest run tests/unit/pi-agent-server-process-real.test.ts --maxWorkers=1passed all 6 tests, so no unrelated timing code or threshold was changed.git diff --check— passed.
Follow-ups
- Integrate this ready branch through the project Integration Gate after the
current owner of the root
mainworktree releases it.
Promotion Candidates
- None recorded.