Skip to content

[Feat] Add automation recommendations to setup - #1321

Merged
brunobergher merged 26 commits into
developfrom
feature/automation-recommendations-2cxy5psekh4ih
Aug 14, 2026
Merged

[Feat] Add automation recommendations to setup#1321
brunobergher merged 26 commits into
developfrom
feature/automation-recommendations-2cxy5psekh4ih

Conversation

@roomote-roomote

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

Copy link
Copy Markdown
Contributor

​Created by Roomote. View the task or mention @roomote-roomote for follow-up asks.

​Created by Roomote. View the task or mention @roomote-roomote for follow-up asks.

What changed

  • Add a shared, deterministic automation recommendation catalog and scorer with built-in and curated Cookbook candidates.
  • Persist recommendation batches in setup state with stable repository fingerprints, idempotent admin enable/disable/run/dismiss mutations, and cookbook automation creation.
  • Add the first-class setup recommendation step and admin-only Home fallback card.
  • Correct built-in activation to persist scheduler-compatible schedule.mode values and Cookbook activation to use the shared ALL_REPOSITORIES sentinel.

Why this change was made

Admins should be able to opt into useful recurring repository work while configuring Roomote, without generation itself launching a paid run. The review fixes ensure enabled recommendations actually schedule and Cookbook recommendations can create their automation rows.

Impact

New setups can review and enable ranked recommendations after repository selection, while admins who leave recommendations unfinished can continue from Home. Web/type checks and focused recommendation/setup tests pass. The full local test command still exposes an unrelated @roomote/compute-providers failure in worker-release-github-auth.test.ts involving unavailable GitHub installation lookup mocks; no recommendation tests fail.

@roomote-community

roomote-community Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • apps/web/src/trpc/commands/setup-new/index.ts:3170 Recommended built-in automations save frequency instead of the runtime's mode field, so scheduled jobs remain disabled.
  • apps/web/src/trpc/commands/setup-new/index.ts:3196 The cookbook automation uses the wrong all-repositories sentinel and cannot be created.
  • packages/sdk/src/server/lib/automation-recommendations.ts:717 Default-enabled recommendations are not backed by enabled built-in or created cookbook automations.
  • apps/web/src/app/(onboarding)/setup/StepAutomationRecommendations.tsx:113 Skipping a pending recommendation scan lets its default-enabled results become hidden on Home without applying their automations.
  • apps/web/src/trpc/commands/setup-new/index.ts:3406 The delayed initial runs are non-durable in-process timers, so restarts or multiple web instances can lose or duplicate them.
  • packages/sdk/src/server/lib/automation-recommendations.ts:1086 A persistence failure after the initial automation launches clears its claim, so BullMQ retries can launch duplicate paid runs.
  • packages/sdk/src/server/lib/automation-recommendations.ts:1096 The post-launch failure path keeps only a time-limited claim, so a later apply can re-enqueue and duplicate the paid initial run.
  • packages/sdk/src/server/lib/automation-recommendations.ts:1122 A worker crash after the dispatch marker commits but before the automation runner is invoked leaves a completed job and an unrecoverable claim, so the promised initial run is still lost.
  • apps/web/src/trpc/commands/setup/shared.ts:93 Any unrelated setup save serializes the normalized automationRecommendations: null field into legacy state, so the presence-based compatibility flag flips and the new recommendation step appears later in the old flow. — dismissed: this commit intentionally requires the recommendation step for existing setup flows.

Reviewed fb947b7

Comment thread apps/web/src/trpc/commands/setup-new/index.ts Outdated
Comment thread apps/web/src/trpc/commands/setup-new/index.ts Outdated
@roomote-roomote

roomote-roomote Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Fixed and pushed in b243c07d.

  • Built-in recommendation activation now writes schedule.mode, so enabled schedules are recognized by the runtime.
  • Cookbook activation now uses ALL_REPOSITORIES, allowing the custom automation row to be created or updated.
  • Recommendation/catalog tests, setup navigation tests, web lint, and type checks pass.
  • The reported full Test check failure is unrelated to this change: local reproduction fails in @roomote/compute-providers worker-release-github-auth.test.ts because the GitHub installation lookup mock is unavailable; recommendation tests pass.
  • Both requested review threads are resolved.

Comment thread packages/sdk/src/server/lib/automation-recommendations.ts
@brunobergher
brunobergher force-pushed the feature/automation-recommendations-2cxy5psekh4ih branch from 17745a2 to c34be69 Compare August 14, 2026 16:04
Comment thread apps/web/src/trpc/commands/setup-new/index.ts Outdated
Comment thread apps/web/src/app/(onboarding)/setup/StepAutomationRecommendations.tsx Outdated
Comment thread packages/sdk/src/server/lib/automation-recommendations.ts
Comment thread packages/sdk/src/server/lib/automation-recommendations.ts
recommendationApplicationState(batch) !== 'applied' ||
!recommendation?.enabled ||
recommendation.lastRunTaskId ||
recommendation.initialRunClaimedAt ||

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.

A worker restart/crash after the claim transaction commits but before runAutomationNow/runCustomAutomationNow is called now leaves initialRunClaimedAt permanently set. BullMQ retries then return at this guard, and later apply attempts cannot recover it, so the enabled recommendation never receives its promised initial run. Keep post-launch claims terminal to avoid duplicates, but give genuinely pre-launch claims a recoverable state (or make dispatch idempotent).

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.

This remains unresolved. A crash after markAutomationRecommendationInitialRunDispatchAttempted commits but before runAutomationNow / runCustomAutomationNow is invoked leaves both claim fields set. The worker returned normally for any earlier fresh-claim retry, so BullMQ marks the job complete; no later job invokes this recovery path, and the dispatch-marked claim is never reclaimable. The initial run is still lost. Use a durable retry/outbox state or an idempotent dispatch record that can safely be retried after this boundary.

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.

Reopening: the current head still persists initialRunDispatchAttemptedAt before invoking the runner, with no recovery path for a crash in that interval. The prior lost-initial-run finding remains applicable.

Comment thread apps/web/src/app/(onboarding)/setup/hooks.ts Outdated
@brunobergher
brunobergher marked this pull request as ready for review August 14, 2026 17:10
@brunobergher
brunobergher merged commit 20e169b into develop Aug 14, 2026
19 checks passed
@brunobergher
brunobergher deleted the feature/automation-recommendations-2cxy5psekh4ih branch August 14, 2026 17:21
@brunobergher brunobergher changed the title [Feat] Add automation recommendations to setup and Home [Feat] Add automation recommendations to setup Aug 14, 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