#274 detect non-convergence when max-cycles exhausted#274
Open
VasilevNStas wants to merge 1 commit into
Open
Conversation
VasilevNStas
added a commit
to VasilevNStas/swarm-template
that referenced
this pull request
Jun 29, 2026
The judges CLI exits with code 0 even when --max-cycles is reached without achieving a fixpoint. The factbase keeps changing on every cycle, but judges reports "Update completed" with exit 0. This means baza.rb treats the job as successful when in fact judges may not have finished processing all facts. After judges update completes, scan its stdout for the fixpoint message "has made no changes". If this message is absent but the exit code is 0, it means --max-cycles was exhausted before convergence. In that case, exit with code 75 (EX_TEMPFAIL) to signal baza.rb that the job needs investigation or a retry with higher --max-cycles. This is a workaround — the proper fix belongs in the judges gem, which should exit non-zero when max-cycles is exhausted without convergence.
600a4b1 to
f4ae766
Compare
VasilevNStas
added a commit
to VasilevNStas/swarm-template
that referenced
this pull request
Jun 29, 2026
The judges CLI exits with code 0 even when --max-cycles is reached without achieving a fixpoint. The factbase keeps changing on every cycle, but judges reports "Update completed" with exit 0. This means baza.rb treats the job as successful when in fact judges may not have finished processing all facts. After judges update completes, scan its stdout for the fixpoint message "has made no changes". If this message is absent but the exit code is 0, it means --max-cycles was exhausted before convergence. In that case, exit with code 75 (EX_TEMPFAIL) to signal baza.rb that the job needs investigation or a retry with higher --max-cycles. This is a workaround — the proper fix belongs in the judges gem, which should exit non-zero when max-cycles is exhausted without convergence.
f4ae766 to
e0a0bcb
Compare
Contributor
Author
|
@yegor256 — this PR is part of a 3-PR series that addresses a critical reliability gap in the baza.rb ↔ entry.sh pipeline. The problem: When baza.rb pushes a job, entry.sh runs judges update with no time limit, no convergence detection, and no signal handling. If judges hang or fail to converge, the container runs forever and baza.rb's polling of finished? times out after 10 minutes with no diagnostic information — the user sees a silent failure. |
The judges CLI exits with code 0 even when --max-cycles is reached without achieving a fixpoint. The factbase keeps changing on every cycle, but judges reports "Update completed" with exit 0. This means baza.rb treats the job as successful when in fact judges may not have finished processing all facts. After judges update completes, scan its stdout for the fixpoint message "has made no changes". If this message is absent but the exit code is 0, it means --max-cycles was exhausted before convergence. In that case, exit with code 75 (EX_TEMPFAIL) to signal baza.rb that the job needs investigation or a retry with higher --max-cycles. This is a workaround — the proper fix belongs in the judges gem, which should exit non-zero when max-cycles is exhausted without convergence.
e0a0bcb to
eb58faf
Compare
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.
The
judgesCLI exits with code 0 even when--max-cyclesis reached without achieving a fixpoint (convergence). The factbase keeps changing on every cycle, butjudgesreports "Update completed" with exit 0.The problem
This means
baza.rbtreats the job as successful when in fact judges may not have finished processing all facts. The result is silently incomplete.What this PR does
After
judges updatecompletes,entry.shnow scans stdout for the fixpoint message"has made no changes":Exit code 75 (
EX_TEMPFAIL) tellsbaza.rbthat the job failed in a potentially transient way — a retry with higher--max-cyclesor fixed judge logic may succeed.Why this works
The
judgesgem emits:"The update cycle #N has made no changes to the factbase, let's stop"→ converged"Too many cycles already, as set by --max-cycles=N, breaking"→ not convergedWe grep for the presence of
"has made no changes"in the output. If it's missing and exit code is 0, convergence was not reached.Limitations
This is a workaround. The proper fix belongs in the
judgesgem — it should exit non-zero when--max-cyclesis exhausted without convergence. A follow-up PR toyegor256/judgeswould be the correct long-term solution.Checklist
bundle exec rubocop— 0 offensesbundle exec rake— all tasks pass@yegor256 please review