Skip to content

Run research workers on a remote document's attached Planner - #730

Merged
lavaman131 merged 1 commit into
mainfrom
run-research-on-attached-planner
Oct 27, 2026
Merged

lavaman131 merged 1 commit into
mainfrom
run-research-on-attached-planner

Conversation

@lavaman131

@lavaman131 lavaman131 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

/research failed on deployments that run HARNESS=remote while Chat and Build worked. Research now runs on the client attached as the document's Planner, the same machine that already runs its Chat turns.

Cause. Startup refused HARNESS=remote unless BACKGROUND_JOBS=off, because summary and research workers had no model on the server. With jobs off, the research-evidence and research-answer definitions were never registered, so ResearchWorkspaceService refused every request as not-ready. Reproduced on a HARNESS=remote deployment: the card said "Research could not be started." and POST /api/channels/:id/research-requests returned 409 {"error":"research workspace is not ready"}.

Fix.

  • openWorkerSession takes the job's channelId and registers the worker as an isolated session of that document (registerRemotePlanner), unregistering it on close. Under HARNESS=remote the existing remote adapter then sends the worker to the document's attached client in isolated mode: no client tools, no Decisions, only the stage's host tools (web_search for evidence), and a JSON responseFormat. Other harnesses never read the registry.
  • The job runner's resolveActivePlanner returns no owner while a remote document has no attached client, so its jobs wait instead of burning attempts. An attach already calls ownerAvailable, which wakes them.
  • config.ts no longer refuses background jobs under HARNESS=remote. BACKGROUND_JOBS=off still keeps every worker off the attached clients.
  • docs/hosted-agent.md and docs/self-hosting.md describe the new behavior.

The protocol and connector don't change: isolated sessions, host tools and JSON results are already part of the agent connection.

Deploying. A remote deployment had to set BACKGROUND_JOBS=off because startup required it. Remove that variable (or set it to on) after this merges, otherwise /research stays disabled. With jobs on, document descriptions and History summaries also run on the attached machine, the same way they run on the server under other harnesses.

Tests.

  • link.test.ts: a research worker opened through openWorkerSession and the real createRemoteAdapter() reaches a client attached over the real agent connection. The test checks that it starts as isolated, is offered only web_search, gets a JSON response format, runs web_search on the server, and returns the parsed evidence. A worker for a document with no attached client is refused. Both tests failed before the worker-session.ts change with "HARNESS=remote runs only Planner sessions".
  • worker-session.test.ts checks that the isolated registration is removed on close. config.test.ts now accepts remote with background jobs on.

Assistant-model: Claude Opus 5.5 (fast)
Assistant-workflow: inline
Assistant-duration: 14m converged, estimated unmeasured
Assistant-verification: agent-browser manual scenario passed: reproduced on a HARNESS=remote deployment, /research showed "Research could not be started." and the research-requests POST returned 409 "research workspace is not ready"
Assistant-verification: red-before-fix passed: the new background-worker tests in link.test.ts failed without the worker-session change
Assistant-verification: bun test unit passed: GIT_CONFIG_GLOBAL=/dev/null bun test (6736 pass, 0 fail)
Assistant-verification: typecheck and lint passed: bun run types and bun run ci
Co-authored-by: Alex Lavaee lavaman131@github.com

Under HARNESS=remote, /research always failed with "Research could not be
started": startup required BACKGROUND_JOBS=off because summary and research
workers had no model on the server, so the research-evidence and
research-answer jobs were never registered and every request was refused as
not ready (409 "research workspace is not ready").

The agent connection already has an isolated session mode for background work,
and the remote adapter only needed to know which document a worker belongs to.
openWorkerSession now registers each worker as an isolated session of its job's
document, so under HARNESS=remote the research, research brief, description and
History summary workers run on the client attached as that document's Planner,
calling only their stage's host tools (web_search for evidence) and returning
JSON. The job runner leaves a remote document's jobs pending while no client is
attached, and an attach wakes them. HARNESS=remote no longer refuses background
jobs; BACKGROUND_JOBS=off still keeps them off the attached clients.

Assistant-model: Claude Opus 5.5 (fast)
Assistant-workflow: inline
Assistant-duration: 14m converged, estimated unmeasured
Assistant-verification: agent-browser manual scenario passed: reproduced on a HARNESS=remote deployment, /research showed "Research could not be started." and POST /api/channels/:id/research-requests returned 409 "research workspace is not ready"
Assistant-verification: red-before-fix passed: the new link.test.ts background-worker tests failed with "HARNESS=remote runs only Planner sessions" without the worker-session change
Assistant-verification: bun test unit passed: GIT_CONFIG_GLOBAL=/dev/null bun test (6736 pass, 0 fail)
Assistant-verification: typecheck and lint passed: bun run types and bun run ci
Co-authored-by: Alex Lavaee <lavaman131@github.com>
@lavaman131
lavaman131 force-pushed the run-research-on-attached-planner branch from 5d4063d to 4a21890 Compare October 27, 2026 03:08
@lavaman131
lavaman131 merged commit e97050c into main Oct 27, 2026
24 checks passed
@lavaman131
lavaman131 deleted the run-research-on-attached-planner branch October 27, 2026 03:13
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.

1 participant