feat: auto-update incarnations on a configurable interval#579
Draft
peterbraden wants to merge 4 commits intomainfrom
Draft
feat: auto-update incarnations on a configurable interval#579peterbraden wants to merge 4 commits intomainfrom
peterbraden wants to merge 4 commits intomainfrom
Conversation
Adds opt-in automatic template re-application per incarnation. Setting auto_update_interval_seconds > 0 causes a background task to periodically call create_change_merge_request (with automerge) for that incarnation, targeting the latest commit on its current branch or tag. 0 disables the feature. Changes: - DB: add auto_update_interval_seconds column to incarnation table (migration included); 0 = disabled, no separate boolean needed - AutoUpdateService: asyncio background loop, in-memory last-run tracking per incarnation, skips if interval not elapsed or a previous change is still open - App lifespan: starts/cancels the background loop on startup/shutdown; extracts build_hoster() helper shared with dependencies - API: auto_update_interval_seconds on create/update/patch request models and all response models; set_auto_update_interval() on ChangeService threads the value to the incarnation table - UI: Auto update toggle + Update interval (minutes) input in Form.tsx; field threaded through all TS types and converter functions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add missing `auto_update_interval_seconds=0` to `IncarnationInDB` constructor in the incarnation repository test, and remove trailing commas from the last properties of three object literals in `incarnations.ts` (ESLint comma-dangle rule). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unsupported `type="number"` from TextField (only accepts text/textarea/search) - Stringify the minutes value passed to TextField - Add missing `auto_update_interval_seconds` to `updateTemplateVersion` API input Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…econds Add `auto_update_interval_seconds` param to `ChangeServiceMock.create_incarnation()` and include the field in the expected GET /incarnations response assertion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NB: Speculative feature, not worth reviewing yet.
Summary
auto_update_interval_seconds(integer, 0 = disabled) to theincarnationtable, with a DB migration. No separate boolean needed — zero means off.AutoUpdateServiceruns as an asyncio background task (started via a FastAPI lifespan handler). Each tick (60 s) it checks every incarnation whose interval has elapsed and callscreate_change_merge_requestwithautomerge=True, patch=True, targeting the latest commit on the incarnation's current branch or tag. Already-up-to-date and in-progress cases are handled gracefully.Test plan
poetry run pytest tests/services/test_auto_update.py— 6 unit tests covering: interval=0 skip, not-yet-due skip, due incarnation triggers change with correct args,ChangeRejectedDueToNoChangesswallowed and last-run updated,ChangeRejectedDueToPreviousUnfinishedChangedoes not update last-runpoetry run pytest— full suite passes🤖 Generated with Claude Code