Skip to content

WIP: feat(ai-native): harden ACP task startup and error recovery - #4769

Open
lulusir wants to merge 37 commits into
mainfrom
codex/improve-acp-error-message
Open

lulusir wants to merge 37 commits into
mainfrom
codex/improve-acp-error-message

Conversation

@lulusir

@lulusir lulusir commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Types

  • 🎉 New Features
  • 🐛 Bug Fixes
  • 📚 Documentation Changes
  • ⏱ Tests

Background or solution

Agentic task startup previously had several lifecycle and usability gaps around ACP process capacity:

  • background warmup could race with foreground task launches
  • failed or cancelled launches could leave temporary sessions or consume capacity
  • capacity exhaustion and slow startup lacked clear recovery behavior
  • generic OpenCode service and model errors were not actionable
  • Agent Task project and status guidance contained hard-coded English text

This PR introduces bounded ACP standby capacity managed by the Node-side process pool. It keeps at most one compatible standby process within the configured limit while always prioritizing foreground task launches. Failed or cancelled launches release temporary resources and preserve the task draft and unsent prompt for retry.

It also improves ACP error normalization by:

  • converting OpenCode service failures into retry and new-session guidance
  • displaying only bounded service diagnostics
  • identifying unavailable models and suggesting that the user select another model
  • retaining the original message, error code, metadata, and cause for diagnostics

Agent Task project management, task statuses, dialogs, tooltips, accessibility labels, and recovery messages are now localized in English and Chinese.

Unit, BDD, mock-agent, and Playwright coverage has been added for capacity handling, cancellation, cleanup, error guidance, and recovery.

Verification performed:

  • node --check test/bdd/fixtures/acp-agent/mock-acp-agent.mjs
  • yarn workspace @opensumi/playwright build
  • Prettier and ESLint through lint-staged
  • git diff --check

Full browser E2E execution was not run.

Changelog

  • Added bounded ACP standby process management for faster Agent Task startup.
  • Improved cleanup and draft recovery when task startup fails or is cancelled.
  • Added actionable guidance for OpenCode service failures and unavailable models.
  • Added English and Chinese localization for Agent Task project and status guidance.
  • Expanded automated coverage for ACP capacity, error, and recovery behavior.

@codecov

codecov Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.60172% with 201 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.68%. Comparing base (9fee6aa) to head (4b36528).

Files with missing lines Patch % Lines
...tive/src/browser/chat/chat.internal.service.acp.ts 74.70% 70 Missing and 17 partials ⚠️
packages/ai-native/src/node/acp/acp-thread.ts 80.64% 19 Missing and 5 partials ⚠️
...ckages/ai-native/src/node/acp/acp-agent.service.ts 91.84% 22 Missing and 1 partial ⚠️
...e/src/browser/acp/agentic-task-registry.service.ts 70.27% 19 Missing and 3 partials ⚠️
...ative/src/browser/chat/chat-manager.service.acp.ts 89.90% 17 Missing and 4 partials ⚠️
...ai-native/src/browser/chat/acp-session-provider.ts 95.00% 7 Missing ⚠️
...i-native/src/browser/chat/acp-chat-queued-turns.ts 93.33% 4 Missing ⚠️
...rc/browser/chat/agentic-conversation-view-model.ts 94.20% 4 Missing ⚠️
...ai-native/src/browser/chat/chat-manager.service.ts 25.00% 1 Missing and 2 partials ⚠️
...ges/ai-native/src/node/acp/acp-cli-back.service.ts 90.32% 2 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4769      +/-   ##
==========================================
+ Coverage   55.40%   55.68%   +0.27%     
==========================================
  Files        1762     1763       +1     
  Lines      114271   115327    +1056     
  Branches    25547    25899     +352     
==========================================
+ Hits        63313    64220     +907     
- Misses      42216    42342     +126     
- Partials     8742     8765      +23     
Flag Coverage Δ
jsdom 48.70% <55.73%> (+0.03%) ⬆️
node 14.00% <29.94%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lulusir lulusir changed the title WIP: Codex/improve acp error message WIP: feat(ai-native): harden ACP task startup and error recovery Jul 29, 2026
@opensumi opensumi Bot added 🎨 feature feature required 🐞 bug Something isn't working labels Jul 29, 2026
@lulusir

lulusir commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1786069412.0

@lulusir

lulusir commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1787197346.0

@CLAassistant

CLAassistant commented Aug 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@lulusir
lulusir force-pushed the codex/improve-acp-error-message branch from 40cedb8 to f72da1d Compare August 21, 2026 07:54
@lulusir

lulusir commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1787303337.0

@lulusir

lulusir commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1787646115.0

@lulusir

lulusir commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1788150617.0

Update stale side-entry and lifecycle expectations.

Wait for prompt acceptance and discovery convergence.
Retain submitted prompts in thread replay history.

Suppress matching Agent echoes to avoid duplicate user rows.
@lulusir

lulusir commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1788253557.0

Strip the reserved WebMCP usage hint from restored user turns.

Keep the Agent prompt enrichment unchanged.
@lulusir

lulusir commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1788263965.0

…ws from stacking

Loading a long historical ACP session froze the main thread for tens of
seconds and the restored assistant rows visually stacked over each other.

Freeze (profiled via DevTools trace, ~30s scripting):
- react-highlight never sets a language- class, so highlight.js ran
  auto-detection over every full-size tool argument/result block at mount.
  Oversized blocks now render as plain text; sized blocks highlight with an
  explicit language (plaintext fallback).
- every code block mount fired a leading-edge scrollIntoViewIfNeeded during
  the React commit (7s of forced layout). Restored blocks skip the mount
  scroll; streaming updates still follow output.
- the attach snapshot rebuilt the whole ChatModel and remounted every row
  even when the transcript was identical. restoreLoadedSession now skips
  replacement when message ids match.

Stacking (geometry verified in a headless Chromium loop):
- createMessageByAI/User clobbered an object-passed className with the
  undefined second argument, so chat_with_more_actions never reached the
  DOM and the absolutely positioned action bar (bottom: -40px) painted over
  the next message row. Propagate the object className and reserve an
  in-flow strip (thinking_container padding, bar at bottom: 0).
- also adds the message/thinking-result copy actions and a 20px top margin
  for assistant rows in the chat panel.
@lulusir

lulusir commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1789996105.0

@lulusir

lulusir commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1790001292.0

TUI programs running inside the terminal (opencode, vim, tmux etc.) set
the clipboard by emitting OSC 52 sequences. xterm.js core does not
register a handler for this identifier, so the sequence was silently
dropped. In web/remote scenarios the native command fallback (osascript,
xclip...) writes the clipboard of the machine hosting the backend
instead of the user's browser clipboard, leaving copy features broken.

Register an OSC 52 handler on each XTerm instance, decode the base64
payload as UTF-8 and write it through IClipboardService. Query
sequences (payload '?') and malformed payloads are ignored without
affecting normal terminal output.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working 🎨 feature feature required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants