Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): clear stale chat action shortcuts #15394

Mergedmaria-rcksmerged 1 commit intomain fromrefs/pull/15394/headmerged by maria-rcks View on GitHub

maria-rckscommented

problem

changing a chat action shortcut appended another rule; clearing it or deleting the action left its rules active. the editor now replaces the shortcut and removes accumulated action-generated rules on clear/delete.

closes #5687.

change

mutation targets come from the action's environment. deletion preserves shortcuts for action ids retained in defaults or another project, and adding an action without a shortcut preserves an existing shared binding.

scope and approval

this uses the focused obvious-bug exception: one chat editor persistence defect, fixed with existing mutation apis and settings retention behavior. #5687 remains labeled needs-triage; its comments contain no maintainer approval. only ChatView.tsx changes, with the electron guard preserved.

verification

  • native linux electron baseline 00eb8f6183: assign 8, change to 9, clear, reassign, delete. keybindings.json retained both generated rules; the cleared editor reopened showing 9, and both shortcuts ran the real printf action after clearing.
  • candidate a33c08a01b: adding 8 cleaned the stale 8/9 rules; changing to 9 left only 9, which executed the action while 8 sent no terminal command. clearing reopened a blank field and neither key sent a terminal command; reassigning 8 and deleting left no action rules. the old 8 key can fall through to the composer's existing task-list shortcut. historical terminal output remains visible in the recording.
  • real ui checks also preserved shared 7 when adding a same-id action without a shortcut and deleting it from another project. an independent native desktop replay confirmed assign/change/clear/reopen/delete and unrelated bindings remaining intact.
  • blacksmith: all 37 tests passed in apps/server/src/keybindings.test.ts, apps/web/src/lib/projectScriptKeybindings.test.ts, and apps/web/src/components/projectScriptEditor.test.tsx. web typecheck, scoped lint (0 errors, same 81 warnings as baseline), formatting, and git diff --check passed.
  • unverified: shared-default deletion (no reachable default-action editor or existing defaults in this build), macos/windows desktop, and remote connections. the default-retention guard was checked in source. manually authored conditional/alias rules remain outside this fix; the existing raw-string matching limitation for aliases such as cmd+k is confirmed and deferred. web/mobile behavior retains the existing electron guard; providers and contracts are unchanged.

before: cleared action editor still shows shortcut 9

after: cleared action editor reopens with a blank shortcut

before: native electron reproduces stale shortcuts after change, clear, and delete.

after: native electron replaces and removes action shortcuts; old terminal output is retained.

model: gpt-6.1-sol; harness: codex in t3 code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. apps/web/src/components/ChatView.tsx line 4865Resolvedby maria-rcks
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at a33c08a

      Macroscope's review found this PR approvable — This is a focused Electron-only persistence fix that cleans up stale action shortcuts without changing schemas or unrelated runtime paths. A High-severity alias-handling issue remains: some persisted shortcuts may not be removed or replaced because canonicalized keys do not match the raw server key.

      Notes:

      • This verdict was updated automatically after the outstanding correctness findings were resolved. Macroscope did not re-review the code.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 70f1fd98-869a-4dcf-9b3b-f9588241ce3c
      📥 Commits

      Reviewing files that changed from the base of the PR and between 5108c978b1d9a8bd029e5ea96781d8cbc90b3877 and a33c08a01bcb91cbaea7da5c39856e72769c3513.

      📒 Files selected for processing (1)
      • apps/web/src/components/ChatView.tsx

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


      📝 Walkthrough

      Walkthrough

      Project script saves now synchronize keybindings in Electron. The synchronization removes obsolete bindings when a script no longer uses a keybinding and replaces prior bindings when a new rule uses a different key.

      Changes

      Project script keybindings

      Layer / File(s)Summary
      Synchronize project script keybindings
      apps/web/src/components/ChatView.tsx
      After project settings save, Electron checks whether the script remains in default scripts or another project. It removes obsolete unscoped bindings and upserts the new rule when present. Non-Electron runtimes skip keybinding synchronization.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: t3dotgg, juliusmarminge

      Merge Risk: ⚪ Minimal · up to a33c0

      The reviewed shortcut changes are ready to merge after normal checks; no actionable stale-binding regression was established.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to a33c0

      Shortcut cleanup stays within the selected environment and preserves existing script-execution checks. The main remaining risk is that concurrent project changes can invalidate the shared-binding retention decision.

      Retained concerns

      • Low · reliability · inferred: The new removal path decides whether another project retains a script using captured settings and project snapshots. A concurrent same-ID addition in another project can occur after that snapshot, allowing cleanup to remove a shortcut that the other project now shares. Per-command serialization and atomic keybinding writes do not serialize the complete ownership-check and reconciliation transition. Known owners are protected, but concurrent ownership changes are not revalidated.
      Security review details

      Security Blast Radius

      • inferred — The newly destructive operation can affect unscoped shortcuts for the same script command across projects sharing one environment. The inspected call sites do not select another environment or grant additional execution privileges.

      Trust Boundaries and Controls

      • observed — The unchanged keyboard path resolves a command, requires an active project, and requires the script ID to exist in that project’s active script list before execution. Shortcut reconciliation does not replace this membership check or introduce a new execution sink.

      Resilience and Maintainability Implications

      • inferred — A failed clear can leave a binding executable because the script remains configured. After deletion, refreshed project membership blocks that script, although refresh timing was not established. These residual-binding conditions predate the PR; successful cleanup reduces them, while the new concurrent ownership risk concerns cross-project shortcut loss rather than demonstrated privilege escalation.
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedIssue [#5687] requires clearing, changing, or deleting an action to remove stale generated-command keybindings. In ChatView.tsx, the mutation reads bindings from the action's environment, removes ob…
      Out of Scope Changes check✅ PassedThe diff changes only ChatView.tsx. The keybinding cleanup and retention checks directly support issue [#5687]. No unrelated changes are present in the reviewed diff.
      Title check✅ PassedThe title clearly identifies the fix for stale chat action shortcuts.
      Description check✅ PassedThe description covers the problem, change, scope and approval rationale, and verification. It also lists unverified environments and includes before-and-after evidence.
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    5. maria-rcks merged this2d81e4c

    6. maria-rcks closed this

Sign in to join this conversation.