feat(ext-api): phase infinite-loop endpoint (issue #1291)#1302
Merged
Conversation
Companion to issue #1290 (single-phase stop). Adds: - POST /api/internal/loop/phase/{phaseName} (start continuous loop) - POST /api/internal/stop/loop/phase/{phaseName} (halt loop) - PhaseLoopController component + dedicated virtual-thread executor - RunStatus.loopId field; trigger 409 on loop-active Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… shutdown Tests do not compile yet — triggerPhase 4-arg overload added in next commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nal preservation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…topPhase loop warning Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ture Loop ID is loopId=null for single-shot runs; pre-existing tests now match the default-arg production call. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cross-thread visibility for status/iterationCount/lastRunId/lastError. Concurrency invariant: handleIterationEnd is single-threaded per phase; stopLoop/shutdown only write status. iterationCount += 1 safe by construction. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documents the known race between startLoop and concurrent external one-shot. Spec §11: no retry on iteration failure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…PING Allow rapid stop→start. Old iteration still finalizes out-of-band; new iteration's acquire may briefly race, falling to the slot-conflict path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
POST /api/internal/loop/phase/{phaseName}andPOST /api/internal/stop/loop/phase/{phaseName}tomodule-external-apirunId; iterations share aloopIdrecorded on eachRunStatusfor/run-statuscorrelationPhaseStopSignal; iteration halts at next chunk boundary/trigger/dailyand/trigger/phase/{name}reject 409 withLOOP_ACTIVEif a loop is active for the same phase/run-statusdecorates response withloopSummariesmap per active loop@VolatiletoLoopStatemutable fields for cross-thread visibilitystartLoopallocates a freshloopIdeven if a previous loop is still in STOPPING (rapid stop→start)Loopable phases
ITEM_EQUIPMENT,CHARACTER_BASIC(OCID_LOOKUP excluded:runOcidPhaserequiresupstreamRunIdand would throwIllegalArgumentExceptionon first iteration; RANKING_FETCH was already excluded)Test plan
./gradlew :module-external-api:test— all tests pass./gradlew :module-external-api:compileKotlin :module-external-api:compileJava --continue— cleancurl -X POST /api/internal/loop/phase/ITEM_EQUIPMENT+ observe/run-statusfor ≥10 min (deferred to reviewer per project rules, no smoke performed)Spec
docs/superpowers/specs/2026-06-19-issue-1291-loop-endpoint-design.md🤖 Generated with Claude Code