Browse documentation
Fountain handbook

Native operation recovery

Reconcile a native write that was interrupted when the forge stopped: inspect the reservation, stop every writer, run offline recovery for the exact held owner and restart safely.

On this page

When you need recovery

Fountain serializes conditional native writes — the operations described in Background collaboration — through one reservation. An operation holds it while it commits. If the forge stops abruptly during that window, the reservation can remain held and later writes wait for it.

Recovery checks the held operation against the database and repository evidence and releases the reservation only when its effect is known. It never replays the interrupted write. There is no force-unlock and no timeout release.

Before you begin

  • Shell access as the forge's service user, with the same executable, configuration, work path, custom path, database and repository storage as the server.
  • A way to stop every process that can write to the forge's data and keep it from restarting: web and SSH access, queue workers, scheduled jobs, administrative commands and any processes they started.
  • The database must stay available.

Check the reservation

fountain --work-path /var/lib/fountain \
  --config /var/lib/fountain/custom/conf/app.ini \
  admin native-operation status

The command prints:

Line Meaning
state idle or held
revision The current native revision
owner, generation When held: the exact owner and fencing generation to reconcile
kind, family When held: the kind and family of the held operation, if known
inhibited Whether the offline marker is present

status never claims or releases the reservation and never prints secrets or operation payloads. If state is idle, there is nothing to recover.

Stop writers and inhibit restart

  1. Stop the forge and every other writer, and prevent them from restarting until recovery finishes.

  2. Create the offline marker, the file nativeop-offline in the forge's app data path ([server] APP_DATA_PATH):

    sudo -u git touch /var/lib/fountain/data/nativeop-offline
    

    This path assumes the default app data path, data under the work path. In the container image the app data path is /data/gitea; with the forge container stopped, create the marker from a one-off container:

    docker run --rm -v fountain-data:/data \
      ghcr.io/veighnsche/fountain:"$FOUNTAIN_VERSION" \
      su-exec git touch /data/gitea/nativeop-offline
    
  3. Run status again and confirm inhibited: true.

The marker stops new operations from claiming the reservation. It does not stop processes and does not release the current owner; your service controls do that.

Run recovery

Copy the exact owner and generation from status:

fountain --work-path /var/lib/fountain \
  --config /var/lib/fountain/custom/conf/app.ini \
  admin native-operation recover --owner OWNER --generation GENERATION

For a container installation, run the command in a one-off container from the same image, with the same volume and, for an external database, the same network and secrets, after stopping the forge container:

docker run --rm -v fountain-data:/data \
  ghcr.io/veighnsche/fountain:"$FOUNTAIN_VERSION" \
  su-exec git forgejo admin native-operation recover --owner OWNER --generation GENERATION

The command prints the owner, generation, kind, family and verdict, then any effect, reason and check lines that explain the decision.

Read the verdict

Verdict and exit code Meaning Next step
released, exit 0 The effect was established from evidence and the exact owner was released Lift inhibition and restart. If the original operation reports needs_intervention, handle it through the extension that submitted it.
idle, exit 0 No owner was held; nothing was replayed Lift inhibition and restart.
fenced, exit 3 The owner stays held: wrong owner or generation, unaccounted effects or uncertain attribution Keep inhibition. Do not guess another owner or generation. Investigate the reason and check lines.
Other error, exit 1 Configuration, database, filesystem or invocation failure Keep inhibition and fix the reported failure.

If writers are still allowed, recovery refuses with domain is not inhibited: stop every native writer and inhibit restart before reconciling. Fenced reason values are wrong_generation, unknown_family, uncertain_effect, unaccounted_effects and missing_evidence.

Restart

  1. Run status and confirm state: idle.
  2. Delete the offline marker.
  3. Restart the forge and other writers through your service controls.
  4. Check the original operation through the extension's own receipt or lookup. Releasing the reservation is separate from completing every follow-up effect of that operation.

Continue

Review the Extension configuration reference, or return to the handbook index.