Skip to content

fix(ui): reopen closed web terminals with a fresh screen#100665

Merged
steipete merged 1 commit into
mainfrom
codex/web-terminal-close-reset
Jul 6, 2026
Merged

fix(ui): reopen closed web terminals with a fresh screen#100665
steipete merged 1 commit into
mainfrom
codex/web-terminal-close-reset

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Related upstream defect: coder/ghostty-web#141

Upstream fix: coder/ghostty-web#142

What Problem This Solves

Fixes an issue where users who closed the final Control UI terminal tab with its X button could see the disposed terminal's old content when opening the terminal again.

Why This Change Was Made

The pinned ghostty-web runtime can reuse unzeroed WASM pages after a terminal is disposed. The Control UI now gives each terminal tab an isolated Ghostty runtime, preserving the existing Gateway session close/open lifecycle while preventing freed renderer memory from reaching the next tab.

User Impact

Closing the final web terminal tab now fully resets its browser terminal state. Reopening starts with a new shell and blank terminal instead of old screen content.

Evidence

  • Live existing-profile Chrome reproduction: wrote a unique sentinel, closed the final tab with X, reopened Terminal, and observed the sentinel return. Gateway logs showed reopening created a new PTY/session, isolating the defect to browser renderer memory reuse.
  • ui/src/components/terminal/terminal-panel.test.ts: 3 focused lifecycle tests pass, including close RPC, controller disposal, cleared persisted tabs, a new terminal.open, and no stale reattach.
  • ui/src/e2e/terminal-runtime.e2e.test.ts: real Chromium/WASM regression passes; a second isolated runtime starts blank after the first runtime writes content and is disposed.
  • pnpm check:changed -- CHANGELOG.md pnpm-lock.yaml ui/package.json ui/src/components/terminal/terminal-panel.test.ts ui/src/components/terminal/terminal-panel.ts ui/src/components/terminal/terminal-runtime.ts ui/src/e2e/terminal-runtime.e2e.test.ts: passed on Blacksmith Testbox.
  • pnpm build: passed on Blacksmith Testbox, including the production Control UI Vite bundle and ghostty-web chunk.
  • Fresh structured autoreview: no actionable findings; patch judged correct.
  • Upstream coder/ghostty-web#142 independently documents the same freed-page stale-cell and later-write corruption defect.

AI-assisted; implementation understood and reviewed. No agent transcript attached.

@steipete
steipete requested a review from a team as a code owner July 6, 2026 06:17
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • pnpm-lock.yaml
  • ui/package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 101fef674e433f6a3ba75aa25327c5959379b7b1
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Jul 6, 2026

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

Copy link
Copy Markdown
Contributor

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: 101fef674e

ℹ️ 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".

Comment thread CHANGELOG.md
### Fixes

- **Small-context compaction:** cap the effective reserve against the known model context window so small local models do not enter compaction from the first token. (#100621) Thanks @vincentkoc.
- **Control UI terminal reset:** isolate each web terminal's Ghostty WASM runtime so closing a tab and reopening starts with an empty screen instead of reusing freed terminal cells.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Remove the manual changelog entry

Root AGENTS.md says CHANGELOG.md is release-only and must not be edited for normal PRs or direct main fixes; release-note context should live in the PR body, squash message, or direct commit. This is a normal Control UI fix and the commit message already carries that context, so keeping this manual entry creates release-generation drift/conflicts before the next generated release. Please remove it from the patch.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(ui): reopen closed web terminals with a fresh screen This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 101fef674e433f6a3ba75aa25327c5959379b7b1:

  • Live before/after scope: existing-profile Chrome reproduced stale screen content after close/reopen while Gateway logs proved a new PTY was opened; the regression now exercises isolated renderer recreation in real Chromium/WASM.
  • Blacksmith Testbox tbx_01kwtz2888769pjzyz7qtpjr9b (swift-crayfish):
    • pnpm test ui/src/components/terminal/terminal-panel.test.ts — 3 passed.
    • pnpm test ui/src/e2e/terminal-runtime.e2e.test.ts — 1 passed in real Chromium/WASM.
    • pnpm tsgo:test:ui plus targeted scripts/run-oxlint.mjs — passed.
    • pnpm check:changed -- CHANGELOG.md pnpm-lock.yaml ui/package.json ui/src/components/terminal/terminal-panel.test.ts ui/src/components/terminal/terminal-panel.ts ui/src/components/terminal/terminal-runtime.ts ui/src/e2e/terminal-runtime.e2e.test.ts — passed.
    • pnpm build — passed, including the production Control UI Vite bundle.
  • Fresh structured autoreview: no actionable findings; patch judged correct.
  • Hosted exact-head CI: https://github.com/openclaw/openclaw/actions/runs/28771890201
  • Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 100665: passed with exact-head hosted gates; prepared head matches PR head.
  • Known proof gaps: none.

@steipete
steipete merged commit 6e71b0b into main Jul 6, 2026
150 of 153 checks passed
@steipete
steipete deleted the codex/web-terminal-close-reset branch July 6, 2026 06:42
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to zhangqueping/openclaw that referenced this pull request Jul 6, 2026
* origin/main: (1287 commits)
  fix(android): block loopback canvas navigation (openclaw#99874)
  fix(hooks): suppress unhandled stdout/stderr stream errors in gmail watcher (openclaw#100519)
  fix(memory-core): guard qmd mcporter JSON.parse against non-JSON stdout (openclaw#98381)
  fix(build): fall back to tsx for build TypeScript scripts (openclaw#91262)
  feat(skills): suggest saving detected reusable workflows by default (openclaw#95477) (openclaw#100692)
  docs(changelog): remove generated release-note entries
  feat(telegram): offer BotFather web app flow in setup help and docs (openclaw#100540)
  fix(ios): unify Talk and Settings row typography on one branded detail row (openclaw#100515)
  feat(gateway): add persisted crash-loop breaker and fatal-config exit contract
  refactor(macos): lock and unify PortGuardian tunnel record persistence so concurrent app instances cannot lose orphan records (openclaw#100601)
  fix: stop reconnecting on protocol mismatch (openclaw#98414)
  fix(maint): reuse recent hosted gates after rebase (openclaw#100663)
  fix(ui): reopen web terminals without stale content (openclaw#100665)
  fix(browser): diagnose empty WSL2 Chrome replies (openclaw#100590)
  fix(ios): chat snaps back to bottom when scrolling to top via status-bar tap (openclaw#100502)
  Treat already-compacted CLI compaction as no-op (openclaw#99136)
  docs(changelog): remove direct main fix entry
  fix(feishu): strip internal tool-trace banners from outbound text (openclaw#98705)
  fix(message): thread --limit through to CLI formatter and surface provider pagination hints (openclaw#99089)
  fix(voyage): close response body stream when batch output JSONL parsing throws (openclaw#98840)
  ...

# Conflicts:
#	extensions/memory-wiki/package.json
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui dependencies-changed PR changes dependency-related files maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant