Skip to content

fix(ai): prime echo suppression before agent input to stop OpenWrt ash variable leak - #3385

Merged
binaricat merged 2 commits into
mainfrom
ai/issue-3384-34799373180
Sep 18, 2026
Merged

binaricat merged 2 commits into
mainfrom
ai/issue-3384-34799373180

Conversation

@netcatty-bot

@netcatty-bot netcatty-bot commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prime terminal display suppression before typing an AI command or live-shell probe, so wrapped internal input can be hidden before its first shell-side marker executes. Keep main-process prime and cancellation-reset markers on the same ordered output path as the actual PTY data.

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Build / CI change
  • Other (please describe):

Related Issue (optional)

Related to #3384

Changes Made

  • Add an exception-safe, optional display-prime callback before the first typed byte in startPtyJob, used by Catty, MCP exec/jobs, and terminal-worker exec/jobs.
  • Deliver main-process prime and reset markers through emitTerminalSessionData, preserving order with PTY output on both the dedicated port and IPC fallback. Worker messages already use the worker output routing path.
  • Cover wrapped echo filtering, first-byte ordering, callback failure, all three main-process execution entry points, port/fallback delivery, and cancellation reset.
  • Add opt-in OpenWrt SSH-to-preload display coverage using NETCATTY_OPENWRT_SSH_PORT.

Screenshots / Demo

No layout changes. Real isolated OpenWrt 24.10.6 Dropbear sessions retain visible-output and suppress internal wrapper text at 80/120 columns, with live-shell probing enabled and disabled.

Evidence boundary: the report screenshot shows ImmortalWrt 25.12.0 / BusyBox 1.37 and a continuation prompt. This environment was not reproduced. An unprimed negative control on our OpenWrt image did not leak text, so real-device compatibility must not be presented as proof of the reporter's exact cause. The fragmented-echo scenario is reproduced by the preload test. The independent output-transport defect is demonstrated directly: the new entry-point regression suite fails 3 port cases on the previous PR head and passes all 6 cases after this fix.

Testing

  • I have tested these changes locally (npm run dev)
  • Linting passes (ESLint on all changed JavaScript files)
  • Tests pass (npm test)
  • Generated capability tool specs are updated when applicable (npm run generate:capability-tools) — not applicable
  • No new console errors or warnings, if this affects app behavior

Bounded local validation instead of the full suite on the shared machine:

  • PTY execution, history, paced timeouts, live-shell probes, worker execution, Catty/MCP handlers, emitter, preload display and terminal output-port tests passed.
  • Real OpenWrt Dropbear command test passed; real SSH-to-preload display test passed in four configurations.
  • Six ordered-delivery/cancellation regressions passed; before-fix control fails the three dedicated-port cases.
  • git diff --check and changed-file ESLint passed.
  • Two independent local reviewers reported CLEAN on the final scoped changes.

Checklist

  • My code follows the existing project style
  • I have added or updated relevant documentation (evidence and validation above)
  • I have not introduced any breaking changes (or I have described them above)

@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-loop Own/bot PR waiting on Codex review↔fix loop triage Touched by Cursor automation labels Sep 14, 2026
@binaricat

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T04:20:19.520149Z 9c6c99c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 990bb791a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review September 14, 2026 03:07
@netcatty-bot netcatty-bot added automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Sep 14, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator Author

Codex reported no major issues. This PR is marked ready for human review/merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 990bb791a7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread electron/bridges/aiBridge/cattyExecHandlers.cjs Outdated
@netcatty-bot
netcatty-bot marked this pull request as draft September 14, 2026 09:20
@netcatty-bot netcatty-bot removed the automation:codex-clean Last Codex review reported clean label Sep 14, 2026
@netcatty-bot
netcatty-bot marked this pull request as ready for review September 14, 2026 09:27
@netcatty-bot netcatty-bot added the automation:codex-clean Last Codex review reported clean label Sep 14, 2026
@binaricat

Copy link
Copy Markdown
Owner

@codex review

Please review current head 9c6c99c. The output-channel ordering finding is fixed for both main-process entry paths, including cancellation reset. Six entry-point regressions pass; the three port cases fail against the prior head. Two independent local reviewers have checked the updated change. Real isolated OpenWrt SSH/preload compatibility passes; the PR description explicitly distinguishes this from reproducing the reporter's ImmortalWrt environment.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 9c6c99c584

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@binaricat binaricat added automation:codex-loop Own/bot PR waiting on Codex review↔fix loop and removed automation:codex-clean Last Codex review reported clean labels Sep 18, 2026
@binaricat

Copy link
Copy Markdown
Owner

@codex review

@binaricat
binaricat marked this pull request as draft September 18, 2026 04:17
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 9c6c99c584

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review September 18, 2026 04:20
@netcatty-bot netcatty-bot added automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Sep 18, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator Author

Codex reported no major issues. This PR is marked ready for human review/merge.

@binaricat
binaricat merged commit dffcefc into main Sep 18, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean triage Touched by Cursor automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants