Pilot stability hunt

A live record of a bug hunt on Pilot (develop), run on a real VM. Updated 2026-10-15 19:49 UTC.

50fixes, with tests
13owner decisions (12 built, 1 on hold)
146log entries
How to review

Fixes

# Area Problem Fix Main files Tests Checked on VM
F1 Install (#638) A version-16 bench from the setup wizard fails: frappe[dev] does not resolve (pypika-stubs against frappe's PyPika fork). Every new dev bench failed. Install <app>[dev]; if it fails, warn and install the app without the extra. One install path for init and requirements. pilot/managers/environment.py, pilot/core/bench/runtime.py +2 Yes: wizard init completed
F2 Restore A config restore copied the source site's custom domains, certificate name and edge route into the target site. The restore keeps every protected key of the target (PROTECTED_CONFIG_KEYS is the one list). pilot/core/site/restore.py updated Yes: UI restore from another site
F3 Concurrency Domain changes and backup retention rewrote site_config.json in place, without the file lock. A domain change during a rename or restore could undo it. Read-modify-write under the file lock with an atomic replace. pilot/core/adapters/domain_provider.py, pilot/config/site_backup.py +1 No
F4 Concurrency A backup could start while a restore, rename or drop owned the site. The backup task takes the site:<name> resource key (409 when busy). admin/backend/api/v1/sites/backups.py +1 No
F5 TLS A certificate failure at the end of new-site failed the task, and the cleanup callback dropped the new site. No email or a certbot error leaves the site on HTTP with a message. pilot/core/site/provisioning.py +2 Yes: a real Let's Encrypt error kept the site
F6 TLS Without a Let's Encrypt email, a domain change failed before nginx was regenerated, so the domain was listed but not served. Domain changes always regenerate nginx; certificates are issued only when an email exists. pilot/core/site/domains.py +2 Yes
F7 TLS (ask email) Adding a domain without an email failed later in a task. The domain list says when an email is needed, and the Add Domain dialog asks for it on step 1. The API takes an optional email. Old clients keep working: without an email the domain is served over HTTP. admin/backend/api/v1/sites/domains.py, AddDomainDialog.vue +2 Yes
F8 TLS Enable SSL "succeeded" when no certificate was issued, then the action was hidden. The task fails when no certificate covers the site, so its TLS flag goes back and the action can be retried. pilot/tasks/setup_letsencrypt.py +1 Yes: retry from the UI
F9 TLS Domain rows showed TLS active with no certificate. A direct route shows TLS only when the certificate covers the domain. pilot/core/site/domains.py +1 No
F10 TLS A removed domain stayed in the certificate, so its renewal later failed for every domain of the site. Reissue unless the certificate names exactly the site's domains. pilot/managers/letsencrypt.py +4 Yes
F11 Config BenchConfig.default() shared one module-level common config, so a change on one config leaked to all others in the process. Deep copy per config. pilot/config/bench.py +1 n/a
F12 Database tuning MariaDB kept its old memory settings after a VM resize. The host monitor re-sizes MariaDB live when the unit's MemoryMax no longer matches the host's memory. The unit is written last, so a failed attempt is retried. A saved buffer pool too large for the new host is dropped. pilot/managers/database/mariadb.py, pilot/core/server/monitoring.py +6 Yes: 4 to 8 to 2 to 4 GB
F13 Updates (#596) A killed backup, migrate or update task left the operation in its phase forever, with no retry or revert. A failure/cancel callback moves the operation to "Needs attention" with a clear diagnosis. It keeps the touched tables for a revert and does nothing when the step already finished. pilot/core/bench/migration/operation.py, pilot/tasks/*.py +5 No
F14 CLI (#621) No pilot --version. Added. pilot/internal/cli/registry.py +1 n/a
F15 CLI pilot -y --site S cmd sent -y to Frappe. Leading Pilot flags stay with Pilot. pilot/internal/cli/dispatch.py +1 n/a
F16 CLI pilot remove logs could not run (missing package file). Added pilot/commands/remove/__init__.py. +1 n/a
F18 Apps (#639) Apps a site lists but the bench lacks (after a restore) showed as blank rows, could not be uninstalled, and broke the site asset build. Marked "Not on bench" (CLI: a warning on stderr); uninstall removes only the listing; builds skip them. pilot/core/site/apps.py, Apps.vue, UninstallAppDialog.vue +3 Yes: site 500 fixed from the UI
F19 Apps (#640) A fork showed the upstream app's website, docs and logo. Registry metadata is used only when the app's repository is the listed one. admin/backend/api/v1/sites/apps.py, Apps.vue +1 No
F20 Process managers gunicorn 26 opens a control socket at one fixed path per user, so every bench on a host shared it. Disable it in the admin and web configs; Pilot does not use it, and older gunicorn ignores the setting. pilot/managers/gunicorn/ +1 Pending
F21 UI Analytics said "1 vCPUs". Singular for one CPU. pages/Analytics.vue n/a No
F22 Site drop A drop with a backup still deleted the database when the backup failed (--force was always passed). --force only with --no-backup. pilot/core/site/__init__.py +2 Yes: drop with backup
F23 Backups A manual and a scheduled backup at the same time could return each other's files, and retention could delete the last complete run. Each backup writes into its own staging folder and moves only its files in. pilot/core/site/backups.py +1 Yes
F24 nginx A config that nginx -t rejected stayed on disk, so the next nginx restart would fail for every bench. The previous files are put back when validation fails. pilot/managers/nginx/__init__.py +1 Regenerate checked; failure path by test
F25 Backup schedule A backup schedule kept the old site name after a rename and stayed after a drop. Entries written from the CLI ran on the system Python, which cannot upload to S3. Rename moves it, drop removes it; cron jobs always run on the admin venv; removing a missing entry no longer rewrites the user's crontab. pilot/core/site/backups.py, rename.py, pilot/managers/cron.py +4 Yes: rename and drop on the VM
F26 Settings A change to http_port or socketio_port in Settings restarted the services on the new port, but nginx kept the old upstream, so every site answered 502. After a restart-triggering change on a production bench, Pilot regenerates nginx, also when the restart call times out (systemd still completes it). pilot/core/bench/settings.py +2 Yes: 8000 to 8020 and back
F27 Uptime A failed ping without an HTTP answer (TLS, DNS, timeout) was logged as up: false with no reason. The log entry and the site-down alert carry an optional error with the reason. pilot/core/site/uptime_monitoring.py +2 Yes: staging-certificate sites log the TLS error
F28 UI Enable SSL and revert-site tasks showed "Server" as their target, and the task list's site filter missed them. The task scope table names their site argument; a bench-wide Let's Encrypt task still shows Server. admin/frontend/dashboard/src/utils/taskFormat.ts +1 Yes: the Enable SSL task page shows the site
F29 Setup wizard A failed init in the wizard showed "Lost connection to the setup process". Init's rollback deleted tasks/, which held the running wizard task's own record, so the event stream broke and the failed task vanished from history. The rollback no longer removes tasks/; the task store owns it. The wizard now gets the failure and shows "Setup failed". pilot/core/bench/initializer.py +1 Yes: reproduced before, fixed after, with a failing init
F30 Bench drop pilot drop deleted a development bench while its pilot start or setup wizard kept running against the deleted directory. drop asks to stop the bench first. pilot/core/bench/production.py +1 Found on the VM (the wizard server outlived its bench)
F31 UI The memory split task showed the step "Giving MariaDB 65% of host memory", which did not match the setting's name. The task is "Set Memory Split" and its step is "Set the database memory split to 65%". pilot/tasks/set_mariadb_memory_share.py, admin/frontend/dashboard/src/utils/taskFormat.ts existing Yes: the task page shows the new names
F32 Install A shell for the bench user from su - frappe had no user bus, so systemctl --user failed until the operator exported two variables. When install.sh creates the bench user, it adds XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS to the user's .bashrc. An existing user is not changed. install.sh +1 Yes: systemctl --user status works after su - frappe
F33 nginx (review) The rollback of a rejected config compared a file and then rewrote it without a lock, so a newer config from another request could be lost between the two steps. Config writes and the rollback hold the file lock and replace the file atomically. pilot/managers/nginx/__init__.py existing Yes: nginx reload accepted, sites answer (HTTPS 200, HTTP 301)
F34 MariaDB (review) When a smaller memory split had to wait for MariaDB to release memory, the old unit limits stayed. my.cnf already recorded the host size, so every later start skipped the sizing. The sizing unit also sizes again when the unit limits do not match my.cnf, so the next start applies the lower limits. pilot/managers/database/mariadb.py +1 Yes: with old, larger limits left in the unit, a MariaDB restart put back the sized limits (1630M) in the unit and live
F35 Migrations (review) A chain task that finished its step but stopped before it queued the next task left the update in its phase with no task and no retry. The stopped-task callback checks that the task is still the last in the chain, then moves the operation to needs_attention. Retry queues the next step. pilot/core/bench/migration/operation.py, pilot/internal/tasks/callbacks.py +1 Yes: a real site migration with its backup done and no next task paused in needs_attention; Retry ran the migrate task and the operation completed, with maintenance mode restored
F36 Realtime (review) A bench whose Frappe does not read FRAPPE_SOCKETIO_UDS keeps listening on socketio_port, so nginx would proxy /socket.io to a missing socket. Pilot uses the socket only when apps/frappe/node_utils.js reads FRAPPE_SOCKETIO_UDS. pilot/core/bench/__init__.py +1 Yes: the version-16 production bench keeps the socket
F37 Build (review) The lockfile restore after a failed build could overwrite an edit that a person made during the build. Pilot no longer restores lockfiles. It records the content hash of each lockfile a failed build changed, in .git/pilot-failed-build-lockfiles.json; a recorded lockfile does not count as a local change until its content changes. pilot/core/app/__init__.py, pilot/internal/git.py +2 Unit tests
F38 Apps (review) D6 changed the uninstall default for the CLI, the API and saved tasks, which scripts relied on. The old default stays outside the dashboard. The dashboard sends remove_from_bench=false; the CLI has --keep-on-bench. pilot/commands/apps/uninstall.py, admin/backend/api/v1/sites/apps.py, admin/frontend/dashboard/src/api/sites.ts +3 Yes, after F42: a dashboard-style uninstall keeps the app on the bench; the CLI default removes it
F39 Build Pilot checked node_modules only in the app root, frontend and roster. Helpdesk builds desk, which its root postinstall installs, so an installed root hid a missing desk/node_modules and the build stopped with "vite: not found". Each build_dir in [tool.bench.assets] is checked and installed too. pilot/managers/python_assets.py, pilot/core/app/prebuilt_assets.py +1 Yes: with desk/node_modules removed, the Helpdesk build installs it and completes
F40 CLI pilot --site SITE drop-site passed through to Frappe and left the site in nginx, its domains and the backup schedule. Pilot had no CLI command for a site drop. New pilot drop-site SITE [--no-backup] runs Pilot's drop. Frappe's drop-site form through Pilot runs the same drop with --no-backup, --force and --archived-sites-path. pilot/commands/sites/drop.py, pilot/commands/runtime/frappe.py +9 Yes: pilot --site S drop-site S --force --no-backup leaves no site folder, nginx block or cron entry
F41 nginx All benches share one nginx. One bench could write its config while another ran nginx -t; the test failed on the first bench's untested files and the second bench rolled back a valid change. A config change holds the host lock benches/.nginx.lock from its first write until nginx reloads or the rejected files are put back. apply_config and publish_config replace the separate write, test and reload calls. pilot/managers/nginx/__init__.py and its callers +1 Yes: a config change waited 4.7 s for a holder of the lock, then nginx tested clean and the site answered 200
F42 Tasks A task runs from argv, and a bool field was passed only as a flag when true. A field that defaults to true could never reach the task as false: a dashboard uninstall still removed the app from the bench, and a rename with keep_old_hostname=false still kept the old hostname (the rename case is also on develop). Such a field has a --no- form, and the task argv uses it for false. pilot/internal/tasks/authoring.py, pilot/internal/cli/fields.py +2 Yes: found on the VM; the uninstall task gets --no-remove-from-bench and keeps the app
F43 Tasks The Admin runs the task worker and stops after 10 idle minutes. A task queued from the CLI, a script or a task process, or released with pilot tasks start, waited until the next Admin request. Without a task worker in its own process, Pilot starts the Admin service. Starting a running Admin does nothing. pilot/managers/task/control.py, pilot/managers/processes/systemd.py +3 Yes: with the Admin stopped, pilot tasks start started it
F44 Tasks After a reboot only the Admin socket started, so tasks queued before the reboot waited until someone opened the Admin. The Admin service starts at boot, waits up to 120 s for the bench's database, runs queued tasks and stops after its idle timeout. The start_admin_at_boot patch enables it on existing benches. pilot/managers/processes/systemd_render.py, pilot/patches/start_admin_at_boot.py +3 Yes: real reboot. A backup was queued with the Admin stopped. After boot the Admin started at 14:52:16, MariaDB at 14:52:19, and the worker ran the backup at 14:52:30 after its database wait; it succeeded
F45 Realtime nginx and the realtime unit chose socket or port from the Frappe code at the time each was written. pilot restart rewrites the unit without nginx, and a domain change rewrites nginx without the unit, so a Frappe change across v16 gave 502. nginx proxies realtime to an upstream with the socket first and the port as backup. max_fails=0 tries the socket on every request. pilot/managers/nginx/templates/bench.conf.template, pilot/core/bench/__init__.py +2 Yes: 200 on the socket, 200 on the port with no nginx change, 200 right after the switch back
F46 Backups A backup moved its files in one rename at a time, so retention could see part of a run. Two runs in the same second wrote the same file names. Publishing a run and retention's selection and local deletes hold one lock for each site (.backup_runs.lock); offsite deletes run without it. A run that would overwrite a run from the same second fails. pilot/core/site/backups.py +2 Yes: a backup published through the lock and retention ran
F47 Domains UI After a domain was added, its row showed TLS inactive until a page reload, with no sign that a certificate was on the way. The domain list returns certificate_pending while a certificate task is queued or running. The row shows "Certificate pending" and the list refreshes until the task ends. pilot/core/site/domains.py, Domains.vue +2 API value read on the VM. The badge was not seen in a browser
F48 Backups UI Uploaded backup files always had size 0, so the Admin showed "-" once the local copy was removed. The backup list reads each uploaded file's size from the bucket listing. Older uploads get sizes too, and the stored metadata keeps its shape. pilot/integrations/s3/backups.py, admin/backend/providers/backups.py +2 No: S3 is not configured on the VM
F49 Build (#437) Builds ran in a systemd-run --user scope when the host had systemd-run and a memory controller. Without a user bus, as for a supervisor bench started at boot, systemd-run exited 1 before the build started, so every build and an update's revert failed and the sites stayed in maintenance mode. The error named systemd-run, not the build command. Pilot starts a trial scope first and builds uncapped when it fails. A capped build error names the build command. pilot/managers/systemd_user.py, pilot/managers/python_assets.py +3 Yes: the check is true with the user bus and false without it
F50 Apps After an uninstall the app could still show as installed. Frappe clears its installed apps cache before it commits, so a process that reads in between caches the old list, and Frappe copies it to site_config.json, which the Admin reads first. This made the e2e step "Uninstall the app" fail often. After the uninstall, Pilot writes the committed installed_apps setting back to site_config.json when the copy differs. pilot/core/site/apps.py, pilot/core/site/config.py +2 CI: e2e (mariadb) passes. The committed list reads correctly on the VM
F51 nginx (review) A rejected change put back the previous files, then unpublished the bench anyway, so the next reload dropped its working sites. The bench is unpublished only when no config is left for it. pilot/managers/nginx/__init__.py +1 No

Decisions

The owner reviewed these items on 2026-10-15. D1 to D7 and D9 to D13 are approved and built. D8 is on hold.

# Topic What we found Proposal Cost Status
D1 App/database RAM split The split is hard-coded: MariaDB gets about half of the RAM (/2 and _MAX_HOST_MEMORY_SHARE = 0.5 in pilot/core/mariadb_memory.py). Gunicorn workers do not follow the host size. An optional memory_share (0.2 to 0.8, default 0.5) in [mariadb] of common_config.toml, used by the sizing and the Admin limits; a slider on the database settings page. See the mockup below. Small backend change, one UI control (needs mockup approval) Done. [mariadb] memory_share and a Memory split row in Settings, Database. Checked on VM: 65%, then back to 50% from the dialog (MemoryMax and pool as previewed).
D2 socket.io exposed Frappe's socket.io listens on *:9000 and answers from the internet. It bypasses nginx and the WAF. No host firewall is on by default. Use Frappe's socketio_uds (Unix socket) and proxy nginx to it, or bind to 127.0.0.1. Unit and nginx template change, patch for existing benches Done. systemd benches serve Node realtime on config/socketio.sock; nginx proxies to it; patch serve_realtime_on_unix_socket. Checked on VM: port 9000 closed, WebSocket 101 through nginx, restart after kill -9.
D3 Rename and Central Pilot sets the new name as primary when Central asks (make_primary). Central keeps the auto-routed site-xxxxx host as the record name and its URL. The image runs setup central --site-pattern without --redirect, so the alias is served, not redirected. Central: switch the shown URL to rename_target after the rename task succeeds. Pilot: when redirect is on, redirect the alias to site.primary, except /api/method/ping, which Central probes. Central change plus a small nginx change Done. Pilot keeps /api/method/ping on redirecting aliases; Central records renamed_at and shows the customer hostname (worktree fix/site-primary-url, 70 Central tests pass).
D4 Cloudflare proxy A domain behind the orange cloud fails the "points here" DNS check (409). Flexible SSL loops on the HTTP-to-HTTPS redirect. Client IPs are Cloudflare's. Accept Cloudflare IP ranges in the DNS check with a warning; an optional proxy.cloudflare setting for set_real_ip_from + CF-Connecting-IP; document "Full (strict)". Medium Done. Optional [proxy] cloudflare; Cloudflare addresses pass the DNS check with a warning; docs say Full (strict). Setting is in config, not in the UI. Checked on VM with real DNS; spoofed header not trusted.
D5 Certificate renewal Pilot never calls certbot renew. Debian and Ubuntu enable the certbot timer; Fedora and Arch do not, so certificates can expire there. No expiry alert. A Pilot user timer that runs renew and a reissue sweep, plus a notification under 14 days. Medium Done. Daily pilot-certificates.timer renews and alerts under 14 days. Checked on VM.
D6 Uninstall (#567) Uninstalling an app from its last site also removes it from the bench (documented, surprising). Keep the app on the bench; remove-app is the only removal. Keep the old behavior behind an optional flag. Small, changes default behavior Done, changed after review. An uninstall from the dashboard keeps the app on the bench. The CLI, the API and saved tasks keep the old default for compatibility; pilot uninstall-app --keep-on-bench and remove_from_bench=false keep the app.
D7 Marketplace escape hatch A marketplace app follows registry releases only; a developer's branch with no release never gets updates. Fall back to the branch tip when the registry lists no release for that branch, or an opt-in per app. Small Done. Branch tip when the registry has no release for the branch, or follow_branch = true per app.
D8 Bench parity No pilot update, drop-site, domain, switch-branch, pip, backup schedule or renew-lets-encrypt CLI. wkhtmltopdf is not installed. Thin CLI commands over the existing core and tasks, in priority order of the parity table. Medium On hold (owner).
D9 MariaDB pool after upsize innodb_buffer_pool_size_max is read-only, so after an upsize the larger pool waits for the next MariaDB restart. Accept, or restart MariaDB once at boot when the host grew (issue #528 asks for no automatic restart). Small Done. pilot-mariadb-sizing.service re-sizes before each MariaDB start when memory changed by 100 MB or more. Checked on VM: 4 GB to 2 GB resize, boot in 26 s.
D10 pilot restart exit code pilot restart on a development bench or an incomplete production deployment prints guidance and exits 0, so a script cannot tell that nothing restarted. A fix was built and then reverted after review, because scripts may rely on exit 0. Exit 1 in a later release with a release note, or add an optional --strict flag. Small Done. pilot restart exits 1 when nothing restarted.
D11 Source build on small hosts A 2 GB host without swap cannot build Helpdesk from source: the build cap stops it cleanly. But the failed build's yarn install rewrote a tracked yarn.lock, and Pilot counts that as a source change, so it then refuses the prebuilt assets for that app too. Freeze the lockfile during Pilot's installs, or ignore a yarn.lock that only Pilot's install changed. Also #572 (swap during builds). Small to medium Done. Build swap helper adds 2 GB swap during builds on hosts with less than 3 GB free. Checked on VM: Helpdesk source build on 2 GB succeeded (40 min at 0.5 vCPU), swap removed after. Owner follow-up: a failed build now puts back the lockfiles its installs changed.
D12 Stranded task A crash between the worker marking a task running and writing process.json leaves the task running forever and its resource keys blocked. Reconcile every running task, not only those with process.json. Small Done. Reconcile interrupts running tasks without process.json.
D13 Concurrent nginx changes Two benches can regenerate the shared nginx config at the same time. With the new rollback, one bench's rollback could overwrite the other's accepted file. There was no host-wide lock before either. A host-wide nginx lock around generate, validate and reload. Small Done. Rollback restores a file only if it still holds what this change wrote.

D1 mockup: memory split (approved)

Memory split
Apps 50% · Database 50% of 3.8 GB
Memory split

Choose how much memory the database may use. The rest stays for web, workers and Redis.

Apps 1.9 GBDatabase 1.9 GB
InnoDB buffer pool353 MB
Database memory limit (MemoryMax)1092 MB
CancelApply
Approved and built. One row in Settings, Database, and a dialog with a slider (20% to 80%). Apply re-sizes MariaDB live.

Test guide and proposed commits

Test setup

Use one disposable Ubuntu 24.04 VM. Do not use a production host.

  1. Install Pilot from the branch in development mode: curl -fsSL <install.sh> | bash -s -- --dev, then put the branch checkout in ~/pilot.
  2. Create two benches: version-16 with ERPNext and develop in lite mode. Run pilot setup production on both with an admin domain.
  3. Use a wildcard DNS name that points to the VM, for example *.ip-<a-b-c-d>.swiftwave.xyz. Use the Let's Encrypt staging CA for repeated tests (server = https://acme-staging-v02.api.letsencrypt.org/directory in /etc/letsencrypt/cli.ini).
  4. After each code change, copy the changed files to the VM and restart the Pilot services. Run pilot admin run-patches when a patch was added.

How to check each change

Item Command or action on the VM Expected result
D2 realtime curl -m5 "http://<vm-ip>:9000/socket.io/?EIO=4&transport=polling" and open a site in a browser No answer on port 9000. The site's realtime connects through /socket.io. ss -lx shows config/socketio.sock.
D4 Cloudflare Set [proxy] cloudflare = true in common_config.toml, then add a domain that uses Cloudflare's proxy The domain is added with a warning. nginx -T shows real_ip_header CF-Connecting-IP.
D9 sizing Resize the VM (for example 4 GB to 2 GB) and boot journalctl --user -u pilot-mariadb-sizing says "Sized MariaDB for N MiB". MemoryMax of pilot-mariadb.service follows the new size.
D1 memory split Settings, Database, Memory split, set 65% my.cnf and MemoryMax change. The running pool changes now; a larger pool waits for the next start.
D11 build swap pilot -b main build --apps helpdesk --force on a 2 GB VM swapon --show lists /var/lib/pilot/build.swap during the build, and it is gone after. The build does not hit the memory cap.
D5 renewal systemctl list-timers pilot-certificates.timer The timer is active and runs daily.
D6 uninstall Uninstall an app from its last site The app stays on the bench. --remove-from-bench removes it.
D10 restart pilot restart on a development bench; echo $? Exit code 1 with guidance.
F26 ports Change the HTTP port in Settings on a production bench Sites keep answering. nginx points to the new port.
F5 to F10 TLS Add a domain without a Let's Encrypt email, then with one Without an email, the domain serves on HTTP and the dialog asks for an email. With one, the certificate covers exactly the site's domains.

Greptile review of #643

Greptile reviewed the PR 11 times. Review 11, on e56a89a2, scored it 5/5 (safe to merge) with no open threads. Each finding was checked against the code and got the smallest code fix. On the owner's request, the three findings first left as by design were fixed too.

Finding Severity Outcome
nginx rollback can erase a newer config P1 Fixed: F33 (5346ccc2).
A deferred shrink of the MariaDB limits never applies P1 Fixed: F34 (baa0f9fb).
A migration task stopped before its handoff gets stuck P1 Fixed: F35 (ad1715d6).
fail_stopped_step is above the complexity limit P2 Fixed: 4e7d6cab moves the site step marking into its own method.
The daily certificate renewal has no tests P2 Fixed: ba4e9478 tests the timer install and the daily run, also when certbot fails.
Older Frappe versions lose realtime P1 Fixed: F36 (8f464ab9). Pilot uses the socket only when the bench's Frappe reads FRAPPE_SOCKETIO_UDS.
Uninstall changes its default P1 Fixed: F38 (36117ff6). The old default stays for the CLI, the API and saved tasks; the dashboard asks to keep the app.
A failed build can discard a person's lockfile edit P1 Fixed: F37 (60661460). Pilot records the hashes of the build's lockfiles and does not change the files. A first fix that kept a copy (0ca68073) did not satisfy the review.
drop-site broke existing scripts and lacked --force P1 Fixed: 946893d2. Frappe's form runs Pilot's drop with Frappe's options.
A hung domain provider blocked nginx on every bench P1 Fixed: 37aa4805 and e56a89a2. Renders ask the provider before the lock, with a 30 s timeout; route removal never asks it.
The site app list hid every lookup error P2 Fixed: 2ada7cf3. Only expected errors are caught, and they are logged.
Hashing every changed file wasted memory P2 Fixed: f8fa096f.

Commits

The branch fix/bughunt holds 81 commits, one purpose for each commit, in this order. They are pushed as https://github.com/frappe/pilot/pull/643. Commits 37 to 81 came after the PR opened: the memory split task name, the bench user's shell, the fixes for the Greptile review, the mypy fix, the pre-release fixes F39 to F42, the fixes for Greptile reviews 3 to 10, F43 to F49, and the fixes for Greptile reviews 12 to 23, and F50. Greptile review 24 is 5/5, every CI check passes, and GitHub reports the pull request as mergeable. The branch also merges develop. Commits 1 to 24 passed ruff and the full unit suite alone. The same check for the later commits is running; its results will be added here.

# Commit Subject
1 f2cb1eb9 fix(install): Install apps without the dev extra when it does not resolve
2 f755394e fix(restore): Keep protected site config keys on a config restore
3 96aacbe1 fix(sites): Lock and atomically write site config for domains and backups
4 d495397f fix(backups): Isolate backup runs and take the site resource key
5 2c2179e6 docs(api): Describe backup conflicts and the keys a restore keeps
6 0d249b9c fix(config): Copy the default common config for each bench
7 6b32198c fix(tls): Keep a site on HTTP when its certificate fails
8 3d57414f feat(ui): Ask for the Let's Encrypt email when a domain is added
9 6cd63e22 fix(tasks): Fail interrupted migration steps and reconcile stranded tasks
10 e5888e23 docs(cli): Describe the dev extra fallback of pilot init
11 48681e3d fix(cli): Add --version, keep leading Pilot flags, and fix remove logs
12 a07245b8 fix(apps): Show apps that the bench lacks and keep fork metadata
13 2a013084 fix(gunicorn): Disable the per-user control socket
14 75e11159 fix(apps): Build site assets only for the apps on the bench
15 388098bb fix(sites): Pass --force to drop only with --no-backup
16 19787139 fix(nginx): Roll back a rejected config only when it is unchanged
17 ffed18a5 fix(backups): Move backup schedules on rename and remove them on drop
18 2c5e72d4 fix(settings): Regenerate nginx after a port change
19 53cebe95 fix(settings): Wait past systemd's stop timeout on restart
20 7085ac2b fix(uptime): Record why a ping failed
21 bae6b41c test(nginx): Let root-run nginx workers read the test directory
22 a6a312da fix(cli): Exit 1 when pilot restart restarts nothing
23 b75cad82 fix(database): Size MariaDB before each start after a memory change
24 38cb44c3 feat(database): Add the apps and database memory split
25 ac535395 feat(apps): Keep the app on the bench after its last uninstall
26 d901f099 feat(apps): Follow the branch tip when the registry has no release
27 28255d41 feat(tls): Renew certificates daily and alert before expiry
28 84f83c7e feat(build): Add swap during builds on small hosts
29 c4ef16b7 fix(build): Restore lockfiles after a failed build
30 4964fdb8 fix(domains): Redirect renamed aliases to the primary domain
31 425d7449 feat(proxy): Support domains behind Cloudflare's proxy
32 ce4b9b08 fix(realtime): Serve socket.io on a Unix socket behind nginx
33 48fc6042 fix(ui): Use the singular vCPU label
34 37c72488 fix(ui): Show the site of Enable SSL and revert tasks
35 6ed6f6c1 fix(init): Keep task records when a failed init rolls back
36 26ce73c4 fix(bench): Refuse to drop a development bench that is running
37 6c46ee07 fix(ui): Name the memory split task like the setting
38 45383dbb feat(install): Point a new bench user's shell at its user bus
39 5346ccc2 fix(nginx): Lock config writes and the rollback of rejected files
40 baa0f9fb fix(database): Apply deferred lower memory limits at the next start
41 ad1715d6 fix(tasks): Pause a migration when a task stops before it queues the next
42 fbc4cd80 docs(production): Remove the Frappe version condition for the realtime socket
43 4e7d6cab refactor(tasks): Move marking a stopped site step failed into its own method
44 ba4e9478 test(letsencrypt): Cover the renewal timer and the daily renewal run
45 8f464ab9 fix(realtime): Keep the port when Frappe does not read the socket path
46 0ca68073 fix(build): Keep a copy of each lockfile that a failed build restores
47 36117ff6 fix(apps): Keep the old uninstall default for the CLI, API and tasks
48 60661460 fix(build): Record a failed build's lockfiles instead of restoring them
49 94359997 fix(api): Type the site app list entries for mypy
50 f8fa096f perf(build): Hash a changed file only when its lockfile hash is recorded
51 18d58bdd fix(build): Install JS dependencies in each declared build dir
52 7d0a1038 fix(cli): Add pilot drop-site and refuse Frappe's drop-site
53 ebe36682 fix(nginx): Serialize config changes across benches with a host lock
54 944f280a fix(tasks): Pass false to the task for a flag that defaults to true
55 946893d2 fix(cli): Run Frappe's drop-site form through Pilot's drop
56 37aa4805 fix(nginx): Ask the domain provider before taking the host lock
57 2ada7cf3 fix(api): Catch only expected errors when reading site app details
58 e56a89a2 fix(nginx): Remove a bench's routes without asking the domain provider
59 b53822f9 fix(tasks): Start the Admin for a task queued outside it
60 2f4f6512 fix(tasks): Start the Admin at boot to run tasks queued before a reboot
61 0459ae55 fix(nginx): Try the realtime socket first, then the port
62 154f40b1 fix(backups): Publish a backup run and apply retention under one lock
63 e2d20f98 feat(domains): Show a pending certificate on the domain list
64 1f1e804e fix(backups): Show the size of uploaded backup files
65 7754257d fix(build): Build uncapped where systemd-run cannot start a scope
66 ea382f71 test(tasks): Stub the Admin start in the tasks start command test
67 5b17bb32 fix(tasks): Wait for the bench database before the first task runs
68 6b41383c fix(backups): Delete offsite runs outside the backup runs lock
69 84d4bbd2 fix(ui): Stop the domain list refresh after the page closes
70 5f447ca9 perf(backups): Read uploaded file sizes only for the listed runs
71 c1790a1d fix(tasks): Stop the database wait when the Admin drains
72 d42cde79 fix(nginx): Keep a published bench in nginx when a change is rejected
73 52f244a6 refactor(patches): Split the MariaDB sizing patch check and tighten comments
74 dbb2d599 docs(api): Describe certificate_pending on the domain list
75 1a12ae20 chore: Shorten comments and docstrings added for the bug hunt
76 658b54fa refactor: Keep functions changed for the bug hunt at complexity 8 or less
77 373c6fa9 refactor(patches): Name the patch bench checks with is_ and has_
78 d6e314a5 fix(apps): Put back the committed app list after an uninstall
79 1f9ce2aa fix(database): Save a memory share only after MariaDB is sized for it
80 2c854552 fix(build): Warn when the swap helper cannot run
81 6fa219f3 refactor(certificates): Check the renewal timer separately from installing it

Central: 7b7ede6b fix(sites): show the customer hostname after the rename lands on branch fix/site-primary-url, pushed as https://github.com/frappe/central/pull/491.

Open items

These items are not done. Each row says why and what the next step is.

Item State Next step
Pull requests Pilot: https://github.com/frappe/pilot/pull/643 (fix/bughunt). Central: https://github.com/frappe/central/pull/491 (fix/site-primary-url). Review and merge.
D8 bench parity On hold (owner). See the parity table.
D4 setting in the UI Owner decision: config only. None.
Integration tests Fixed in the test: run as root, the throwaway nginx now uses user root;, because its nobody worker could not read pytest's private temp directory (that failure was also on clean origin/develop). On the VM as root: 4 of 4 pass. On a laptop without root, nginx cannot start. Run them in CI or on a test VM as root.
Merge method Commits 12 to 49 fail mypy alone (fixed in 94359997); each passes ruff and the unit suite. Squash-merge.

Upgrade notes

Read this before you upgrade a host. It lists what runs by itself, what an operator must do, and what changes for scripts and clients.

Runs by itself on upgrade

pilot admin upgrade runs these patches once for each bench:

Patch What it does Effect on a running host
install_mariadb_sizing_unit Installs pilot-mariadb-sizing.service, which sizes MariaDB before each start. None until the next MariaDB start.
install_certificate_renewal_timer Installs the daily pilot-certificates.timer on hosts that use Let's Encrypt. None. It runs 15 minutes after boot, then daily.
serve_realtime_on_unix_socket Moves Node realtime from socketio_port to config/socketio.sock on systemd production benches, then reloads nginx. socket.io restarts once. Clients reconnect in a few seconds.
start_admin_at_boot Enables the Admin service for default.target on systemd production benches, so it starts at boot and runs queued tasks. None until the next boot. After a boot the Admin runs until it is idle for 10 minutes.

Operator action

Action Why Without it
Run the root phase of install.sh again Installs /usr/local/sbin/pilot-build-swap and its sudoers rule (D11). Builds run as before, without the temporary swap.
Cloudflare: set [proxy] cloudflare = true in common_config.toml nginx takes the client IP from CF-Connecting-IP (D4). Set Cloudflare to Full (strict). Domains behind Cloudflare still pass the DNS check, but logs and rate limits see Cloudflare's addresses.
Optional: close socketio_port (default 9000) in a host firewall systemd production benches no longer listen on it. Nothing changes.

Changes for scripts and clients

All changes are additive, except one behavior change that the owner approved: pilot restart exits 1 when nothing restarted (D10).

Surface Change
CLI New: pilot --version; pilot uninstall-app --keep-on-bench; pilot drop-site. Behavior: pilot --site S drop-site and pilot frappe drop-site run Pilot's drop with Frappe's options; pilot restart exits 1 when nothing restarted (D10); pilot drop refuses a running development bench (F30).
Admin API New optional fields: email on POST /sites/<name>/domains; certificate_email_required and certificate_pending on the domain list; is_marketplace and missing on app rows; remove_from_bench=false on app uninstall (the dashboard sends it). New route: POST /database/quick-actions/memory-share.
Config New optional keys: [mariadb] memory_share and [proxy] cloudflare in common_config.toml; follow_branch for an app in bench.toml.
Tasks New command: set-mariadb-memory-share. Existing task records keep their shape. setup-letsencrypt without a certificate for its site now fails instead of reporting success (F8).
Logs and alerts The uptime log and the site-down alert can carry an error field (F27).
Frappe versions Pilot supports Frappe v16 and later. The realtime socket depends on that.
Locks nginx config changes from every bench on the host wait for benches/.nginx.lock. A stuck process that holds it blocks nginx changes until it exits. Backup publishing and retention for a site wait for .backup_runs.lock in the site folder. A backup that would overwrite a run from the same second fails.
Admin A task queued outside the Admin (CLI, script, task process) or released with pilot tasks start starts the Admin service.
Realtime On systemd benches nginx tries the realtime socket first, then socketio_port.
Files Pilot writes a bench's nginx and ModSecurity config files with mode 0600. nginx reads them as root, so nothing else changes.
Builds After a failed source build, Pilot records the app's changed lockfiles in .git/pilot-failed-build-lockfiles.json and leaves the files as they are.
Install install.sh adds the user bus variables to .bashrc only when it creates the bench user.

Test results

Test host

One Ubuntu 24.04 VM, resized during the tests. Pilot develop (--dev install) plus the local fixes, Frappe version-16, production with systemd and nginx. Certificates come from the Let's Encrypt staging CA, because the test domains share one rate limit.

End-to-end checks

Check Result
Root install, then install.sh --dev as the bench user Pass. The first pilot start builds 3 frontends: about 12 minutes on 1 vCPU, most of it npm install.
Setup wizard, version-16, MariaDB Failed before F1 (#638). Pass after F1, including a retry of the failed init.
setup production --admin-domain ... --tls Pass in 14 s. Admin served over HTTPS.
New site from the Admin UI Pass. HTTPS 200.
Site lists an app the bench lacks Site returned 500. After F18 the UI shows "Not on bench" and uninstall brings the site back to 200.
Resize 4 GB to 8 GB MariaDB re-sized about 1 minute after boot: MemoryMax 1092M to 3048M, pool 1568M in my.cnf. The live pool stays at the old maximum until the next MariaDB restart (D9).
Resize 8 GB to 2 GB Re-sized to MemoryMax 512M, pool 128M. No OOM. Site 200.
Resize 2 GB to 4 GB Re-sized to MemoryMax 1092M. Site 200.
Add a domain without an email (UI) The dialog asked for the email; it was saved and the certificate covered both names.
Remove that domain The certificate was reissued without it.
Rename site1 to erp (keep old name) The new name is primary; both names serve the site; the certificate covers both.
ERPNext get-app and install (UI) Pass: 4 min 42 s and 75 s on 1 vCPU.
Second bench on Frappe develop Init 2 min 41 s, production 12 s, lite mode (one process), site with TLS in 38 s.
New site while Let's Encrypt is busy The site stayed on HTTP; Enable SSL later issued the certificate.
Restore another site's backup with its config The target kept its own domains and certificate settings.
Kill the backup task of an update (#596) The update moved to Needs attention; Retry completed it.
Backup schedule, then rename, then drop The schedule followed the rename and was removed by the drop; the drop took its backup first.
Four VM resizes (reboots) Both benches came back without help each time; MariaDB re-sized every time.
D2 realtime (patch on a running bench) Port 9000 closed from the internet; socket.io polling and WebSocket (101) work through nginx; Node restarts after kill -9; survives a reboot.
D4 Cloudflare Cloudflare-proxied hosts pass the DNS check with a warning; with cloudflare = true nginx -t passes and a spoofed CF-Connecting-IP from a non-Cloudflare client is ignored.
D3 alias (Pilot side) The alias redirects 301 to https://<primary>; /api/method/ping on the alias answers pong.
D1 memory split (UI) 65% to 50% from the dialog: MemoryMax 1092M and pool 312 MB, as previewed.
D9 resize 2 GB to 4 GB Sized before MariaDB started; boot in 13 s.
F26 port change in Settings Before: 502. After: nginx follows the new port, also when the restart call times out.

Memory use

State Host Used Main processes
Idle, one site, production 1 vCPU, 4 GB about 1.0 GB mariadbd 170 MB, gunicorn master + 2 workers 377 MB, worker pool 214 MB, socket.io 69 MB, admin 83 MB
New site from the UI (peak) 1 vCPU, 4 GB 2.1 GB from the dashboard graph
ERPNext get-app (peak) 1 vCPU, 4 GB 1.65 GB 2.26 GB still available, no OOM
ERPNext install on a site (peak) 1 vCPU, 4 GB 1.8 GB
Idle with ERPNext 1 vCPU, 4 GB 1.05 GB mariadbd 237 MB
Idle after boot 0.5 vCPU, 2 GB 0.73 GB MariaDB at 128M pool
Two benches (version-16 classic + develop lite) 1 vCPU, 4 GB 1.26 GB the lite bench adds one 123 MB process
Two benches, idle 0.5 vCPU, 2 GB 0.79 GB 1.17 GB available
Helpdesk get-app with prebuilt assets (peak) 0.5 vCPU, 2 GB 0.94 GB 52 s, no build
Helpdesk forced source build 0.5 vCPU, 2 GB stopped at the cap The kernel killed only the build cgroup; MariaDB and sites kept running; clear message to add swap
Helpdesk forced source build with build swap (D11) 0.5 vCPU, 2 GB 1.76 GB + 1.5 GB swap Pass in 40 min (CPU-bound at 0.5 vCPU); swap removed after; no OOM

Unit tests

Full unit suite (tests/pilot and tests/admin): 3345 passed, 1 skipped. Ruff clean. vue-tsc clean. Three second-opinion passes (Codex, read-only): 7 issues in the first diff, all fixed or reverted; 6 issues in untested areas, 5 fixed and 1 logged (D12); 4 issues in the later fixes, 2 fixed and 2 logged (D13 and a narrow backup window).

bench parity

Every Frappe site command works through Pilot: pilot --site S <command> or pilot frappe --site S <command>. The table lists the bench commands that are bench-level. "By design" means Pilot does the job another way; it is our reading of the architecture, because no Pilot document lists bench commands as out of scope.

bench Pilot Status
init pilot new + pilot init (branch and Python come from bench.toml or the wizard) OK
get-app, new-app, remove-app same names OK
start, restart pilot start, pilot restart OK
backup-all-sites pilot --site all backup OK
setup production, nginx, supervisor, systemd pilot setup production, pilot setup nginx OK
setup requirements, setup config, setup redis pilot setup requirements, pilot setup config OK
setup lets-encrypt pilot setup letsencrypt OK
disable-production pilot remove production OK
config set-common-config pilot frappe set-config -g OK
update (--pull --patch --build --apps --no-backup) Admin API only Gap
retry-upgrade Admin API only Gap
switch-to-branch Admin API only Gap
setup add-domain, remove-domain Admin API only Gap
drop-site pilot drop-site SITE; Frappe's form through Pilot runs the same drop OK
renew-lets-encrypt none (see D5) Gap
setup backups Admin schedule only Gap
pip none (uv venv has no pip) Gap
install wkhtmltopdf not installed by install.sh Gap
setup wildcard-ssl, set-ssl-certificate none (Let's Encrypt HTTP-01 only) Gap, low
migrate-env, completions, setup fonts none Gap, low
exclude-app, validate-dependencies, src, find, app-cache, install *, setup sudoers, setup procfile, setup firewall done another way: Admin app selection, automatic validation, fixed benches directory, prebuilt assets, install.sh, own process runner, [firewall] By design

Plan and status

Goal

Make Pilot stable, correct and light on resources for production use. Find bugs on a real VM, fix the small ones, and record every finding. Test with Frappe version-16 and develop. Bug fixes only: no new features unless a bug needs one.

Ground rules

Workstreams

# Area Work Status
1 Setup Install develop Pilot on the VM (--dev), wizard init on version-16. done: install pass, wizard init pass after F1
2 Database tuning MariaDB settings must follow the host size after a resize. Find why they do not. fixed (F12), checked with 3 real resizes
3 Database tuning RAM split between app and database (a slider in the UI). Investigate and propose. built (D1), checked on the VM
4 TLS Ask for the Let's Encrypt email in the UI instead of failing. Ask before a custom domain is added. fixed (F5 to F10); renewal timer (D5)
5 TLS A wildcard domain that a proxy serves must not go into certificate renewal. already correct for provider routes; 2 small gaps logged
6 Proxy Cloudflare proxy (orange cloud): issuance, renewal, real client IP, redirect loops. built (D4): optional [proxy] cloudflare, DNS check accepts Cloudflare
7 Domains After a site rename, the new domain must be primary, not the random one (Central and Atlas auto routing). built (D3) in Pilot and Central
8 Restore Restoring site config must not add back old custom domains. fixed (F2)
9 Apps Apps in Installed Applications but not on the bench show in the app list (after a restore). Issue #639. fixed (F18), checked in the UI
10 Apps Marketplace app escape hatch: update from a git branch. Investigate only. built (D7)
11 Parity Compare every frappe/bench command with Pilot. List what is missing and not left out by design. table done; CLI bugs fixed (F14 to F16), restart exit code in D10; gaps in D8
12 Resources Measure memory at idle and during build, migrate, backup. Check build limits. done: idle, ERPNext build; build swap (D11) for source builds on 2 GB
13 Versions Full flow with Frappe version-16 and develop. done: both benches in production on one host
14 Issues Fix small reported bugs from frappe/pilot issues. #638 #639 #640 #596 #621 fixed
15 UI Walk every Admin UI page in Chrome. Note inconsistencies. main pages walked; small issues in the log
16 Security socket.io answered on a public port past nginx. fixed (D2): Unix socket behind nginx

Reported issues in scope

Issue Title Status
#639 App lists out of sync (site lists apps the bench does not have) fixed (F18)
#640 Forked app shows upstream repository and links fixed (F19)
#567 Uninstall from a site also removes the app from the bench changed (D6): the app stays on the bench
#579 Validator crashes on syntax errors instead of reporting them already fixed on develop (f5c9308b)
#596 Killed backup during update leaves a "backing up" loader fixed (F13)
#638 version-16 bench install fails with the dev extra fixed (F1), checked on the VM
#621 No pilot --version fixed (F14)
#408 Init fails without passwordless sudo when redis is missing not changed: the root phase of install.sh installs redis; the error already names the package (feature request for a preflight)

Log

Every step, newest first. The source is an append-only log in the repository checkout.

Show the full log
  • 2026-10-15 Greptile review 10 (4/5): uninstall_config must not depend on the provider; fixed e56a89a2 (provider asked only by renders, before the lock). Review 11: 5/5, safe to merge, no open threads.
  • 2026-10-15 Greptile review 9 (3/5): drop-site compat (946893d2, Frappe form routed to Site.drop with --force/--no-backup/--archived-sites-path; VM ok), provider asked before the host lock + 30 s timeout (37aa4805), site app list catches only expected errors (2ada7cf3). e2e mariadb 'Uninstall the app' fails on and off on develop too (Blog stays installed on the site). Full suite 3381 passed. Pushed.
  • 2026-10-15 VM checks: F34 (stale larger unit limits fixed by the sizing unit at restart, 1630M file and live, site 200), F35 (real erp migration: backup done, fake killed tail task, callback -> needs_attention, retry -> migrate task ran -> completed, maintenance restored), F38 found F42: bool task fields that default to true could not be false in the task argv (uninstall remove_from_bench, rename keep_old_hostname on develop too); fixed 944f280a with --no- flags; VM: dashboard-style uninstall keeps app, CLI default removes. Note: task worker runs in the Admin process; a socket-activated idle Admin leaves CLI-queued tasks waiting until the next Admin request.
  • 2026-10-15 F41 host nginx lock (ebe36682): benches/.nginx.lock held from first write to reload/rollback; apply_config/publish_config replace write+test+reload pairs; tests use a no-op lock (autouse) plus one real-lock test. VM: a reload waited 4.7 s for a lock holder, nginx -t ok, site 200. Full suite 3370 passed, pinned ruff + mypy clean. Pushed.
  • 2026-10-15 Pre-release fixes on owner request: F39 declared build dirs get JS deps (18d58bdd; VM: Helpdesk build with desk/node_modules removed installs it and completes), F40 pilot drop-site + refuse Frappe drop-site passthrough (7d0a1038; VM: create+drop leaves no site/nginx/cron, passthrough exit 1). Full suite 3369 passed, pinned ruff and mypy clean. Pushed; PR body updated.
  • 2026-10-15 Greptile review 5: 5/5, one P2 (hash only recorded lockfiles) fixed f8fa096f. mypy CI failure (dict entry types in site apps list, from a07245b8) fixed 94359997.
  • 2026-10-15 Greptile review 4 scored 4/5 with one open P1 (lockfile restore overwrites edits; the copy fix 0ca68073 was not enough). Replaced the restore with a hash record of the failed build's lockfiles (60661460), discard_changes removed. Full suite 3363 passed. Pushed.
  • 2026-10-15 Owner asked to fix all Greptile findings: realtime socket only when Frappe reads FRAPPE_SOCKETIO_UDS (8f464ab9, VM main bench keeps the socket), lockfile restore keeps copies in .git/pilot-discarded (0ca68073), old uninstall default for CLI/API/tasks with dashboard remove_from_bench=false and --keep-on-bench (36117ff6). Full suite 3362 passed, vue-tsc clean. Pushed; PR body updated.
  • 2026-10-15 Status page: commit table regenerated from git (44 commits), F31 to F35 and the Greptile table added. Per-commit check restarted for commits 25 to 43 (the scratchpad with earlier results was cleared; commits 1 to 24 had passed).
  • 2026-10-15 Greptile #643 review 2 (score 1/5): split fail_stopped_step for the complexity limit (4e7d6cab); tests for the renewal timer and daily run (ba4e9478). D6 default, v16-only realtime and the lockfile edge case left as by design. Full suite 3358 passed. Pushed.
  • 2026-10-15 Greptile #643 review 1: fixed nginx rollback lock (5346ccc2), deferred MariaDB shrink (baa0f9fb), stopped-before-handoff migration (ad1715d6), stale realtime docs (fbc4cd80); lockfile restore finding left as by-design. VM: nginx reload ok, include.conf 0600, site 200/301.
  • 2026-10-15 PRs opened: Pilot https://github.com/frappe/pilot/pull/643 (38 commits, closes #638 #639 #640 #596 #621 #567 #572, refs #528 #603), Central https://github.com/frappe/central/pull/491. HEAD check before push: ruff clean, 3354 passed, vue-tsc clean, dashboard tests 79 pass. Per-commit full-suite check still running.
  • Extra fixes found while committing: test_cron depended on a local .admin-venv; stale tune_if_resized comment; duplicate assets test dropped in favour of the updated test_build_task; F30 pilot drop refuses a running dev bench; docs for D5 timer, D11 swap and D3 alias.
  • History was rewritten locally three times with git plumbing (no stash, no worktree change): commit 1 missed its test_commands updates; the F11 config copy had to come before the TLS commit (a TLS test depended on it); a -U1 hunk put memory_share under [postgres] in the docs (hunk context switched to -U3). Backup branches: backup/bughunt-before-*.
  • 36 local commits on fix/bughunt (6f142bc5..HEAD), one purpose each; Central 7b7ede6b on fix/site-primary-url. Nothing pushed. Working tree equals HEAD except the owner's package-lock files.
  • Finding (not changed): pilot -b wiztest drop deleted the bench but left its wizard admin server (run_server --wizard, started by pilot start) running; killed by hand.
  • Fix: drop tasks from _BENCH_DIRS (init never creates it; the task store owns it). Test: a failed init keeps task records and still removes apps. VM after the fix: queued -> running -> failed -> done (exit 1); the record and output stay; rollback still ran. Bench dropped afterwards.
  • Reproduced on the VM with the old code: throwaway bench wiztest (sqlite) with a missing frappe repo URL, WizardSetupTask run by pilot -b wiztest start, stream read with TaskReader: status queued -> running -> STREAM BROKE TaskNotFoundError; tasks dir left with only .store.lock.
  • Root cause: BenchInitializer._rollback -> _remove_bench_dirs deleted _BENCH_DIRS, which included tasks. The wizard runs init as WizardSetupTask, so a failed init deleted its own task record and output. TaskReader.stream_output then raised TaskNotFoundError, the SSE stream broke without done, the browser's reconnect got 404 (EventSource CLOSED), and the wizard showed "Lost connection to the setup process" instead of "Setup failed". The failed task also vanished from history, and the task worker crashed recording the failure.
  • VM: a forced failing build (512 MB cap, desk/node_modules removed) failed earlier than intended ("vite: not found": Helpdesk installs desk/ from a root postinstall, and Pilot skips the install while the root node_modules exists), so it did not exercise the restore. Repo clean after; restored deps with yarn install --frozen-lockfile and prebuilt assets (5 s); bench.toml restored; site 200. Finding: Pilot does not notice a missing nested node_modules that a root postinstall owns.
  • D11 lockfile: App.restore_lockfiles_on_failure() wraps the source build in build_assets_for_app (now split into build_app_from_source). On failure it discards lockfile changes (yarn.lock, pnpm-lock.yaml) that were not there before the build, with new GitRepo.discard_changes (checkout tracked, delete untracked). Developer edits made before the build stay. Tests +3 with a real git repo. docs/prebuilt-assets.md updated.
  • Restart: _restart_systemd waits 120 s (above systemd's 90 s default stop timeout).
  • Owner chose: restart wait 120 s; restore yarn.lock after a failed build; Cloudflare stays config only; commit one at a time.
  • Status page: added "Upgrade notes" (patches that run on upgrade and their effect, operator actions: install.sh root phase for the build swap helper, Cloudflare setting, optional closing of port 9000; and every change to CLI, Admin API, config, tasks and logs). Checked against the diff: timer OnCalendar=daily with RandomizedDelaySec=1h; API fields certificate_email_required, is_marketplace, missing, memory_share.
  • F28 task scope: the dashboard's SITE_ARG_KEY lacked setup-letsencrypt and revert-site, so Enable SSL and revert-site tasks showed "Server" as their target and were missing from the site filter. Added both; a bench-wide Let's Encrypt task (empty site) still shows Server. Dashboard tests 79 pass, vue-tsc and Biome clean. VM: rebuilt dashboard; the Enable SSL task for site2 now shows the site.
  • Integration test env: test_proxy_firewall_e2e adds user root; to its throwaway nginx.conf when run as root, so workers can read pytest's 0700 temp dir. On the VM as root: 4/4 pass (was 3/4, also on clean develop).
  • F27 uptime reason: UptimeMonitor.ping_site now records error (the URLError reason) when a ping fails without an HTTP status; the site-down alert context carries error (null for HTTP failures). Additive field. Tests +2 (and the payload test updated). VM: one pass logged "error": "[SSL: CERTIFICATE_VERIFY_FAILED] ..." for the staging-certificate sites.
  • Status page: the IP redaction hid every IPv4 (127.0.0.1 showed as <vm-ip>); now it hides only public addresses (keeps loopback, private, documentation, Cloudflare). Added an Open items section (uncommitted work, Central branch, D8, D4 UI, yarn.lock drift, restart timeout, wizard message, uptime log, integration tests).
  • Integration tests on the VM as root (copy of the branch): test_trusted_proxy_nginx + test_proxy_firewall_e2e: 3 pass, test_direct_connection_is_blocked_only_proxy_gets_through fails, and it fails the same way on clean origin/develop. Cause: run as root, nginx's worker is nobody and cannot open pytest's 0700 temp dir, so the 404 error page itself becomes 403 (bench error log: open() .../error_pages/404.html failed (13: Permission denied)). Real bench: /.well-known/acme-challenge/probe -> 404. Test environment issue, not a product bug.
  • Signed in to the Admin UI through a one-time ?sid= link minted on the VM (no password typed in the browser).
  • D1 UI verified after rebuilding the dashboard on the VM (13 s): Settings, Database shows "Memory split: Apps 35% · Database 65% of 3.8 GB"; the dialog shows the final note text; slider to 50% previews 1.9/1.9 GB, pool 312 MB, MemoryMax 1092 MB; Apply runs set-mariadb-memory-share ("Giving MariaDB 50% of host memory", success). Result: memory_share 0.5, unit MemoryMax 1092M, live pool 312 MB. VM back at the default split.
  • D3 Pilot verified: with a site hostname alias (vmsite-* -> erp, redirect) rendered in memory (Central not enabled on this VM), http://vmsite-abc123.../app/home -> 301 https://erp.../app/home, and /api/method/ping on the alias -> 200 pong. Config restored.
  • Resized the VM 0.5 vCPU / 2 GB -> 1 vCPU / 4 GB from the dashboard (disk unchanged). Boot 13 s. pilot-mariadb-sizing logged "Sized MariaDB for 3912 MiB"; with the 65% split left from the D1 test the boot pool was 849 MB (the larger pool applied at start, as designed). Realtime came back on the Unix socket; port 9000 stays closed; erp and dev1 200.
  • Finding (not changed): _restart_systemd waits 60 s, systemd's default stop timeout is 90 s. A worker pool that drains a job sometimes takes the full 90 s (seen twice right after the build, not reproducible when idle: 2 s), so Settings reports "could not be restarted" while systemd completes the restart.
  • F26 (new): Settings http_port change on a production bench restarted gunicorn on the new port while nginx kept the old upstream -> 502 (reproduced on the VM). Fix: regenerate nginx after restart-triggering changes, in finally, because a timed-out restart still finishes in systemd. Verified: 8000 -> 8020 (restart call timed out, nginx followed, site came back), 8020 -> 8000 (site 200).
  • D4 verified: real DNS -> Cloudflare-proxied hosts accepted with the warning, direct host accepted. With cloudflare = true: nginx -t OK, CF-Connecting-IP in 4 server blocks, site 200, and a spoofed CF-Connecting-IP: 1.2.3.4 from a non-Cloudflare client is not trusted (access log shows the real IP). Reverted to the original common_config.
  • D2 verified: patch serve_realtime_on_unix_socket moved main (devb is lite mode, skipped). Port 9000 refuses connections from the internet; socket.io polling and the WebSocket upgrade (101) work through nginx; kill -9 of Node -> systemd restarts it, ExecStartPre removes the stale socket, realtime listens again.
  • Owner note: Pilot supports Frappe v16 and later only, so Bench.realtime_socket no longer checks Frappe's source for socketio_uds (v16 and develop both have it). This also removes a drift case that Codex found (nginx switching to the socket after a Frappe update while the unit stayed on TCP). Socket path length is now checked in bytes (Codex P2).
  • D11 verified on the 0.5 vCPU / 2 GB VM: pilot -b main build --apps helpdesk --force succeeded ("Done in 40m 15s", vite 29m54s, swap peak about 1.5 GB of the 2 GB build swap). No OOM kill. The swap file and the swap were removed after the build; count file back to 0; helpdesk yarn.lock unchanged. The earlier failure ("0MB of swap") came from stale code on the VM.
  • Tests: test_realtime_socket.py (6), patch test (1). docs/production.md.
  • Patch serve_realtime_on_unix_socket: rewrite units, daemon-reload, try-restart socketio, regenerate+reload nginx.
  • Fix: Bench.realtime_socket -> <bench>/config/socketio.sock for systemd production, Node backend, Frappe with socketio_uds (v16 and develop both have FRAPPE_SOCKETIO_UDS), path < 108 bytes. socketio unit gets Environment=FRAPPE_SOCKETIO_UDS=... and ExecStartPre=/bin/rm -f <sock> (Node does not remove a stale socket). nginx /socket.io proxies to http://unix:<sock>:. Dev runner, supervisor, Python backend keep the TCP port. nginx workers already run as the bench user (install.sh), so no permission change.
  • Confirmed on VM: curl http://<vm-ip>:9000/socket.io/?EIO=4&transport=polling answered from the internet (bypasses nginx, WAF, firewall rules).
  • Docs: configuration.md (Full (strict), no Flexible, turn off Always Use HTTPS until the cert is issued). Tests: nginx (2), domain controller (2), common config roundtrip (1).
  • _verify: a domain whose every address is in Cloudflare's networks passes with a stderr warning (no setting needed). Mixed or other addresses still 409.
  • nginx: direct vhosts get set_real_ip_from <Cloudflare networks> + real_ip_header CF-Connecting-IP when the setting is on. Edge-provider routes keep their own real-IP block.
  • [proxy] cloudflare (bool, default false) in common_config.toml (pilot/config/proxy.py, with CLOUDFLARE_NETWORKS from cloudflare.com/ips, checked today). Common config now writes [proxy] with asdict.
  • D11 VM build #2 failed with "0MB of swap" because the VM had stale python_assets.py (not synced). Synced, re-running.
  • Laptop pytest failure in test_run_command timeout test was environmental: pgrep -f "sleep 5" matched my own ssh swap logger.
  • SPEC.md updated. Tests: central test_sites 70 OK (new assertions), test_list_instances, test_trial_lifecycle, test_atlas_sync OK on central-test.local (worktree via PYTHONPATH; initialized signing keys on the test site).
  • Readiness probes keep using the automatic Site.url (Pilot keeps /api/method/ping proxied on the redirecting alias, D3 Pilot side).
  • Site.primary_url / Site.get_primary_url() return the customer hostname once renamed_at is set. site_state "url" and server registry _sites "url" now use it; registry subdomain uses the stored subdomain.
  • New read-only renamed_at on Site. get_login_url already probes the customer hostname; when it answers, it sets renamed_at (no extra request).
  • 2026-10-15 FIX D11 (+ #572) Swap during builds. install.sh root phase installs /usr/local/sbin/pilot-build-swap on|off and a sudo grant for exactly those two calls. The helper adds a 2 GB low-priority swap file (/var/lib/pilot/build.swap) only when the host has no swap and the disk has room, reference-counts concurrent builds under flock (one build ending never removes swap another uses), resets its count after a reboot (file not in fstab), and removes the file when the last build ends. pilot.core.build_memory.build_swap() wraps every capped build (PythonAssetBuilder.run_compiler) when less than 3 GB is free and the helper exists; a failing helper only warns. MariaDB's unit already limits its swap (MemorySwapMax=100M), so the database stays in memory. Existing hosts get the helper by re-running install.sh as root (idempotent). Tests: test_build_swap.py (4). VERIFIED on the VM: install.sh root re-run installed helper + grant; sudo -n pilot-build-swap on -> 2 GB swap active, off -> removed.
  • 2026-10-15 VERIFIED ON THE VM (D1) Settings, Database shows "Memory split — Apps 50% · Database 50% of 3.8 GB". Dialog matches the approved mockup; 50% preview = live values (312 MB pool, 1092 MB MemoryMax). Moved to 65%: preview 849 MB / 1630 MB, Apply queued set-mariadb-memory-share (success, 0.3 s). Result: common_config memory_share = 0.65, my.cnf pool 849M (max 1136M), unit and runtime MemoryMax 1630M. The live pool stayed at 760 MB, the running server's innodb_buffer_pool_size_max; the dialog now says a larger pool takes effect at the next restart.
  • 2026-10-15 FOUND (frappe-ui 1.0.0-rc.1) Importing frappe-ui's Slider into the Database settings component froze the browser tab on page load (renderer unresponsive; CDP screenshot timeouts), even with the Slider unmounted (v-if false) inside a closed dialog. Bisected on the VM: page loads without the import. The dialog uses a native <input type="range"> (step 5, 20–80%) instead; worth reporting upstream to frappe-ui.
  • 2026-10-15 VERIFIED ON THE VM (D9, D5) pilot admin run-patches --phase post_update installed pilot-mariadb-sizing.service (enabled under pilot-mariadb.service.wants) and pilot-certificates.timer. systemctl --user restart pilot-mariadb: the sizing unit ran first and logged "Sized MariaDB for 3912 MiB of host memory" (the old my.cnf had no marker), my.cnf gained # pilot-sized-for-memory-mb = 3912, MariaDB active, erp 200. FIX from this run: python -m pilot.managers.database.mariadb warned (module already imported by its package); the unit now runs python -m pilot.managers.database (new package __main__.py). Second start: no re-size (same memory), no warning. pilot-certificates.service: Result=success in 0.65 s; next run tomorrow. Simulated 9 days left: notification "Certificate for admin. is not renewing" landed in the feed.
  • 2026-10-15 NOTE (user) Verify on the VM, not on the laptop. A stray ~/.config/systemd/user/pilot-mariadb-sizing.service had appeared on the laptop from an earlier run; removed; no test suite recreates it.
  • 2026-10-15 FIX D5 Pilot owns certificate renewal: host-wide user timer pilot-certificates.timer (daily, RandomizedDelaySec=1h, Persistent=true, 15 min after boot) runs python -m pilot.managers.letsencrypt: one certbot renew --quiet for the host (the existing sudo grant), then for every production bench with a Let's Encrypt email alert_expiring_certificates: a certificate under 14 days left (certbot renews from 30, so it is failing to renew) gets a Warning in the bench feed (record_alert, category Sites) and the webhook/mail/Central sinks (notify), daily until it renews. certificate_days_left replaces the private expiry parse. Installed by setup_letsencrypt; post-update patch install_certificate_renewal_timer for existing hosts. Tests: +2.
  • 2026-10-15 FIX D7 (both parts) AppRepository.update_target: a marketplace app follows the registry's newest release for its branch, and falls back to the branch tip when (a) the registry has no release for its branch (a developer's own branch) or (b) the app sets the new optional follow_branch = true in its [[apps]] entry. forward_release became newest_release (no ahead check) with the ahead check in update_target. AppConfig.follow_branch is read, written only when true, and accepted by the bench.toml schema. No UI toggle yet (layout change needs approval). Docs: configuration.md. Tests: test_core.py (+3).
  • 2026-10-15 FIX D1 (approved design) [mariadb] memory_share in common_config.toml (0.2 to 0.8, default 0.5; validated with the bench config). calculate_mariadb_memory(total, share) uses it for the MariaDB budget and the host-share cap (0.5 gives exactly the old numbers). Quick action memory_share capability returns the current share, the range, total memory and a preview (steps: buffer pool and MemoryMax per 5% step), so the UI never repeats the formula. POST /database/quick-actions/memory-share {"memory_share": 0.6} queues set-mariadb-memory-share, which saves the share for every bench under the common config lock and re-sizes MariaDB live. UI: Settings, Database: row "Memory split — Apps X% · Database Y% of N GB" with a pencil; dialog with a frappe-ui Slider (20–80%, step 5), Apps/Database GB labels, previewed buffer pool and MemoryMax, Cancel/Apply (the approved mockup). Tests: quick actions (+3), API (+2). vue-tsc clean.
  • 2026-10-15 FIX D9 Implemented as designed above. MariaDBManager.size_for_host() + install_sizing_unit(); my.cnf now carries # pilot-sized-for-memory-mb = N; main() entry (python -m pilot.managers.database.mariadb) for the unit; provision installs the unit; post-update patch install_mariadb_sizing_unit for existing hosts. Removed the F12 monitor tick check (tune_if_resized, is_sized_for_host, Monitor.tune_database_if_resized). _install_unit split into _render_unit + write/reload. Tests: size_for_host (5 cases incl. 100 MB threshold edges and a missing marker), sizing unit content, provision installs it. docs/configuration.md updated.
  • 2026-10-15 DESIGN D9 (my choice per the user) Boot-time sizing before MariaDB starts: new user oneshot pilot-mariadb-sizing.service (Before= and WantedBy=pilot-mariadb.service, so it runs before every MariaDB start). my.cnf records the memory it was sized for (# pilot-sized-for-memory-mb = N); when the host memory differs by 100 MB or more (or the line is missing), it rewrites my.cnf and the unit file and sets the new limits with systemctl --user set-property --runtime. MariaDB then starts with the full new pool: no restart, no read-only innodb_buffer_pool_size_max limit (closes the D9 gap), done before the server even starts. The 10 s monitor check from F12 is removed (one mechanism for one job). Existing hosts get the unit from a post-update patch. Central's first-boot tune_to_host stays (idempotent).
  • 2026-10-15 FIX D12 TaskProcess.reconcile first interrupts every running task that has no process.json (TaskStore.running_task_ids_without_process). Only the worker's claim sets running, and the wrapper waits on a pipe until its process record is written, so such a task never started: its worker stopped between claim and start. The existing terminal-callback recovery then runs its failure callback, and its resource keys are free again. Test: test_task_cancellation.py (+1). Task suites 416 passed.
  • 2026-10-15 FIX D6 (#567) Uninstalling an app from a site keeps it on the bench. Optional --remove-from-bench (CLI), remove_from_bench=true (Admin API query), remove_from_bench task field (default false) keep the old behaviour. pilot remove-app is the way to remove an app from the bench. The task record's args gains remove_from_bench (additive). Docs: commands.md, admin-api.md. Tests: test_site_apps.py (+2 parametrized), API args test updated.
  • 2026-10-15 FIX D10 pilot restart raises (exit 1) on a development bench or an incomplete production deployment, with the same guidance text. Only the CLI calls it; -b all already skips development benches. Behaviour change for scripts that relied on exit 0; noted in docs/commands.md. Tests updated (2).
  • 2026-10-15 FIX D13 Lock-free rollback: _write_config_file keeps (content before, content written) per file, and _restore_unvalidated restores a file only when it still holds what this operation wrote. A rollback never overwrites a file another operation rewrote (and possibly validated) since. Avoids a host-wide lock held across generate and reload, which would leak in long-lived processes that generate without reloading. Test: test_nginx_config.py (+1).
  • 2026-10-15 USER DECISIONS: D1 approved as designed; fix D2, D3, D4 (setting in bench.toml or the UI; check whether CNAME verification works behind the proxy), D5, D6, D7 (both the branch-tip fallback and the per-app opt-in), D9 (re-size when the host memory changes by 100 MB or more, within 10 s of boot, mechanism my choice), D10, D11 (add swap during builds), D12, D13. D8 is on hold.
  • 2026-10-15 VM Resized back to 1 vCPU / 4 GB: fourth reboot of the session; both benches came back without help, MariaDB re-sized to MemoryMax 1092M, erp and dev1 200. Full unit suite 3305 passed, 1 skipped (one timing test flaked once under parallel load and passed on the rerun). Ruff clean.
  • 2026-10-15 REVIEW 3 (Codex, read-only) on the drop/backup/cron/nginx/gunicorn round. 4 findings: (P1) cron entries pointed at .admin-venv/bin/python even on a source checkout without the admin venv -> FIXED: fall back to the current interpreter when the venv's python does not exist. (P2) moving a schedule read and rewrote the crontab in two locked steps, so a schedule change between them could be lost -> FIXED: CronManager.move_schedule(old, new, command) re-keys the entry in one locked crontab write; SiteBackups.move_schedule uses it. Test added. (P2) two benches regenerating nginx at once: one's rollback can overwrite the other's accepted file -> LOGGED (regeneration had no host-wide lock before either; a host-wide nginx lock is the fix). (P2) a backup publishes its files one rename at a time, so a concurrent prune can still catch a run between two renames, and two runs in the same second share file names -> LOGGED (the window is now microseconds instead of the whole backup).
  • 2026-10-15 GAP (CLI) pilot drop-site is Frappe's raw drop-site (passthrough): it skips Pilot's cleanup of bench.toml, nginx, provider domains and the backup schedule. Pilot's own site drop is reachable only from the Admin API. Part of D8; a Pilot-aware drop-site CLI is the highest-value parity gap after update.
  • 2026-10-15 REGRESSION FOUND AND FIXED (F25 drop) First VM drop with the new code raised FileNotFoundError after Frappe had already archived the site: clear_schedule also clears the retention block in site_config.json, which takes a file lock in the (now moved) site directory. The drop stopped before the bench.toml, domain and nginx steps. FIX: drop removes only the cron entry (CronManager.remove_schedule). New test: the fake drop archives the directory and the drop must still finish. VM repaired (nginx vhost for site3 removed). Re-test on a fresh site4: backup taken (no --force), site dropped, cron entry gone, nginx clean, folder archived.
  • 2026-10-15 VERIFIED (F25 rename) Set a 03:00 schedule on site2, then pilot rename-site site2 site3: the cron entry moved to site3. FOUND: the moved entry used /usr/bin/python3 instead of the admin venv, because the CLI runs on the system Python and cron_module_command used sys.executable. A scheduled backup with S3 configured would then crash on import boto3 (load_boto3 raises ModuleNotFoundError, which the upload step does not catch). FIX: cron_module_command always uses the admin venv interpreter (AdminEnvManager(cli_root()).python), as the monitor and storage timers already do. Existing entries keep their interpreter until rewritten. Test updated.
  • 2026-10-15 VERIFIED (F23 backups) On the VM, SiteBackups.take ran frappe backup into backups/.backup-<random>/; only that run's two files were moved into backups/, and the staging directory was removed.
  • 2026-10-15 FINDING (sticky source build, D11) The failed source build ran yarn install in helpdesk/desk, which rewrote the tracked desk/yarn.lock. App.has_source_changes counts yarn.lock as a change (a deliberate earlier choice for dependency drift), so the next plain pilot build --apps helpdesk also refused the prebuilt archive, tried a source build and hit the cap again. On a small host the app stays without a fresh build until someone runs git checkout desk/yarn.lock (done on the VM; the prebuilt archive then restored public/desk with 205 files and www/helpdesk/index.html in 8 s). PROPOSAL: run frontend installs with the lockfile frozen, or ignore a yarn.lock that only Pilot's own install changed, or restore it after a failed build. Needs an owner decision because yarn.lock drift was counted on purpose.
  • 2026-10-15 BUILD LIMIT (0.5 vCPU / 2 GB, no swap) pilot build --apps helpdesk --force (source build): after 5 min the build cgroup hit its cap and the kernel killed only the build (oom_memcg=.../run-*.scope); Pilot printed "Build ran out of memory: it may use 714MB of RAM and 0MB of swap on this machine. Add swap, free memory, or set memory_limit_mb under [build] in bench.toml, then retry." MariaDB (316 MB) and the sites kept running. The cap works as designed: a 2 GB host without swap cannot build Helpdesk from source.
  • 2026-10-15 HUNT 2 (Codex, read-only) over site drop, scheduled backups and retention, task runner, nginx regeneration. 6 findings, checked against the code; 5 fixed, 1 logged:
  • 2026-10-15 DOCS Updated for the behavior changes: docs/admin-api.md (domain tls meaning, certificate_email_required, optional email on add-domain, site app is_marketplace and missing, backup 409 while the site is busy, the restore's kept config keys), docs/configuration.md (MariaDB re-sizing after a resize, unit written last), docs/migration.md (stopped task -> needs_attention), docs/commands.md (--version, setup telemetry, remove logs, admin revoke-totp, list-site-apps warning, init dev-extra fallback).
  • 2026-10-15 MEMORY (0.5 vCPU / 2 GB) get-app helpdesk used prebuilt assets for its commit: 52 s, peak 939 MB used (1.02 GB still available), MariaDB alive. Prebuilt assets remove the build peak entirely for apps that publish them. Next: forced source build (pilot build --apps helpdesk --force) to test the build memory cap.
  • 2026-10-15 FIX (gunicorn 26 control socket) Admin and web gunicorn configs set control_socket_disable = True. gunicorn 26 (already in the admin venv) opens $XDG_RUNTIME_DIR/gunicorn.ctl for every master, so all benches of a host share one path and a stopping master can unlink another's socket. Pilot never uses the socket. Older gunicorn ignores unknown config names (checked in gunicorn 23 app/base.py: "Ignore unknown names"). Changed: pilot/managers/gunicorn/init.py, templates/gunicorn.conf.py.template, tests/pilot/managers/test_gunicorn.py. Applies when the config is next written (restart or setup).
  • 2026-10-15 VM Resized to 0.5 vCPU / 2 GB for a build-limit test; monitor re-sized MariaDB to MemoryMax 512M within a minute. Two production benches idle: 793 MB used, 1.17 GB available. Started get-app helpdesk (Vite frontend build) with the memory sampler.
  • 2026-10-15 SELF-REVIEW Reverted pure formatting hunks that ruff format added to untouched code in files that were not ruff-formatted at base (domains.py x2, restore.py, letsencrypt.py is_public_domain, mariadb.py raise_memory_high). The diff now holds only behavior changes. Ruff clean; core/managers/tasks/admin API suites 2122 passed.
  • 2026-10-15 UI The Updates page for a running operation has no Cancel action; a stuck task can be cancelled only from the Tasks page (if it allows it) or the API.
  • 2026-10-15 VERIFIED (F13, #596) On the VM: created a site migration with safeguards for erp (backup phase), killed the migration-backup task 0.5 s after it started (TaskRunner.kill, the same call as the Admin cancel). Result: operation needs_attention, site backup failed, diagnosis "The task stopped before it finished. Retry it, or revert.", maintenance mode and scheduler restored (site 200). The Updates page showed "This update needs attention" with "Retry update". Retry ran backup -> migrate -> completed. Before F13 the operation stayed in "Backing up" forever and blocked later updates.
  • 2026-10-15 UI FIX Analytics shows "of 1 vCPUs"; now "1 vCPU" for one CPU (pages/Analytics.vue).
  • 2026-10-15 UI The Enable SSL task page shows "Server" as its target although the task has a site. The uptime log records up: false with no reason when a probe fails (here: staging certificate verification); an error field would make it diagnosable.
  • 2026-10-15 UI Clicks on the first button after a programmatic scroll often did nothing in the Site settings page (Enable SSL, Restore); a second click worked. Possibly a test-harness effect (hover/scroll), not confirmed as a product bug.
  • 2026-10-15 VERIFIED (F2) Backup of erp from the UI, then UI restore "Other site: erp" with Database + Public + Private + Site config into site2: site2 kept its own domains (none), no cert_name, ssl true; installed_apps from the restored database; site 200. Before F2 site2 would have taken erp's site1. domain and certificate pin.
  • 2026-10-15 VERIFIED (F8 + F10) "Enable SSL" on site2 from the UI issued the certificate (HTTPS 200). The same run logged "Certificate for erp... matches its domains and is not near expiry. Skipping." which confirms the corrected SAN parse (before it, every run reissued).
  • 2026-10-15 VERIFIED (F5 in the wild) pilot new-site site2... hit a Let's Encrypt staging "Service busy; retry later" (rateLimited). Before F5 this failed the task and the cleanup callback dropped the site; now the site stayed on HTTP (200) with the message "Enable SSL from its settings once its DNS points to this server".
  • 2026-10-15 NOTE (gunicorn 26) The admin venv runs gunicorn 26.2, which opens a control socket at a fixed $XDG_RUNTIME_DIR/gunicorn.ctl. Every bench's admin on a host shares that path; the last one to start owns it and a stopping one can unlink it. Pilot does not use the control socket, so there is no impact today. Option: set a per-bench path or disable it in admin-gunicorn.conf.py.
  • 2026-10-15 VERIFIED (develop) Second bench devb on frappe develop: pilot -b devb init 2 min 41 s (full clones: Pilot is a dev install, depth_flags empty by design); setup production --admin-domain admin2.<vm> --tls 12 s; lite mode on (one frappe.runner 123 MB instead of gunicorn + workers); new site in 38 s with prebuilt frappe assets; HTTPS 200. Two benches side by side, both admins 200. Host total 1.26 GB used.
  • 2026-10-15 VERIFIED (rename) UI rename site1 -> erp with "keep old name": new name is primary (no host_name override), old name kept as a plain domain and served, certificate reissued for both, ping 200 on both names. Tasks list keeps old rows under the old site name (history).
  • 2026-10-15 REVIEW (Codex gpt-6.1-sol, medium, read-only) over the whole diff. 7 findings, all valid; all handled:
  • 2026-10-15 CHECKED (wildcard / proxied domains) Central hostname aliases (admin-*, site-* patterns) are rendered HTTP-only and never enter a certificate; provider routes with origin_scheme=http are excluded from certificate_domains. The known issue is already handled in code; no change.
  • 2026-10-15 MEMORY (ERPNext, 1 vCPU/4 GB) get-app erpnext --branch version-16: 4 min 42 s, peak used 1.65 GB (2.26 GB available), no OOM. Install on site1 from the UI: 75 s, peak 1.8 GB. Idle afterwards 1.05 GB used (mariadbd 237 MB). Local ping 5 ms.
  • 2026-10-15 FINDING (wizard) "Lost connection to the setup process" appears when the event stream ends without a done event and the reconnect fails (useTaskStream onerror, readyState CLOSED). The backend sends done when a task ends, so the likely path is the stream stopping early (should_stop=is_draining) and the reconnect getting a non-200. Not reproduced yet.
  • 2026-10-15 UI Marketplace shows the same download icon for an app already on the bench (ERPNext after get-app) as for one that needs a download.
  • 2026-10-15 UI After a domain is added, the row keeps the open lock until the page reloads, although the certificate task finishes a minute later; there is no "certificate pending" hint. Small UX gap, not fixed.
  • 2026-10-15 VERIFIED (F10) Removing shop. reissued the certificate with only site1. (before the fix the subset check kept the old certificate with the removed name).
  • 2026-10-15 VERIFIED (ask email, F6/F7) With letsencrypt.email cleared, the Add Domain dialog showed the "Let's Encrypt email" field on step 1; after Verify DNS the email was saved to common_config.toml and the certificate was reissued for shop. + site1. (staging CA).
  • 2026-10-15 VERIFIED #639 on the VM: added commera to site1's installed apps with frappe.installer.add_to_installed_apps; the site returned 500 (Frappe imports it), list-site-apps printed commera (not on bench), the UI card read "Not on bench"; Uninstall from the UI removed only the listing; site 200 again, bench unchanged. The uninstall dialog warned "Every doctype Commera owns is dropped", which is wrong for this case -> FIX: the dialog shows "Only the listing is removed." for a missing app (UninstallAppDialog.vue, Apps.vue passes missing).
  • 2026-10-15 VERIFIED (resize down/up) 8 GB -> 0.5 vCPU/2 GB: monitor logged "Sized MariaDB for 1963 MiB", unit MemoryMax 3048M -> 512M, pool 128M, no OOM, site 200. 2 GB -> 1 vCPU/4 GB: MemoryMax 1092M again. MariaDB started at boot with the old (larger) my.cnf for about a minute before the monitor shrank it; no memory pressure seen.
  • 2026-10-15 TESTS ruff check clean; ruff format applied only to touched files that were formatted at base (the repo has 131 unformatted files at base); vue-tsc clean.
  • 2026-10-15 FIX #640 The site app list used registry title, description, logo, website and docs by app name only, so a fork or private copy showed the upstream links. The API returns is_marketplace per app (the backend already compares the repository URL with same_repository), and the UI uses registry metadata only when it is true. SiteApps.disable_app and the UI canDisable also used a name match; both use is_marketplace now. Changed: same files as #639.
  • 2026-10-15 FIX #639 A site that lists an app the bench lacks (restore from another bench): GET /sites/<name>/apps marks it missing: true (optional field) and the UI card says "Not on bench" with a one-line explanation instead of a blank row; pilot list-site-apps prints <app> (not on bench); uninstalling it runs Frappe's remove-from-installed-apps (never imports the app) instead of failing "App X not found in bench", and never touches the bench; Site.build_assets builds only apps the bench has (it raised "App(s) not found in bench"). Changed: pilot/core/site/apps.py (forget_missing_app), pilot/core/site/init.py, pilot/commands/sites/list_apps.py, admin/backend/api/v1/sites/apps.py, types/site_apps.py, dashboard components/sites/Apps.vue. Tests: test_site_apps.py (+1), test_site_apps_view.py (+1, +1 assert), test_commands.py (+1).
  • 2026-10-15 FIX (CLI) pilot restart printed guidance and exited 0 on a development bench or an incomplete production deployment, so scripts took a skipped restart for a done one. It now raises BenchError (exit 1) with the same text. Only the CLI calls restart_workload; -b all already skips development benches. Removed the unused _incomplete_message. Tests updated (2) + 3 new CLI tests. docs/commands.md: --version, restart exit, setup telemetry, remove logs, admin revoke-totp.
  • 2026-10-15 FIX (CLI) pilot remove logs was unreachable: pilot/commands/remove/ had no __init__.py, so command discovery (pkgutil.walk_packages) skipped it. Added the package file. Test asserts discovery finds it.
  • 2026-10-15 FIX (CLI) pilot -y --site S <frappe command> passed -y to Frappe ("No such option: -y"). Leading Pilot-only flags (--verbose, --yes, -y) are now dropped before passthrough; flags after the Frappe command (e.g. reinstall --yes) stay. Changed: pilot/internal/cli/dispatch.py.
  • 2026-10-15 FIX #621 pilot --version prints pilot <version> (dev on a source checkout) instead of going to Frappe ("No such option: --version"). Changed: pilot/internal/cli/registry.py, pilot/internal/cli/dispatch.py.
  • 2026-10-15 MEMORY (idle, 1 vCPU/4 GB, version-16, one site, production systemd) ~1.0 GB used: mariadbd 170 MB, gunicorn master+2 workers 377 MB, worker pool 2 processes 214 MB, socket.io 69 MB, admin 83 MB. Dashboard peak 2.12 GB during new-site.
  • 2026-10-15 FIX #596 Chain tasks (migration-backup, migrate, update) declare @on_failure @on_cancel fail_migration_step -> new callback operation fail-migration-step -> MigrationOperation.fail_stopped_step(phase, site). When a task is killed or its process dies while the operation is still in that phase, the site step is marked failed, the diagnosis says "The task stopped before it finished. Retry it, or revert.", the operation enters needs_attention (retry/revert allowed), and a backup phase restores maintenance settings. A no-op once the operation left the phase, so normal failures (already handled in the task) are unchanged. Changed: pilot/core/bench/migration/operation.py, pilot/internal/tasks/callbacks.py, pilot/tasks/{migration_backup,migrate,update}.py. Tests: test_migration_operation.py (+3). Suites tasks/core/internal/admin: 1847 passed.
  • 2026-10-15 VERIFIED (resize up) Dashboard resize 1 vCPU/4 GB -> 2 vCPU/8 GB. About 1 minute after boot the monitor logged "Sized MariaDB for 7937 MiB of host memory": unit MemoryHigh/Max 964M/1092M -> 2744M/3048M (runtime too), my.cnf pool 1568M, log file 512M. Live pool stayed 760M: innodb_buffer_pool_size_max is read-only, so the larger pool needs the next MariaDB restart (known MariaDB limit, already noted in code). site1 200 after the resize.
  • 2026-10-15 ROLLOUT NOTE (db tuning) On the first monitor tick after this code lands, any host whose unit was sized by an older formula is re-sized live to the current formula (SET GLOBAL, no restart). Intended, but reviewers should know.
  • 2026-10-15 FIX (db tuning, resize) MariaDBManager.tune_if_resized() re-sizes when the unit's MemoryMax differs from the sizing for the current RAM (MemoryMax is a faithful proxy: 1 GB and 2 GB hosts get identical sizing at the 512 MiB floor). The host monitor (pilot-monitor.timer, every 10 s from boot, production hosts) calls it once per tick through Monitor.tune_database_if_resized; errors go to monitor.error.log and never stop the monitor. No new unit, no patch: existing hosts get it with the code. tune_to_host also drops a saved innodb-buffer-pool-size override that is larger than the new host allows (with its -auto-min/-max), so a downsize cannot keep a pool that the cgroup kills. Press does the same job from its resize job (adjust_memory_config). Changed: pilot/managers/database/mariadb.py, pilot/core/server/monitoring.py. Tests: test_mariadb_manager.py (+4), test_monitor.py (+1).
  • 2026-10-15 UI Login page footer says "Frappe Bench Administration" while the product is Pilot.
  • 2026-10-15 FINDING (security) Frappe's socket.io server listens on *:9000 and answers from the internet (curl http://<vm-ip>:9000/socket.io/?EIO=4&transport=polling -> 200), bypassing nginx and the WAF; no host firewall is active by default. Frappe supports socketio_uds (realtime/index.js), so nginx could proxy to a Unix socket. PROPOSAL, not built (deployment change).
  • 2026-10-15 VM setup production --admin-domain admin.<vm> --tls --letsencrypt-email ... PASS in 14 s (frontends already built). certbot points at the Let's Encrypt STAGING CA through /etc/letsencrypt/cli.ini on the VM, because swiftwave.xyz is not on the Public Suffix List and all its subdomains share one rate limit (50 certificates per week).
  • 2026-10-15 TESTS Full unit suite: 3278 passed, 1 skipped (tests --ignore=tests/e2e --ignore=tests/integration). Ruff clean. vue-tsc clean.
  • 2026-10-15 FIX (state leak) BenchConfig.default() without benches_root handed every config the same module-level _DEFAULT_COMMON_CONFIG objects, so config.letsencrypt.email = ... on one default config changed it for every later config in the process (found through an order-dependent test failure). Now a deep copy. Test added.
  • 2026-10-15 FIX (TLS B5) LetsEncryptManager.obtain skips reissue only when the certificate's SAN set equals the site's domains, so a removed domain leaves the lineage at the next domain change instead of failing renewal for every domain. New certificate_domain_names; has_domain_coverage builds on it; removed the forwarding _has_domain_coverage. Test: parametrized exact-match test.
  • 2026-10-15 FIX (TLS B4) Domain rows report tls: true for a direct route only when the certificate covers the domain (serviceable_tls_domains); provider routes keep the route value.
  • 2026-10-15 FIX (TLS B3) The per-site Enable SSL task (SetupLetsEncryptTask with site) now fails when no certificate covers the site's public TLS domains after setup. The existing failure callback turns ssl off, so "Enable SSL" shows again for a retry, instead of a "succeeded" task with a site on HTTP and a hidden action. obtain_all is unchanged (setup production stays best effort). Test: test_setup_letsencrypt_task.py (+1).
  • 2026-10-15 FIX (TLS B2 + ask for email) SiteDomains.apply_task queues the Let's Encrypt task only when an email exists (bench or request); otherwise it queues the nginx task, so add/remove/set-primary always regenerate nginx. POST /sites/<name>/domains on a TLS site with no email answers 422 missing_certificate_email {needs_email: true} before the domain is attached (same contract as enable-tls), and accepts an optional email. GET /sites/<name>/domains adds optional certificate_email_required. Add Domain dialog shows a "Let's Encrypt email" field on step 1 when that flag is set (UI change: one field in an existing dialog, same label and type as the Enable SSL email dialog; NEEDS REVIEW per the mockup rule). Changed: pilot/core/site/domains.py, admin/backend/api/v1/sites/domains.py, admin/backend/api/v1/types/site_domains.py, dashboard api/sites.ts, Domains.vue, AddDomainDialog.vue. Tests: test_site_domains.py (+3), test_site_domains_view.py (+2).
  • 2026-10-15 FIX (TLS B1) SiteProvisioner.obtain_cert: no Let's Encrypt email -> the new site stays on HTTP with a message; a certbot CommandError -> ssl back to false and a message, no exception, so the remove_failed_site callback no longer drops a working new site. Tests: tests/pilot/core/test_site_provisioning.py (+2).
  • 2026-10-15 VERIFIED #638 fix on the VM: the wizard retry printed the [dev] resolve error, installed frappe without the extra, and init completed ("Setup complete"). A failed init can be retried from "Back to configuration".
  • 2026-10-15 FIX (concurrency) DomainRouteProvider register/deregister/set_primary now read-modify-write site_config.json through _edit_config (under exclusive_file_lock, atomic replace_private_text_locked, nothing written on an exception); provider calls stay outside the lock. write_retention/clear_retention use the same lock + atomic replace. POST /sites/<name>/backups queues with resource_key=site:<name>, so a backup is refused (409) while a restore, rename or drop owns the site. Changed: pilot/core/adapters/domain_provider.py, pilot/config/site_backup.py, admin/backend/api/v1/sites/backups.py, tests/pilot/core/test_domain_controller.py (lock test), tests/admin/backend/api/test_site_restore_view.py (409 test).
  • 2026-10-15 FIX restore: LOCAL_CONFIG_KEYS is now PROTECTED_CONFIG_KEYS plus the restore-only keys, so the target keeps its own domains, route, ssl, cert_name, backup_retention (one owner for the key list). Changed: pilot/core/site/restore.py, tests/pilot/core/test_site_restore.py (source config now carries those keys; the exact-values assertions fail without the fix). 14 tests pass.
  • 2026-10-15 FIX #638: PythonEnvManager.install_app installs <app>[dev], and when that fails it prints a warning and installs the app without the extra; an app with no dev extra still raises its own error. BenchRuntime._install_python_requirements had a second copy of the same uv pip install -e call (without the build env); it now calls PythonEnvManager.install_app. Changed: pilot/managers/environment.py, pilot/core/bench/runtime.py, tests/pilot/core/test_app_editable_target.py (+2 tests), tests/pilot/commands/test_commands.py (patch target). Tests pass.
  • 2026-10-15 REPRODUCED #638 on the fresh VM: the default wizard path (version-16) fails at "Clone and install framework app": frappe[dev]==16.52.0 depends on pypika-stubs and pypika-stubs needs pypika<0.49 while frappe pins its own PyPika fork. Every new version-16 dev bench from the wizard fails. The wizard then shows "Lost connection to the setup process" under the error log, which is the wrong message for a failed step.
  • 2026-10-15 NOTE Four fix agents (CLI, #596, #639/#640, #638) stopped on a session rate limit before they changed files. Continuing the fixes in the main session, one at a time.
  • 2026-10-15 FINDING (concurrency) DomainRouteProvider._read/_write (pilot/core/adapters/domain_provider.py) and pilot/config/site_backup.py rewrite site_config.json in place without the file lock and not atomically. An Admin domain change during a rename or restore can overwrite host_name/encryption_key; readers can see a truncated file. BackupSiteTask.queue has no site:<name> resource key, so a backup can overlap a rename or restore.
  • 2026-10-15 FINDING (restore) LOCAL_CONFIG_KEYS in pilot/core/site/restore.py is a second, shorter copy of PROTECTED_CONFIG_KEYS (pilot/core/site/config.py). It misses domains, route, ssl, cert_name, backup_retention, so a config restore copies the source site's custom domains, certificate name and edge route into the target. Same-host restore makes two vhosts claim one domain; a replaced domains with the kept host_name breaks the canonical redirect.
  • 2026-10-15 FINDING (rename) Pilot already sets host_name to the new name when Central asks (make_primary=True, pilot/core/site/rename.py). The auto-routed site-xxxxx host stays visible because Central names the Site record by it and never switches to rename_target after the rename task succeeds (central/infrastructure/doctype/site/site.py url, api/servers.py, api/sites.py, SiteReadyPage.vue). Pilot side: setup central --site-pattern (cargo provision.sh) runs without --redirect, so the alias is served, not redirected; with redirect, _site_alias redirects to the site name, not site.primary. A redirect must keep /api/method/ping unredirected (Central probes the alias with allow_redirects=False).
  • 2026-10-15 FINDING (parity) All frappe site commands pass through (pilot --site S <cmd>). Gaps vs bench: no update CLI, no drop-site/domain CLI, no switch-to-branch CLI, no pip, no backup schedule CLI, no renew-lets-encrypt, no wkhtmltopdf. CLI bugs: -y before passthrough args is forwarded to Frappe; pilot remove logs unreachable (no __init__.py in pilot/commands/remove); pilot restart exits 0 when it restarts nothing; docs disagree with argparse in a few places.
  • 2026-10-15 FINDING (apps) #639: site app list is read straight from Frappe; an app missing from the bench shows as a blank row and cannot be uninstalled ("App X not found in bench"); site build fails "App(s) not found in bench". #640: the UI matches registry metadata by app name only (backend already compares repo URLs). #567: uninstall removes the app from the bench when no site uses it (documented, surprising). #579: already fixed on develop (f5c9308b). #596: chain tasks have no on_cancel; a killed backup leaves the operation in backing_up with no retry/revert and blocks later updates. #638: [dev] extra install has no fallback. #621: no pilot --version.
  • 2026-10-15 FINDING (TLS) Provider routes with origin_scheme=http (wildcard served upstream) are already left out of certificates. Gaps: letsencrypt_email_required counts all public domains, so production setup asks for an email on a fully provider-routed bench; plain custom domains on a routed site inherit ssl.
  • 2026-10-15 FINDING (TLS) (B1) A certbot failure or empty email at the end of new-site fails the task, and the remove_failed_site callback drops the new site. (B2) Add/remove/set-primary domain writes site_config, then the Let's Encrypt task fails on a missing email before nginx is regenerated: the domain is listed but not served, a removed domain is still served, the API said 202. (B3) obtain_all only prints per-site failures, the task reports success, ssl=true stays, and the UI hides "Enable SSL" (409 tls_already_enabled). (B4) domain rows report tls:true with no certificate. (B5) A removed domain stays in the SAN certificate (subset check), so renewal later fails for the whole site. (B7) Pilot never calls renew(); Fedora/Arch have no certbot timer by default. (B8) Cloudflare-proxied domains fail the A-record check (409). (B9) Cloudflare Flexible SSL loops on the http->https redirect.
  • 2026-10-15 FINDING (db tuning) Postgres has no memory tuning or cgroup limit. Redis has no maxmemory. App side (2 gunicorn workers x 8 threads, worker, scheduler, socketio, admin) is fixed for every host size. No setting exists for the app/DB RAM split (hardcoded /2 and _MAX_HOST_MEMORY_SHARE = 0.5 in pilot/core/mariadb_memory.py).
  • 2026-10-15 FINDING (db tuning) MariaDB is sized only when it is first provisioned and on a Central host's first boot (admin/backend/central_bootstrap.py main -> tune_database). A VM resize keeps the old my.cnf and unit MemoryHigh/MemoryMax. Downsize 8 -> 4 GB keeps MemoryMax 3027M (75% of RAM) and a 1.5 GB pool. Upsize keeps the small pool, and the Admin UI then accepts a pool larger than the stale cgroup MemoryMax (UI limits read live RAM). Press re-sizes after its resize job (adjust_memory_config from resize_server.py); Pilot runs inside the VM and must detect the change at boot.
  • 2026-10-15 UI Wizard log view still shows the raw protocol line STEP init,<unix ts> Initialize bench (seen in an earlier session too).
  • 2026-10-15 SETUP Root install PASS (only noise: MariaDB package update-alternatives: error: no alternatives for my.cnf, harmless). install.sh --dev as frappe PASS. pilot new main + pilot start: the first start builds 3 frontends on 1 vCPU (dashboard 11 s build after npm install; total about 12 min with npm installs). Wizard reachable on the public IP; version-16 init started from the wizard.
  • 2026-10-15 AUDIT Started 5 read-only code audits in parallel: (1) database tuning and RAM split, (2) TLS, Let's Encrypt email, wildcard renewal, Cloudflare, (3) rename primary domain and restore of custom domains, (4) app list sync and issues #639 #640 #567 #579 #596 #638 #621, (5) frappe/bench command parity.
  • 2026-10-15 SCOPE (user) Run develop Pilot on the VM (--dev checkout, synced with local fix/bughunt). Clean up inconsistent or tangled code only where a fix already touches it. Review with the Atlas engineering playbook (benches/atlas-bench/apps/atlas/llm/engineering-playbook).
  • 2026-10-15 SETUP Started the released install (install.sh as root) on the VM.
  • 2026-10-15 START Read CLAUDE.md, playbook, SPEC.md. Switched the checkout from feat/pilot-mailbox (no own commits, behind develop) to new branch fix/bughunt on origin/develop. Read open bug issues #640 #639 #638 #596 #579 #571 #567 #437 #408 #528 #572 #627 #621.