feat(workers): the ai-agent CLI back on workers (any harness) + worker picks by name #33
Open
gabrielvidal
wants to merge 0 commits from
worker-names into main
pull from: worker-names
merge into: gabrielvidal:main
gabrielvidal:main
gabrielvidal:fresh-context-plugin
gabrielvidal:remove-hooks-page
gabrielvidal:palette-plugins
gabrielvidal:linear-projects
gabrielvidal:agent-messaging
gabrielvidal:model-router
gabrielvidal:conv-card-layout
gabrielvidal:ask-more-options
gabrielvidal:agent-limits
gabrielvidal:generic-ui-strings
gabrielvidal:android-push-bridge
gabrielvidal:auto-translate
gabrielvidal:filter-chips
gabrielvidal:plugin-catalog
gabrielvidal:file-viewers
gabrielvidal:plugins-page-rework
gabrielvidal:hub-mcp-plugin
gabrielvidal:translation-plugin
gabrielvidal:scheduled-doors
gabrielvidal:cron-jobs-plugin
gabrielvidal:context-skills-plugin
gabrielvidal:files-plugins
gabrielvidal:details-panel-perf
gabrielvidal:services-plugin-only
gabrielvidal:fix-test-env-leaks
gabrielvidal:bg-shells-plugin
gabrielvidal:feat-commits-plugins
gabrielvidal:fix-branch-line-tag-rows
gabrielvidal:retire-dead-leftovers
gabrielvidal:runner-into-harness-pi
gabrielvidal:retire-tool-proxy
gabrielvidal:new-project-policy-plugin-only
gabrielvidal:guest-jobs-sonnet
gabrielvidal:push-buttons-everywhere
gabrielvidal:mail-send-plugin
gabrielvidal:ui-polish-batch
gabrielvidal:command-palette-plugin
gabrielvidal:keyboard-shortcuts-plugin
gabrielvidal:prompt-shortcuts-plugin
gabrielvidal:matomo-site-grants
gabrielvidal:lab-chrome-plugin
gabrielvidal:performance-plugin
gabrielvidal:whats-new-plugin
gabrielvidal:skills-agents-plugin
gabrielvidal:goals-plugin-only
gabrielvidal:storage-server-side
gabrielvidal:plugin-scheduled-conversations
gabrielvidal:plugin-fences
gabrielvidal:handoff-plugin
gabrielvidal:plugin-commands
gabrielvidal:plugin-speed
gabrielvidal:cleanup-provider-harness
gabrielvidal:plugin-conversation-labels
gabrielvidal:plugin-plan-usage
gabrielvidal:fix-worker-harness-sync
gabrielvidal:plugin-gcloud-reauth
gabrielvidal:feat/plugin-cards-in-thread
gabrielvidal:feat/plugin-proxy-wake
gabrielvidal:unify-subagents-children
gabrielvidal:wave3d-frontend-typed-plugins
gabrielvidal:wave3c-sidecar-strict-plugins
gabrielvidal:wave3a-catalog-accounts-profiles
gabrielvidal:wave3b-pricing-usage-cutover
gabrielvidal:wave1a-typed-plugins
gabrielvidal:wave1b-sidecar-runtime
gabrielvidal:fix-ios-overlay-scroll
gabrielvidal:batch2-work-resources-core
gabrielvidal:batch2-apikeys
gabrielvidal:plugin-blue-green-deploy
gabrielvidal:plugin-ship
gabrielvidal:plugin-project-env
gabrielvidal:plugin-memories
gabrielvidal:plugin-activity
gabrielvidal:plugin-templates
gabrielvidal:plugin-desk-phone
gabrielvidal:batch1-platform
gabrielvidal:plugins-list-view
gabrielvidal:dash-plugins
gabrielvidal:pets-plugin
gabrielvidal:ha-push-channel
gabrielvidal:mail-agents
gabrielvidal:graph-fix
gabrielvidal:graph-plugin
gabrielvidal:services-plugin
gabrielvidal:left-to-do-plugin
gabrielvidal:plugins-gallery
gabrielvidal:home-conv-menu
gabrielvidal:meta-business
gabrielvidal:agy-rdrand
gabrielvidal:bg-lag
gabrielvidal:conv-load-perf
gabrielvidal:askform-instant
gabrielvidal:fix/drawer-menu-done-chip
gabrielvidal:pi-midrun-compaction
gabrielvidal:interrupt-menu-btn
gabrielvidal:authz
gabrielvidal:inkling
gabrielvidal:repo-plugins
gabrielvidal:work-sync
gabrielvidal:leftovers
gabrielvidal:fix/agy-guest-guard
gabrielvidal:feat/model-presets
gabrielvidal:scroll-back
gabrielvidal:feedback-bell
gabrielvidal:feat/movies-tool
gabrielvidal:feat/running-thread-padding
gabrielvidal:feat/drawer-filter-button-card-chat
gabrielvidal:burn-rate
gabrielvidal:guest-install
gabrielvidal:guest-usage
gabrielvidal:guest-palette
gabrielvidal:guest-form-links
gabrielvidal:form-open-buttons
gabrielvidal:clarifier-lean
gabrielvidal:auto-archive
gabrielvidal:guests-profile
gabrielvidal:conv-motion
gabrielvidal:share-target
gabrielvidal:terminal-sync
gabrielvidal:work-context-past
gabrielvidal:work-context-brief
gabrielvidal:enroll-codes
gabrielvidal:open-image-file
gabrielvidal:worker-uploads
gabrielvidal:conv-drawer-search
gabrielvidal:stack-motion-v3
gabrielvidal:notif-stack-fixes
gabrielvidal:home-motion
gabrielvidal:i18n-fr
gabrielvidal:local-electricity-cost
gabrielvidal:cache-pill-thread
gabrielvidal:cache-scenarios
gabrielvidal:fresh-start
gabrielvidal:msg-select
gabrielvidal:shortcuts-setup
gabrielvidal:ui-0-40-3
gabrielvidal:outbox-landing
gabrielvidal:resume-scope
gabrielvidal:conv-filter-range
gabrielvidal:fix-subagent-form-session
gabrielvidal:ask-form-integration
gabrielvidal:form-visual-options
gabrielvidal:watcher-perf
gabrielvidal:last-msg-summary
gabrielvidal:secret-fields
gabrielvidal:commit-review
gabrielvidal:summary-mode-fixes
gabrielvidal:service-tag-parser
gabrielvidal:clarifier
gabrielvidal:fetch-diet-2
gabrielvidal:fetch-diet
gabrielvidal:conv-look
gabrielvidal:pwa-links
gabrielvidal:tool-widgets
gabrielvidal:worker-autoupdate
gabrielvidal:usage-rings
gabrielvidal:opencode-harness
gabrielvidal:notif-diet
gabrielvidal:conv-resources
gabrielvidal:scheduled-tasks
gabrielvidal:profiles
gabrielvidal:notify-exact-cost
gabrielvidal:usage-measuring
gabrielvidal:guest-projects
gabrielvidal:usage-calibration
gabrielvidal:account-switch
gabrielvidal:multiuser-improve
gabrielvidal:form-groups
gabrielvidal:multiuser
gabrielvidal:motion-reel
gabrielvidal:dashboards-fixes
gabrielvidal:split-big-files
gabrielvidal:held-regex
gabrielvidal:subagent-interrupts
gabrielvidal:form-html
gabrielvidal:tokunia-video
gabrielvidal:settings-uniform
gabrielvidal:worker-ask-fix
gabrielvidal:worker-generic-mac
gabrielvidal:runner-shortcuts
gabrielvidal:notify-unify
gabrielvidal:perf-list-cache
gabrielvidal:mac-worker
gabrielvidal:model-switch
gabrielvidal:pipeline-paths
gabrielvidal:multi-account
gabrielvidal:feature-flags
gabrielvidal:qwen38-support
gabrielvidal:url-prompt
gabrielvidal:running-pages
gabrielvidal:homelab-tag
gabrielvidal:root-project
gabrielvidal:or-models
gabrielvidal:deploying-loader
gabrielvidal:worktree-diff
gabrielvidal:conv-tags
gabrielvidal:tags-page
gabrielvidal:agents-page
gabrielvidal:icon-picker-shortcuts
gabrielvidal:conv-cta
gabrielvidal:stamp-refine
gabrielvidal:post-task-cache
gabrielvidal:post-tidy-completed
gabrielvidal:form-badge
gabrielvidal:hooks-delay-seconds
gabrielvidal:cost-dashboard
gabrielvidal:plan-forms
gabrielvidal:form-mobile
gabrielvidal:guidelines-dag
gabrielvidal:skills-view
gabrielvidal:navbar-hold
gabrielvidal:spawnbox-status
gabrielvidal:hold-editable-expand
gabrielvidal:drawer-transparent
gabrielvidal:hold-fix
gabrielvidal:hold-editable
gabrielvidal:charroll-bump
No Reviewers
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
gabrielvidal (Gabriel Vidal)
Clear assignees
No Assignees
gabrielvidal
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gabrielvidal/ai-agent#33
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Agents on a worker can drive the hub with the
ai-agentCLI again, in any harness, through the worker's outbox. Worker picks now take a name as well as an id.On 2026-11-28 an agy run on the EVOX2 (2ca176fc) could not start a conversation. Since 2026-11-18 a worker's CLI only did
past, and its replacement, the worker-bound MCP, only existed in Claude Code. So the run shelled out to threeclaude -p --model haikurelays to callstart_conversation:worker='EVOX2'and gothub: unknown worker: 'EVOX2' (HTTP 400), because the hub took ids only;wait_for_conversationfor more than 10 minutes.A second agy run (25c32ca5) gave up on delegating. Gabriel's call was to bring the CLI back on workers and keep the MCP in core.
Key changes
backend/workers/picks.py(new) turns any pick into a runner:local,labandhomelabmean the lab;An unknown pick is a 400
worker_unknownthat lists the valid ids and names (pluschoices). Used byroute_new_run(spawns, cron fires, the plugin runs bridge), the cron routes (a job pinned by name stores the id),workers/bound.pypin_workerandplugins/hubruns.py.The CLI through the outbox (the 2026-11-16 path, rebuilt on today's code):
cli/ai_agent.pysendsWORKER_COMMANDSto the outbox as acliitem{argv, sessionId}and prints what the hub's run printed. That run sendsX-AIA-As-WorkerandX-AIA-As-Worker-Mode.backend/workers/cli.pyCliJobsruns the same CLI in a clean env: the host token, the worker id, its switch as the mode, andCLAUDE_SESSION_IDset to the sending session. That session becomes the parent of what it starts, so children nest under it and report back with no polling.workers/bound.pyworker_caller, the same caller a worker-bound MCP connection gets (worker.read/worker.runscopes).The per-worker switch:
workers.jsoncli:off,readorrun; unset meansrun, and a guest's computer is alwaysoff;/api/workers/{id}{cli};WorkerCli.tsx), with French strings.Sidecar and installer:
sidecar/outbox.pyaccepts theclikind again and drops its output 10 min after it ends;outbox_mirroranswers it;worker/install.shwrites theai-agentterminal shim again.The other changes:
past'slookupfollows the switch.workerargument and--onhelp say "id or name, or 'lab'".Docs:
CLAUDE.md,docs/mcp.md("On a worker") andworker/README.md.Key decisions
The CLI rather than the MCP for agents on workers (Gabriel, notify-ask "CLI back on workers"):
Removing the CLI everywhere was rejected: 16 skill and plugin folders call it, it is the guest broker, and pi has no MCP client. Moving the MCP into a plugin was mapped and dropped ("keep the mcp").
The bound MCP connection stays (Settings → AI apps → Acts as). It is optional and is the same narrowed caller as the CLI, so the two can't drift.
New runs stay pinned to the worker that sent them, as on 11-16.
--onmay name that worker by id or name.Names resolve on the hub, not in each client. The CLI, the MCP, cron and plugins all get the same rule and the same helpful error.
No MCP
parentargument. It was approved in the first form, but the CLI already sets the parent fromCLAUDE_SESSION_ID.Changelog
ai-agentCLI works in every conversation on a worker (Claude Code, agy, opencode) and in a terminal there, through the worker's outbox. What it starts appears inside the conversation and reports back to it.EVOX2) instead of its id. An unknown worker now lists the valid ones.lab(andhomelab) work wherever a worker is picked, likelocal.Test notes
Backend: all 167
test_*.pymodules, each under bwrap with a throwaway/data, on this branch and on main. The only failure istest_typed_plugins.py::TestStore::test_records_carry_kind(agit clonein the test environment), and it fails on main too. New or updated suites:test_worker_cli.py(7, new),test_worker_bound.py(12),test_worker_routing.py(48, including names, ambiguity, lab aliases and cron by name).Sidecar:
test_outbox.py12 passed. CLI:test_ai_agent.py,test_mcp_tools.pyandtest_conv_ref.py94 passed.Frontend:
tscis clean and the i18n test passes;FreshContext.test.tsx, already listed as flaky inscripts/test-known-failures.txt.Live check: I booted a local hub from this branch with an
EVOX2worker record. I ran the real CLI with the exact environmentCliJobsgives it:ls,search,past,workers,usageandscheduledall answered through the gate;new --on EVOX2resolved the name;new --on labgot a 403 ("a run started from EVOX2 goes to EVOX2 only");newin Read mode got a 403.budgetandmodelsanswered the owner the same way, because that hub had no provider plugins.Not tested: a real round trip from the EVOX2's outbox. It needs this branch on the hub, and the worker follows the hub's commit.
Deploy from the Homelab after review (the
ai-agent-deployskill), never from the EVOX2. The workers update themselves to the hub's commit, and theirinstall.shputs theai-agentshim back. The companion homelab PR updates theai-agentskill andservices/ai-agent/CLAUDE.md: merge both.Screenshots: the Details tab on desktop, and on a phone with Read picked (mock API).
🤖 Generated with Claude Code
Screenshots
On 2026-11-28 an agy run on the EVOX2 (2ca176fc) had no way to start a conversation: since 2026-11-18 a worker's CLI kept only `past`, and the hub's MCP — its stand-in — existed in Claude Code only. It shelled out to three `claude -p --model haiku` relays to call start_conversation, which named the worker EVOX2 (refused), had no parent to report to and polled wait_for_conversation for 10+ minutes. Another agy run (25c32ca5) gave up delegating. Gabriel's call: the CLI back on workers, the MCP stays. The 2026-11-16 path, on today's code: - cli/ai_agent.py: on a worker (AI_AGENT_OUTBOX_URL) the WORKER_COMMANDS go into the outbox as a `cli` item {argv, sessionId}; what the hub's run printed comes back (≈ 2–4 s, a `wait` when the run ends). The hub's run sends X-AIA-As-Worker + X-AIA-As-Worker-Mode. - backend/workers/cli.py: CliJobs runs the same CLI in a clean env (host token, AIA_AS_WORKER, its switch as the mode, CLAUDE_SESSION_ID = the sending session → the parent of what it starts: children nest and report back). The narrowing is workers/bound.py worker_caller — the same caller as a worker-bound MCP connection, worker.read / worker.run scopes. - The per-worker switch: workers.json `cli` off | read | run (unset = run, a guest's computer always off), PATCH /api/workers/{id} {cli}, Machines → the worker → Details → "ai-agent CLI". - sidecar/outbox.py: the `cli` kind (results dropped 10 min after they end); outbox_mirror answers it; worker/install.sh writes the `ai-agent` terminal shim again. - The conv-ref hook names the CLI on a worker; `past`'s lookup follows the switch. The bound MCP connection stays, optional. - Docs: CLAUDE.md, docs/mcp.md, worker/README.md. Tests: test_worker_cli.py (new), test_worker_bound.py, test_worker_routing.py, sidecar test_outbox.py, cli test_ai_agent.py / test_conv_ref.py; the whole backend per module matches main (test_typed_plugins' git-clone case fails on both). A live local hub answered every worker command through the gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.