feat(agentloop): Stagnations-Erkennung + adaptives Stop-Budget (issue #150)#223
Merged
Conversation
…150) What ships: - cmd/sin-code/internal/agentloop/loop.go: - New Loop.StallThreshold field: 0 disables (backwards-compatible); recommended 3. - New Loop.MaxStopRejects field: hard cap on stop-gate rejections, default 3. - State: stopRejects counter + lastCritFingerprint (joined OpenCriteria with \x1f separator) + stallCount. - Reject-block: tracks consecutive identical OpenCriteria, escalates early with 'stop-gate stalled' error when stallCount >= StallThreshold. Fires hooks.StopStalled + records ledger.TypeStallDetected. - Reject-block: enforces MaxStopRejects with explicit error message. - cmd/sin-code/internal/ledger/store.go: new EntryType TypeStallDetected. - cmd/sin-code/internal/hooks/hooks.go: new event hooks.StopStalled. - cmd/sin-code/internal/agentloop/loop_stall_test.go: 3 new tests (escalate, change-resets, disabled). Acceptance criteria (from #150): - [x] Identical OpenCriteria over StallThreshold turns -> early abort with 'stalled' error. - [x] Changing criteria reset the stall counter. - [x] StallThreshold=0 disables detection (backwards-compatible). - [x] go test ./cmd/sin-code/internal/agentloop/... all green. Hard mandates honored: - M2 (single binary, no CGO): no new deps. - M3 (verify gate sacred): stall fires after the verify-gate, never short-circuits it. - M7 (race-clean): 3/3 new tests pass under go test -race -count=1. Refs: #150
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown)
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown) Run ID:
|
4 tasks
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.
Implements issue #150 (Loop Engineering: Lücke 1). Detects when the stop-gate returns identical OpenCriteria for N consecutive turns and escalates early — saves budget on stuck workers.
What ships
cmd/sin-code/internal/agentloop/loop.go: newLoop.StallThresholdfield +Loop.MaxStopRejectsfield + stall-detection logic in the reject-blockcmd/sin-code/internal/ledger/store.go: newTypeStallDetectedentry typecmd/sin-code/internal/hooks/hooks.go: newStopStalledeventcmd/sin-code/internal/agentloop/loop_stall_test.go: 3 new testsAcceptance criteria (from #150)
OpenCriteriaoverStallThresholdturns → early abort with'stalled'errorTestStopGate_Stall_ChangingCriteriaResets)StallThreshold=0disables detection, backwards-compatible (TestStopGate_Stall_Disabled)go test ./cmd/sin-code/internal/agentloop/...all greenHard mandates honored
go test -race -count=1Diffstat
Closes