Skip to content

[Fix] Fast mode can continue after its conversation lock expires - #1515

Closed
roomote-roomote[bot] wants to merge 11 commits into
developfrom
fix/fast-lock-renewal-fail-closed-0xlbn6sro4gpp
Closed

[Fix] Fast mode can continue after its conversation lock expires#1515
roomote-roomote[bot] wants to merge 11 commits into
developfrom
fix/fast-lock-renewal-fail-closed-0xlbn6sro4gpp

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

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

Why this PR exists

  • I am a maintainer / this is internal Roomote work

What changed

Fast conversation locks now abort an active turn when renewal cannot be confirmed before the last confirmed Redis lease expires. Successful acquisitions and renewals start their deadline from confirmation, so slow Redis responses still receive the full lease.

Ownership cancellation covers Slack and Discord task preparation, kickoff, and queue handoff. Signal-guarded runs remain non-runnable during asynchronous activation preparation; the final synchronous ownership check dispatches one atomic Redis commit, while cancellation cleanup, commit, and competing dequeue serialize in Redis so only one side wins.

The branch includes develop through cf993348 while preserving current image and model forwarding, all-repositories handling, native task-card hooks, queued-lock retries, and retry settlement behavior.

Why this change was made

Persistent renewal failures previously allowed an expired Fast turn to continue after another worker could acquire the same conversation, risking duplicate replies or task launches.

Impact

Transient Redis failures remain tolerated while the confirmed lease is valid. Once ownership is lost, stale Fast work stops without canceling a task that the controller already claimed legitimately.

How it was tested

  • pnpm exec dotenvx run -f .env.test -- pnpm --filter @roomote/cloud-agents exec vitest run src/server/fast-agent/__tests__/fast-agent-turn-lock.test.ts src/server/fast-agent/__tests__/fast-agent-task-launcher.test.ts src/server/fast-agent/__tests__/fast-agent-service.test.ts src/server/__tests__/task-run-queue.test.ts src/server/__tests__/enqueue-task.test.ts (230 passed)
  • pnpm exec dotenvx run -f .env.test -- pnpm --filter @roomote/api exec vitest run src/handlers/discord/__tests__/task-orchestration.test.ts src/handlers/discord/__tests__/fast-agent.test.ts (27 passed)
  • pnpm lint, pnpm check-types, pnpm knip, pnpm build, and pnpm lint:pre-push pass.
  • The full pnpm test gate reaches a pre-existing develop failure in packages/db/src/lib/__tests__/brain.test.ts: the whole DB suite reports three recent recording gaps instead of one. The test passes in isolation, and a clean origin/develop worktree reproduces the same full-suite failure.

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset

@roomote-community

roomote-community Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

  • Prevent a signal-guarded Fast task from becoming runnable when ownership aborts while activateDelayedEntry() is in flight.
  • Start the lock deadline from the confirmed Redis renewal, not from before the renewal request.
  • Start the lock deadline from the confirmed Redis acquisition, not from before the acquire request.

Reviewed 3afc15c

Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-turn-lock.ts Outdated
@roomote-roomote

roomote-roomote Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Freshness/readiness pass completed at 3afc15c5.

  • Integrated develop through cf993348, preserving current model/image forwarding, all-repositories handling, task-card hooks, queued-lock retries, and retry settlement.
  • Verified fail-closed lease deadlines, AbortSignal propagation, held activation preparation, and atomic cancellation/commit/dequeue ordering.
  • Focused suites pass: 230 cloud-agent tests and 27 Discord API tests.
  • pnpm lint, pnpm check-types, pnpm knip, pnpm build, and pnpm lint:pre-push pass.
  • Full pnpm test is blocked locally by a pre-existing DB-suite isolation failure on develop; the failing Brain summary test passes alone and reproduces in a clean origin/develop worktree.
  • GitHub reports all 18 check runs completed with success or intentional skip, including Test, Lint, Type Check, Knip, CodeQL, Docker build, upgrade compatibility, and Roomote code review.

No code issues remain in the automated review and all existing review threads are resolved. The branch is mergeable; the remaining blocked state is the draft/review decision, not failing CI.

Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-turn-lock.ts Outdated
@daniel-lxs daniel-lxs closed this Aug 30, 2026
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