Skip to content

Commit bd64d46

Browse files
K2GO-423 fix(forgejo): start the seed only after the runrole succeeds
Device test found a real bug: a 360s stall on the forgejo binary download failed the first runrole attempt; the pipeline reached its Stage 2 terminal with the server up, so the seed started, found forgejo absent, and CLEARED the banked marker -- so the user's retry installed forgejo but never re-seeded (no admin, no org, no repos). Gate the seed start on the module having SUCCEEDED (queue DONE and forgejo not in the failed set), not merely "terminal + server up". Also release the completion gate when the forgejo runrole failed, so a failed install shows Finish + Retry instead of hanging on a seed that will never start; the banked marker then survives for the retry, which seeds once the install succeeds.
1 parent f9dd88e commit bd64d46

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

‎controller/app/src/main/java/org/appdevforall/k2go/redesign/SetupProgressActivity.java‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,16 @@ private boolean orchestrateStep() {
604604
if (ZimProvisioner.hasPending(this)) ZimProvisioner.drain(this);
605605
if (BooksProvisioner.hasPending(this)) BooksProvisioner.drain(this);
606606
if (KolibriProvisioner.hasPending(this)) KolibriProvisioner.drain(this);
607-
// K2GO-423: the Forgejo seed is a chained REST-stage sibling. Unlike the content drains it
608-
// starts only once the module server is observed up (a live dash-node under proot), so a POST
609-
// reaches a working box; and only when no session is open yet (the service owns its bounded
610-
// retry). This replaces the old silent Home drain (ForgejoSeedProvisioner).
607+
// K2GO-423: the Forgejo seed is a chained REST-stage sibling. It starts only when:
608+
// - the forgejo runrole SUCCEEDED (queue DONE and forgejo not in the failed set). A failed or
609+
// stalled attempt reaches this Stage 2 terminal too, and starting the seed there would find
610+
// forgejo absent and clear the banked marker -- so a later retry would never re-seed
611+
// (observed on device: a 360s binary-download stall cleared the seed);
612+
// - the module server is observed up (a live dash-node under proot), so the POST reaches a
613+
// working box; and no session is open yet (the service owns its bounded retry).
614+
// This replaces the old silent Home drain (ForgejoSeedProvisioner).
611615
if (org.appdevforall.k2go.forgejo.data.ForgejoInstallPrefs.isSeedPending(this)
616+
&& mq.phase == ModuleQueueState.Phase.DONE && !mq.didFail("forgejo")
612617
&& serverObservedUp()
613618
&& !org.appdevforall.k2go.forgejo.presentation.ForgejoSeedRepository.get().hasSession()) {
614619
org.appdevforall.k2go.forgejo.presentation.ForgejoSeedService.start(this);
@@ -747,12 +752,15 @@ private void render() {
747752

748753
boolean allComplete;
749754
boolean moduleServerSettled = batchServerUp || batchServerSlow; // ADFA-5343: up, or gave up waiting here
750-
// K2GO-423: the seed blocks completion only while it can make progress, and only in a module
751-
// (forgejo install) flow -- that is the only flow whose batch-terminal -> reconciler sequence
752-
// brings the server up so the seed can start. A stranded seed appearing in a non-module Get
753-
// More flow must NOT block completion (it never gets a server-up signal here); the Home resume
754-
// drives it later. A slow/failed server also releases the gate (that run is already a failure).
755-
boolean seedPendingRun = forgejoSeedActive() && !batchServerSlow && moduleShown;
755+
// K2GO-423: the seed blocks completion only while it can actually make progress:
756+
// - only in a module (forgejo install) flow -- that is the only flow whose batch-terminal ->
757+
// reconciler sequence brings the server up so the seed can start (a stranded seed in a
758+
// non-module Get More flow never gets a server-up signal here; the Home resume drives it);
759+
// - not when the forgejo runrole FAILED -- the seed never starts then (it would clear the
760+
// marker), so waiting on it would hang; that run is already a failure (Finish + Retry);
761+
// - not when the server is slow/failed -- also already a failure.
762+
boolean seedPendingRun = forgejoSeedActive() && !batchServerSlow && moduleShown
763+
&& !mq.didFail("forgejo");
756764
if (noRest && prootShown) {
757765
// proot-only: complete when the queue is terminal — plus, for a module batch, once the server
758766
// is back (up) or the restart has failed (a dead home that wakes up seconds later is exactly

0 commit comments

Comments
 (0)