Skip to content

[Fix] Tasks stall in repeated memory preflight calls - #2032

Draft
roomote-roomote[bot] wants to merge 1 commit into
developfrom
fix/brain-preflight-loop-0j9igi5nmpph6
Draft

[Fix] Tasks stall in repeated memory preflight calls#2032
roomote-roomote[bot] wants to merge 1 commit into
developfrom
fix/brain-preflight-loop-0j9igi5nmpph6

Conversation

@roomote-roomote

Copy link
Copy Markdown
Contributor

​Opened on behalf of @mrubens. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

What changed

  • Made Brain-specific guidance the sole owner of the initial memory recall instead of layering a generic any-read preflight above it.
  • Defined one returned Brain query as satisfying preflight across tool results, runtime continuations, retries, and continued work on the same topic.
  • Kept later Brain reads available only for a specific information gap or a genuinely distinct topic, with focused prompt-composition regression coverage.
  • Applied the same non-reset semantics to provider-neutral memory guidance for tasks and conversations.

Why this change was made

Generic memory guidance allowed any read tool while the appended Brain guidance separately required query. Those two standing preflight owners could be re-evaluated after every tool result, causing an agent to alternate memory tools indefinitely instead of beginning the requested work.

Impact

Tasks and conversations retain their initial memory recall, but completing that recall now advances the agent into actual work rather than reopening the same preflight on each continuation. Legitimate targeted memory follow-ups remain available.

@roomote-community

roomote-community Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • Update stale prompt assertions in packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-integration-broker.test.ts, packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-prompt.test.ts, and apps/worker/src/sandbox-server/lib/harnesses/__tests__/opencode-server-bootstrap.test.ts.

Reviewed 917d03c

const initialRecallGuidance =
serverId === BRAIN_MCP_ID
? `The Brain-specific guidance below owns the required initial recall. Do not perform an additional generic memory preflight.`
: `At the start of each substantive task, make exactly one normal ${displayName} tool call before any other context or work tool call. Use the server's most appropriate read, recall, or search tool to retrieve relevant preferences, prior decisions, conventions, and lessons, then wait for the result before continuing. Once that call returns, the initial memory preflight is satisfied for the task; tool results, runtime continuations, retries, and continued work on the same topic do not reset it. Skip it only for greetings, simple calculations or transformations, exact actions requiring no contextual judgment, or follow-ups already covered by memory recall in the current conversation.`;

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.

The replacement prompt text removes phrases that current consumer tests still assert, but this PR updates only the direct @roomote/types tests. As a result, the focused @roomote/cloud-agents tests fail in fast-agent-integration-broker.test.ts and fast-agent-prompt.test.ts, and the Worker bootstrap test also fails. Update those expectations to the new preflight contract so the affected packages pass CI.

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