Skip to content

agent-console 1.1.0: QA fixes, refreshed UI and icon, self-heal after a plugin host restart - #569

Open
qingnian108 wants to merge 1 commit into
magpie-community:mainfrom
qingnian108:agent-console-1.1
Open

qingnian108 wants to merge 1 commit into
magpie-community:mainfrom
qingnian108:agent-console-1.1

Conversation

@qingnian108

Copy link
Copy Markdown
Contributor

Agent Console 1.1.0 — follow-up to #535.

Fixes (from a hands-on QA pass of 1.0.0 inside magpie)

  • ACP agents (OpenCode, Cursor, …): replies are persisted and survive a reload.
  • Settings: provider on/off toggles no longer snap back; args / idle-minutes inputs are editable and validated; the launch command is honoured for Claude Code and Codex; theme works inside magpie; settings are validated on save and load.
  • Composer: agents that can't steer show a hint and queue the message instead of claiming "steered"; permission modes are per agent; queued messages can be removed (new thread.queueRemove).
  • Codex: model list follows its own config when it points at another provider; file-change approval cards show the diff.
  • English/Chinese strings cleaned up; cost estimate hidden for non-Anthropic models; at most 3 idle agent processes kept alive; quieter port-retry log.
  • Self-heal after a plugin host restart: when magpie restarts the plugin host, the old daemon exits with it and the page used to be stuck on "127.0.0.1 refused to connect". The page now goes back through magpie's plugin page after ~5 s, picks up the fresh session.js and reconnects through the new gate. The token still only travels in the URL fragment; the Host check and WS hello auth are unchanged.

Look

  • Refined layout (shared 720px column, compact user bubble, merged agent/model chip), teal accent, new icon.
  • New card summary and README intro.

Tests

  • npm test in the package: 281 passed. npm run check, build, bun scripts/check.mjs: OK.
  • Verified live in magpie with Claude Code, OpenCode and Codex.

…l after a plugin host restart

- Settings: optimistic provider toggles, args/idle committed on blur with inline errors, theme follows Magpie, steer/default-mode hints
- Launch command/args honoured, plan/permission modes clamped per agent, ACP segments persisted, codex config/reasoning/fileChange mapping
- Queue: thread.queueRemove; turn-end duration fallback for ACP agents; localized daemon/http/ws errors and permission labels
- UI: 720px column, bubble/composer/sidebar/run pill restyle with teal accents (Magpie accent not inherited), dark mode kept
- Logo: chevron + chat bubble + teal underscore (icon.svg, magpie.icon, composer chip)
- Self-heal: session.js carries ts + heartbeat; gate passes a validated Magpie back-URL; the page goes back through Magpie's
  plugin page (ac_lost) to pick up the new gate when the host restarts; no open redirect, token stays in the fragment
- Host: first bind delayed (AGENT_CONSOLE_BIND_DELAY_MS), EADDRINUSE logged only after retries; daemon token printed only on a TTY
- Tests: test/v1/ac11.test.ts + manager/plugin-entry additions

@yetone yetone 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.

Thanks for this. I reviewed it at 117e06f. The self-heal works, but there are three problems to fix before it can merge.

What was run at 117e06f

Everything below ran on macOS (Node 22) in a fresh worktree:

  • npm ci --workspaces=false, then npm run check (tsc for the daemon and the web app): ok.
  • npx vitest run: 46 files, 281 passed, 17 skipped.
  • npm run verify:build: app/app.js, app.css, index.html and daemon/dist/main.js(.map) all rebuild byte-identical to what is committed.
  • bun scripts/check.mjs agent-console: ok.
  • A real self-heal run in a sandbox HOME, in Playwright Chromium and WebKit:
    • Setup: page/ was served under /_magpie/plugin/<token>/page/index.html with a stub bridge, and index.mjs's server() ran as the host.
    • Hard kill: the page reached the daemon in about 1.5s. I then SIGKILLed the host (session.js left behind) and started a new host. Both engines went back through the Magpie page and onto the new daemon about 5.3s after the kill, and stayed there.
    • Daemon crash: killing only the daemon (gate still up) also healed, in about 5.3s.
    • b in the fragment was the plugin page URL, as safeBackUrl expects.

The safeBackUrl checks, the key/token split and the "only rewrite session.js while it is ours" rule all look right.

Must fix

  1. Magpie's accent is thrown away and a teal palette is hard-coded.

    • Where: packages/agent-console/web/src/layout/applyMagpieTokens.ts:16-17 skips every token matching /accent/i, and packages/agent-console/web/src/styles/tokens.css:15-18 sets --accent: #0f766e / --accent-2: #14b8a6 and the rest of a fixed palette.
    • Reproduced: the stub bridge passed tokens: {"--accent": "#ff0000"}, and the page still drew its primary buttons ("New project") teal.
    • Why it matters: a page in magpie's window is meant to look like magpie, and boot.js's own comment says the tokens are passed "so that page matches magpie". magpie's UI is quiet, with no colourful accents of a plugin's own.
    • Fix: take the host's accent like the other tokens, and keep the teal only as the fallback for a standalone run (no tokens).
  2. registry.json drops what a user needs to know before installing.

    • Where: registry.json:167-170.
    • What was dropped: the earlier summary said the page runs a local daemon on 127.0.0.1, that the daemon starts when the page opens and stops with magpie, that only its own page gets the token, the ~46 MB cold install (node-pty), and that Claude Code is not bundled.
    • Why it matters: the new one-liner says none of this. The Plugins page shows this text, and for a page that starts a background service and runs agent CLIs, those lines are the disclosure.
    • Fix: keep them, en and zh, and shorten the wording if you like.
  3. The rewritten pickers are still native <select>.

    • Where: packages/agent-console/web/src/components/Composer.tsx:575 (effort), :594 (mode) and :603 (Cursor fast); packages/agent-console/web/src/components/Settings.tsx:162, 219, 224, 231, 237.
    • Why it matters: magpie's UI never uses a native select; dropdowns are an app menu. These were native before too. This PR rebuilt the Composer pickers into pill labels with an invisible <select class="ip-sel"> laid over them, so the macOS/GTK native popup still opens on click.
    • Fix: since they are being redone anyway, make them a menu of the page's own.

Smaller, not blocking on their own

  • EPIPE on every hard host kill. After the SIGKILL, the daemon's log line goes to stdout, a pipe whose reader is gone. It ends in uncaughtException ... write EPIPE from daemon/src/log.ts:43, and plugin host closed the lifeline is logged twice, because daemon/src/main.ts:183-184 handles both end and close. Seen in daemon-.log in both runs. Ignore EPIPE on stdout and run lifelineClosed once.
  • session.js is rewritten every 4s for as long as magpie runs. This happens from the moment the gate binds (index.mjs beat, SESSION_BEAT_MS), whether or not the page is ever opened. That is fine for correctness. Worth a thought whether the beat could start on the first /open, or run less often, since boot only needs "newer than 12s / newer than ac_lost".

Not tried: magpie's real sandboxed frame, a real plugin host restart from magpie, Windows and Linux.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants