Skip to content

perf([cos-on-demand-mark-app-review-started-dedupe]): dedupe per-app markAppReviewStarted in CoS on-demand loop#611

Merged
atomantic merged 3 commits into
mainfrom
claim/cos-on-demand-mark-app-review-started-dedupe
Jun 1, 2026
Merged

perf([cos-on-demand-mark-app-review-started-dedupe]): dedupe per-app markAppReviewStarted in CoS on-demand loop#611
atomantic merged 3 commits into
mainfrom
claim/cos-on-demand-mark-app-review-started-dedupe

Conversation

@atomantic
Copy link
Copy Markdown
Owner

Summary

When several on-demand improvement requests for the same managed app are processed in a single CoS evaluation cycle, evaluateTasks previously called markAppReviewStarted(appId, …) once per request — each call rewriting the same app activity record (activeAgentId + lastReviewedAt).

This guards the mark with a per-cycle Set so each app's activity record is marked review-started at most once per evaluation cycle. recordExecution and task generation still run per request — only the redundant activity-record write is deduped.

The activity record's activeAgentId is a single field that was already last-wins under multiple requests, so first-wins dedup introduces no lifecycle change beyond removing the wasted writes.

Test plan

  • server/services/cos.test.js gains a source-level invariant pinning both the reviewStartedApps set declaration and the !reviewStartedApps.has(targetApp.id) guard, matching the file's established source-assertion style.
  • cd server && npm test -- cos.test.js — 116 tests pass.

atomantic added 3 commits June 1, 2026 14:04
…eview-started once per CoS evaluation cycle

Multiple on-demand improvement requests targeting the same app each called
markAppReviewStarted, rewriting the app's activity record once per request.
Guard the call with a per-cycle Set so each app is marked at most once.
…tTask on-demand loop too

The event-driven 'Run Now' path runs a second, near-identical on-demand
loop in dequeueNextTask that also marked the app review-started once per
request. Apply the same per-cycle Set guard there, extend the source
invariant to cover both loops, and generalize the changelog wording.
@atomantic atomantic merged commit ea682c6 into main Jun 1, 2026
2 checks passed
@atomantic atomantic deleted the claim/cos-on-demand-mark-app-review-started-dedupe branch June 1, 2026 21:09
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