Skip to content

auberge bichon rescan

Terminal window
auberge bichon rescan [--host <HOST>] [--account <EMAIL>] [OPTIONS]

Re-archives mail the hourly archive run can never reach.

The archive cursor is a message-date watermark: each run asks Bichon only for envelopes dated after cursor − overlap (24h). Mail that enters a Synced Folder with an older Date: sits below the watermark forever — present in Bichon’s store, absent from the Email Archive, unreported. That happens when mail is:

  • moved between folders upstream (IMAP MOVE preserves INTERNALDATE, RFC 6851 — no date the filter reads changes),
  • bulk-imported from an old mailbox,
  • delivered with a backdated or wrong Date: header,
  • brought in by reconcile-folders --apply adding a folder whose backlog is old.

rescan resets the per-account cursor to 0 as the bichon user (the file is 0600 bichon:bichon; a root write would change its owner) and starts bichon-archive.service, waiting for the full pass to complete. The archive’s skip guard keeps the pass idempotent: already-archived bodies are skipped, only missing ones download. A second consecutive run reports processed=0.

The service processes every account each run; --account chooses whose cursors are reset. The report covers all accounts, flagging which were reset.

Refuses to run when:

  • any sidecar lacks message_id — a full pass keyed on regenerating envelope ids would multiply duplicate bodies (#389). Remediation: deploy the current bichon role and let the hourly run backfill sidecars, then retry.
  • an archive run is in progress — a reset mid-run would be overwritten by that run’s own cursor write.
Option Description Default
-H, –host HOST Target host running Bichon (prompted on a TTY) prompted
–account EMAIL Only reset one account’s cursor (prompted on a TTY, [all accounts] offered first) All
-o, –output FORMAT Output format (human, json) human

Off a TTY a lone configured host is implied and a roster holding several exits 2 naming -H; --account omitted means all accounts.

The account field of --output json carries the filter that was resolved, not the flag that was typed: pick one account from the picker and that address is what the report names.

Code Meaning
0 run completed, no failures
1 the run counted failures
2 usage error, unreachable host, or refused precondition

Needs both the Bichon API (account list — same base URL resolution and bichon_api_token as reconcile-folders) and SSH to the host (cursor reset, service start, journal read). A host whose Bichon reports no accounts is refused in the same words there, because all three commands reach the API through one place.

Terminal window
# Full pass, all accounts
auberge bichon rescan --host auberge
# One account, structured output
auberge bichon rescan --host auberge --account me@example.com --output json
# Scriptable: exit code carries the verdict
auberge bichon rescan --host auberge --output json || echo "rescan not clean: $?"
  • After reconcile-folders --apply adds folders (the command prints this hint itself).
  • After importing an old mailbox or reorganising folders upstream.
  • When bichon-expunge.sh’s coverage gate reports archive < IMAP for a window the hourly run should have covered.