From 125501abe60b98343570bcccb1b2f73880af6975 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Thu, 19 Nov 2026 22:31:44 -0500
Subject: [PATCH 1/3] feat(engine): the desktop engine keeps a log, holds a
lock on its data folder, leaves when its app has gone, and serves nothing
when started alone
The family's pattern for starting and stopping cleanly on Windows, as
FormTools 0.10.0 has it, in the entry the desktop app freezes.
backend/app/core/startup.py is FormTools's file (git show of its
origin/main), changed only in the names at its top. backend/app/core/
runtime.py is new and FormDesign's own: the log file and the lock.
formdesign_engine.py now, in this order: starts Logs/formdesign-engine.log
under the data folder (a folder that cannot be made is one sentence and
exit code 5); keeps an absent standard error in a file beside it; when it
is frozen and no app started it, opens the app beside it and stops, or
says it serves nothing on its own (exit code 4); takes engine.lock, and
refuses with a sentence and exit code 2 while another engine and that
engine's app are alive, or ends an engine whose app has gone; watches the
process named in FORMDESIGN_SHELL_PID and leaves when it ends; then
serves as before. An error that ends the engine is written to the log.
An engine ended with SIGTERM gives its lock up and exits 0.
An engine started with uvicorn app.main:app is untouched. Released
engines wrote no lock, so one left behind by 0.89.0 or older is not
known to a new engine and is not ended by it.
Seen on Linux with stand-ins for the shell and the app: the refusal of a
second engine, the engine leaving about a second after its shell ended,
a leftover replaced (SIGTERM, and SIGKILL after five seconds for one
that was stopped), four damaged locks replaced, an unrelated process
left alone, the started-alone branch in four places and with no app
near, three closed streams, the data folder that cannot be made, and an
unchanged output for a normal start. tests/test_startup.py (14 tests,
written after that) with the window key and boot tests: 53 passed.
Not run: Windows, macOS, a frozen engine, the desktop shell.
---
backend/HASHOUT_LOG.md | 30 +++
backend/app/core/runtime.py | 66 +++++++
backend/app/core/startup.py | 335 ++++++++++++++++++++++++++++++++++
backend/formdesign_engine.py | 74 +++++++-
backend/tests/test_startup.py | 199 ++++++++++++++++++++
5 files changed, 699 insertions(+), 5 deletions(-)
create mode 100644 backend/app/core/runtime.py
create mode 100644 backend/app/core/startup.py
create mode 100644 backend/tests/test_startup.py
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 0769d2a..0792a6f 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -7,6 +7,36 @@ Last updated: 2026-11-19 · the family's finder 1.0.1 for the four agent program
---
+## v0.90.0 · the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone, and serves nothing when started alone (2026-11-19)
+
+- refers-to: app/core/startup.py; app/core/runtime.py; formdesign_engine.py :: watch_shell, serve, main; tests/test_startup.py
+- kind: feat
+- logged: v0.90.0 · 2026-11-19
+
+The family's pattern for starting and stopping cleanly on Windows, as FormTools 0.10.0 has it. It lives in the entry the desktop app freezes, `formdesign_engine.py`; an engine started with `uvicorn app.main:app` (boot scripts, `./formdesign mcp`, the tests' own engines) is untouched and takes no lock.
+
+**startup.py** is FormTools's file, copied with `git show origin/main:backend/app/core/startup.py` and changed only in the names at its top: `APP`, `NAMES`, `SHELL_ENV` (`FORMDESIGN_SHELL_PID`), `ALONE_ENV` (`FORMDESIGN_NO_SHELL`), `ERRORS_NAME`. `PLACES` is unchanged: the frozen engine is a sidecar beside the app's program in all three install layouts, which is the entry `.`. Keep the file the same as the family's; a change belongs in every app.
+
+**runtime.py** is FormDesign's own and small: `start_logging` opens `Logs/formdesign-engine.log` under the data folder (rotating, one megabyte, three kept) on the loggers `formdesign`, `uvicorn` and `uvicorn.access`; `uvicorn.error` reaches the file through `uvicorn`, so it is not listed, or every line would be written twice. A second call for the same file only puts the handler back where it is missing. `claim` and `release` are the lock. FormDesign had no log file and no lock before this.
+
+**The order in `serve`.** The port and the three environment defaults are settled first, as before, because `app.core.config` reads them when it is imported. Then: the log (a data folder that cannot be made is one sentence and exit code 5); `keep_errors`, which sends an absent standard error to `Logs/formdesign-engine-errors.log`; the started-alone branch (a frozen engine with no `FORMDESIGN_SHELL_PID` opens the app beside it and returns 0, or says "formdesign-engine is a part of FormDesign and serves nothing on its own" and returns 4; no lock, nothing served; `FORMDESIGN_NO_SHELL=1` lets a build check serve alone); the lock (a refusal is written to the log and to standard error, exit code 2); the watch on the process in `FORMDESIGN_SHELL_PID` (nothing was watched before, so there is no fallback to the parent); the key line and the server.
+
+**Why `uvicorn.Server` and not `uvicorn.run`.** uvicorn's log setup, done when its `Config` is made, takes the handlers off the `uvicorn` loggers, so `start_logging` is called a second time after the `Config` exists. Without that the file held one line. `run` hid a Ctrl+C and answered exit code 3 for a server that never started; the entry does both itself now.
+
+**SIGTERM.** uvicorn shuts down on SIGTERM and then raises the signal again, which ended the process before the `finally` that gives the lock up (seen: exit 143 and the lock still there). The entry's own handler is what the raised signal now meets: it gives the lock up and exits 0. An engine ended with SIGTERM therefore exits 0 where it exited 143.
+
+**The lock an older engine left.** Released engines wrote no lock, so a new engine cannot know one that was left behind by 0.89.0 or older: it does not end it. If that engine still holds port 8196 the new one serves on a spare port, as it always did. The launcher's cleanup is what removes such a leftover.
+
+**A leftover that holds the port.** The port is chosen before the lock is asked for, so a new engine that ends a leftover serves on a spare port even though 8196 is free a moment later. The shell reads the address from the engine's output, so the window opens all the same.
+
+**Seen on Linux with stand-ins (`sleep` as the shell, a script as the app):** a second engine exits 2 with "formdesign is already running on [folder] (engine process N)." while the first one's shell lives, and the first keeps answering `/api/health`; the engine exits 0 within about a second of its shell ending and the lock is gone; a stopped engine whose shell had gone was ended after five seconds (its exit 137) and replaced, with the warning in the log; a holder whose shell had gone and that could hear SIGTERM exited 143 and was replaced; locks holding `not json at all`, `[1, 2]`, `{"pid": "x"}` and nothing were replaced; a lock naming an unrelated `sleep` was replaced and the `sleep` kept running; a process id with no time at all was obeyed; started alone (the entry through `python -c` with `sys.frozen` set) it opened the stand-in app in each of the four places, exit 0, no lock, and with no app near it exit 4 with the sentence; with its three streams closed it served, descriptors 0, 1 and 2 were the null device, and both log files were there; a data folder under a plain file gave the sentence and exit 5; started normally it printed what it printed before, and the log file held each line once.
+
+**Not run:** Windows and macOS (every `_windows` function in startup.py, the handle branch of `watch`, `taskkill`, the detached start of the app), a really frozen engine, the desktop shell.
+
+**Tests.** `tests/test_startup.py`, FormTools's with FormDesign's names and without the port file FormDesign does not have, plus the refusal of a second engine: 14 tests, added after each behaviour was seen.
+
+---
+
## after v0.88.0 · only Claude Code's sentence offers a path in Preferences (2026-11-19)
- refers-to: app/services/claude_code.py :: said; app/services/agent_programs.py :: status, launch; tests/test_dock_contract.py
diff --git a/backend/app/core/runtime.py b/backend/app/core/runtime.py
new file mode 100644
index 0000000..279d9ec
--- /dev/null
+++ b/backend/app/core/runtime.py
@@ -0,0 +1,66 @@
+import json
+import logging
+import os
+from logging.handlers import RotatingFileHandler
+from pathlib import Path
+
+from app.core import startup
+
+LOG_NAME = "formdesign-engine.log"
+LOG_FOLDER = "Logs"
+LOG_BYTES = 1_048_576
+LOG_KEEP = 3
+HANDLER = "formdesign-file"
+LOGGERS = ("formdesign", "uvicorn", "uvicorn.access")
+FORMAT = "%(asctime)s %(levelname)s %(name)s %(message)s"
+
+
+AlreadyRunning = startup.Busy
+
+
+def start_logging(data: Path) -> Path:
+ folder = data / LOG_FOLDER
+ folder.mkdir(parents=True, exist_ok=True)
+ path = folder / LOG_NAME
+ for held in logging.getLogger("formdesign").handlers:
+ if held.get_name() == HANDLER and getattr(held, "baseFilename", "") == os.path.abspath(path):
+ for name in LOGGERS:
+ if held not in logging.getLogger(name).handlers:
+ logging.getLogger(name).addHandler(held)
+ return path
+ stop_logging()
+ handler = RotatingFileHandler(path, maxBytes=LOG_BYTES, backupCount=LOG_KEEP, encoding="utf-8")
+ handler.setFormatter(logging.Formatter(FORMAT))
+ handler.set_name(HANDLER)
+ for name in LOGGERS:
+ logger = logging.getLogger(name)
+ logger.addHandler(handler)
+ if name == "formdesign":
+ logger.setLevel(logging.INFO)
+ logging.getLogger("formdesign").info("engine started, pid %s, data folder %s", os.getpid(), data)
+ return path
+
+
+def stop_logging() -> None:
+ for name in LOGGERS:
+ logger = logging.getLogger(name)
+ for handler in list(logger.handlers):
+ if handler.get_name() == HANDLER:
+ logger.removeHandler(handler)
+ handler.close()
+
+
+def claim(data: Path) -> Path:
+ lock, replaced = startup.claim(data, startup.shell_pid())
+ if replaced:
+ logging.getLogger("formdesign").warning("an engine left running without its app was stopped (process %s)", replaced)
+ return lock
+
+
+def release(data: Path) -> None:
+ path = data / startup.LOCK_NAME
+ try:
+ if int(json.loads(path.read_text(encoding="utf-8")).get("pid", 0)) == os.getpid():
+ path.unlink()
+ except (OSError, ValueError, TypeError, AttributeError):
+ pass
diff --git a/backend/app/core/startup.py b/backend/app/core/startup.py
new file mode 100644
index 0000000..4963c24
--- /dev/null
+++ b/backend/app/core/startup.py
@@ -0,0 +1,335 @@
+import json
+import os
+import signal
+import subprocess
+import sys
+import threading
+import time
+from pathlib import Path
+
+APP = "formdesign"
+NAMES = ("formdesign", "FormDesign")
+SHELL_ENV = "FORMDESIGN_SHELL_PID"
+ALONE_ENV = "FORMDESIGN_NO_SHELL"
+LOCK_NAME = "engine.lock"
+ERRORS_NAME = "formdesign-engine-errors.log"
+ERRORS_BYTES = 1_048_576
+STAND_INS = []
+PROC = "/proc"
+PLACES = ("..", ".", os.path.join("..", "..", "MacOS"), os.path.join("..", "..", "..", "bin"))
+STARTED = time.time()
+POLL = 2.0
+END_WAIT = 5.0
+STEP = 0.1
+SLACK = 3.0
+OLD_SLACK = 180.0
+FILETIME_EPOCH = 116_444_736_000_000_000
+WINDOWS = sys.platform == "win32"
+SYNCHRONIZE = 0x00100000
+QUERY_LIMITED = 0x1000
+WAIT_TIMEOUT = 0x102
+ACCESS_DENIED = 5
+NO_WINDOW = 0x08000000
+DETACHED = 0x00000008
+NEW_GROUP = 0x00000200
+FREE = "free"
+BUSY = "busy"
+LEFTOVER = "leftover"
+
+
+class Busy(RuntimeError):
+ pass
+
+
+def keep_errors(folder: Path) -> Path | None:
+ if getattr(sys.stderr, "name", None) != os.devnull:
+ return None
+ path = folder / ERRORS_NAME
+ try:
+ mode = "w" if path.stat().st_size > ERRORS_BYTES else "a"
+ except OSError:
+ mode = "a"
+ try:
+ kept = open(path, mode, encoding="utf-8", errors="replace", buffering=1)
+ except OSError:
+ return None
+ STAND_INS.append(sys.stderr)
+ sys.stderr = kept
+ return path
+
+
+def _kernel():
+ import ctypes
+
+ lib = ctypes.WinDLL("kernel32", use_last_error=True)
+ lib.OpenProcess.restype = ctypes.c_void_p
+ lib.OpenProcess.argtypes = (ctypes.c_uint32, ctypes.c_int, ctypes.c_uint32)
+ lib.WaitForSingleObject.restype = ctypes.c_uint32
+ lib.WaitForSingleObject.argtypes = (ctypes.c_void_p, ctypes.c_uint32)
+ lib.CloseHandle.restype = ctypes.c_int
+ lib.CloseHandle.argtypes = (ctypes.c_void_p,)
+ lib.GetProcessTimes.restype = ctypes.c_int
+ lib.GetProcessTimes.argtypes = (ctypes.c_void_p,) + (ctypes.POINTER(ctypes.c_uint64),) * 4
+ lib.SetDllDirectoryW.restype = ctypes.c_int
+ lib.SetDllDirectoryW.argtypes = (ctypes.c_wchar_p,)
+ return lib
+
+
+def _open_windows(pid: int, access: int):
+ import ctypes
+
+ handle = _kernel().OpenProcess(access, 0, pid)
+ if handle:
+ return handle
+ if ctypes.get_last_error() == ACCESS_DENIED:
+ raise PermissionError(pid)
+ return None
+
+
+def _alive_windows(pid: int) -> bool:
+ try:
+ handle = _open_windows(pid, SYNCHRONIZE)
+ except PermissionError:
+ return True
+ if handle is None:
+ return False
+ try:
+ return _kernel().WaitForSingleObject(handle, 0) == WAIT_TIMEOUT
+ finally:
+ _kernel().CloseHandle(handle)
+
+
+def _created_windows(pid: int) -> float:
+ import ctypes
+
+ try:
+ handle = _open_windows(pid, QUERY_LIMITED)
+ except PermissionError:
+ return 0.0
+ if handle is None:
+ return 0.0
+ try:
+ times = [ctypes.c_uint64(0) for _ in range(4)]
+ if not _kernel().GetProcessTimes(handle, *[ctypes.byref(item) for item in times]):
+ return 0.0
+ return (times[0].value - FILETIME_EPOCH) / 10_000_000
+ finally:
+ _kernel().CloseHandle(handle)
+
+
+def _end_windows(pid: int) -> None:
+ subprocess.run(
+ ["taskkill", "/PID", str(pid), "/T", "/F"],
+ stdin=subprocess.DEVNULL,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ creationflags=NO_WINDOW,
+ timeout=END_WAIT * 2,
+ check=False,
+ )
+
+
+def _alive_posix(pid: int) -> bool:
+ try:
+ os.kill(pid, 0)
+ except ProcessLookupError:
+ return False
+ except PermissionError:
+ return True
+ try:
+ with open(f"{PROC}/{pid}/stat") as stat:
+ return stat.read().rpartition(")")[2].split()[0] != "Z"
+ except (OSError, IndexError):
+ return True
+
+
+def _created_posix(pid: int) -> float:
+ try:
+ with open(f"{PROC}/{pid}/stat") as stat:
+ ticks = int(stat.read().rpartition(")")[2].split()[19])
+ with open(f"{PROC}/stat") as stat:
+ boot = int(next(line for line in stat if line.startswith("btime")).split()[1])
+ return boot + ticks / os.sysconf("SC_CLK_TCK")
+ except (OSError, IndexError, ValueError, StopIteration):
+ pass
+ found = subprocess.run(
+ ["ps", "-o", "etime=", "-p", str(pid)],
+ stdin=subprocess.DEVNULL,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL,
+ timeout=END_WAIT,
+ check=False,
+ )
+ days, _, clock = found.stdout.decode("ascii", "replace").strip().rpartition("-")
+ parts = [int(part) for part in clock.split(":")]
+ if not 2 <= len(parts) <= 3:
+ return 0.0
+ seconds = 0
+ for part in parts:
+ seconds = seconds * 60 + part
+ return time.time() - seconds - int(days or 0) * 86400
+
+
+def alive(pid: int) -> bool:
+ if pid <= 0:
+ return False
+ return _alive_windows(pid) if WINDOWS else _alive_posix(pid)
+
+
+def created(pid: int) -> float:
+ if pid <= 0:
+ return 0.0
+ try:
+ return _created_windows(pid) if WINDOWS else _created_posix(pid)
+ except (OSError, ValueError, subprocess.SubprocessError):
+ return 0.0
+
+
+def moment(value) -> float:
+ return float(value) if isinstance(value, (int, float)) and not isinstance(value, bool) and value > 0 else 0.0
+
+
+def same(pid: int, born: float) -> bool:
+ seen = created(pid)
+ return alive(pid) and (not born or (seen > 0 and abs(seen - born) <= SLACK))
+
+
+def gone_by(pid: int, seconds: float) -> bool:
+ until = time.monotonic() + seconds
+ while alive(pid):
+ if time.monotonic() >= until:
+ return False
+ time.sleep(STEP)
+ return True
+
+
+def end(pid: int) -> bool:
+ try:
+ if WINDOWS:
+ _end_windows(pid)
+ else:
+ os.kill(pid, signal.SIGTERM)
+ if gone_by(pid, END_WAIT):
+ return True
+ if not WINDOWS:
+ os.kill(pid, signal.SIGKILL)
+ except (OSError, subprocess.SubprocessError):
+ pass
+ return gone_by(pid, END_WAIT)
+
+
+def number(value) -> int:
+ return value if isinstance(value, int) and not isinstance(value, bool) and value > 0 else 0
+
+
+def read_lock(path: Path) -> dict:
+ try:
+ found = json.loads(path.read_text(encoding="utf-8"))
+ except (OSError, ValueError):
+ return {}
+ return found if isinstance(found, dict) else {}
+
+
+def holder(lock: dict, shelled: bool) -> str:
+ pid = number(lock.get("pid"))
+ if not pid or pid == os.getpid() or not alive(pid):
+ return FREE
+ born, started, seen = moment(lock.get("born")), moment(lock.get("started")), created(pid)
+ if born:
+ if not same(pid, born):
+ return FREE
+ elif started:
+ if not seen or not -SLACK <= started - seen <= OLD_SLACK:
+ return FREE
+ else:
+ return BUSY
+ if "shell" not in lock:
+ return LEFTOVER if shelled else BUSY
+ shell = number(lock.get("shell"))
+ if not shell:
+ return BUSY
+ return BUSY if same(shell, moment(lock.get("shellBorn"))) else LEFTOVER
+
+
+def claim(data: Path, shell: int) -> tuple[Path, int]:
+ path = data / LOCK_NAME
+ lock = read_lock(path)
+ held = number(lock.get("pid"))
+ state = holder(lock, shell > 0)
+ if state == BUSY:
+ raise Busy(f"{APP} is already running on {data} (engine process {held}).")
+ if state == LEFTOVER and not end(held):
+ raise Busy(f"{APP} could not stop an engine that was left running on {data} (engine process {held}).")
+ record = {"pid": os.getpid(), "started": int(STARTED), "born": created(os.getpid()), "shell": shell, "shellBorn": created(shell)}
+ fresh = path.with_name(f"{LOCK_NAME}.{os.getpid()}")
+ fresh.write_text(json.dumps(record), encoding="utf-8")
+ os.replace(fresh, path)
+ return path, held if state == LEFTOVER else 0
+
+
+def shell_pid() -> int:
+ raw = os.environ.get(SHELL_ENV, "").strip()
+ return int(raw) if raw.isascii() and raw.isdigit() else 0
+
+
+def alone() -> bool:
+ return bool(getattr(sys, "frozen", False)) and not shell_pid() and os.environ.get(ALONE_ENV) != "1"
+
+
+def app_beside(engine: Path) -> Path | None:
+ engine = engine.resolve()
+ suffix = ".exe" if WINDOWS else ""
+ for place in PLACES:
+ for name in NAMES:
+ found = (engine.parent / place / f"{name}{suffix}").resolve()
+ if found != engine and found.is_file() and os.access(found, os.X_OK):
+ return found
+ return None
+
+
+def open_app(app: Path) -> bool:
+ env = dict(os.environ)
+ if "LD_LIBRARY_PATH_ORIG" in env:
+ env["LD_LIBRARY_PATH"] = env.pop("LD_LIBRARY_PATH_ORIG")
+ elif getattr(sys, "frozen", False):
+ env.pop("LD_LIBRARY_PATH", None)
+ try:
+ if WINDOWS:
+ _kernel().SetDllDirectoryW(None)
+ subprocess.Popen(
+ [str(app)],
+ cwd=str(app.parent),
+ env=env,
+ stdin=subprocess.DEVNULL,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ close_fds=True,
+ creationflags=(DETACHED | NEW_GROUP) if WINDOWS else 0,
+ start_new_session=not WINDOWS,
+ )
+ except OSError:
+ return False
+ return True
+
+
+def watch(pid: int, leave) -> None:
+ direct = os.getppid() == pid
+ handle = None
+ if WINDOWS:
+ try:
+ handle = _open_windows(pid, SYNCHRONIZE)
+ except PermissionError:
+ return
+
+ def gone() -> bool:
+ if handle is not None:
+ return _kernel().WaitForSingleObject(handle, int(POLL * 1000)) != WAIT_TIMEOUT
+ time.sleep(POLL)
+ return not alive(pid) or (direct and os.getppid() != pid)
+
+ def run() -> None:
+ while not gone():
+ pass
+ leave()
+
+ threading.Thread(target=run, name=f"{APP}-shell-watch", daemon=True).start()
diff --git a/backend/formdesign_engine.py b/backend/formdesign_engine.py
index f2d1052..098e843 100644
--- a/backend/formdesign_engine.py
+++ b/backend/formdesign_engine.py
@@ -9,7 +9,9 @@
sys.stderr = open(os.devnull, "w", encoding="utf-8")
import json
+import logging
import socket
+from pathlib import Path
def resource_dir() -> str:
@@ -50,9 +52,22 @@ def selfcheck() -> int:
return 0
-def main() -> int:
- if "--selfcheck" in sys.argv:
- return selfcheck()
+def watch_shell(data) -> None:
+ from app.core import runtime, startup
+
+ shell = startup.shell_pid()
+ if shell <= 1:
+ return
+
+ def leave() -> None:
+ logging.getLogger("formdesign").info("the app that started this engine is gone (process %s), stopping", shell)
+ runtime.release(data)
+ os._exit(0)
+
+ startup.watch(shell, leave)
+
+
+def serve() -> int:
bundled = os.path.join(resource_dir(), "frontend_dist")
if os.path.isdir(bundled):
os.environ.setdefault("FORMDESIGN_DIST", bundled)
@@ -60,6 +75,31 @@ def main() -> int:
wanted = int(os.environ.get("FORMDESIGN_PORT", "8196") or 0)
port = wanted if wanted and free(wanted) else spare()
os.environ["FORMDESIGN_PORT"] = str(port)
+ from app.core import config, runtime, startup
+
+ data = config.DATA_DIR
+ try:
+ logs = runtime.start_logging(data).parent
+ except OSError as err:
+ print(f"formdesign cannot use its data folder: {err}", file=sys.stderr)
+ return 5
+ startup.keep_errors(logs)
+ log = logging.getLogger("formdesign")
+ if startup.alone():
+ beside = startup.app_beside(Path(sys.executable))
+ if beside is not None and startup.open_app(beside):
+ log.info("started without its app, so it opened %s and stopped", beside)
+ return 0
+ log.error("started without its app, and no app program was found near %s", sys.executable)
+ print("formdesign-engine is a part of FormDesign and serves nothing on its own. Open FormDesign instead.", file=sys.stderr)
+ return 4
+ try:
+ runtime.claim(data)
+ except runtime.AlreadyRunning as err:
+ log.error("%s", err)
+ print(err, file=sys.stderr)
+ return 2
+ watch_shell(data)
import uvicorn
from app.main import app as fastapi_app
@@ -67,8 +107,32 @@ def main() -> int:
if window_key.stdout_mode():
print(window_key.LINE + window_key.KEY, flush=True)
- uvicorn.run(fastapi_app, host="127.0.0.1", port=port, log_level="info")
- return 0
+ import signal
+
+ def leave(_signum, _frame) -> None:
+ runtime.release(data)
+ os._exit(0)
+
+ signal.signal(signal.SIGTERM, leave)
+ server = uvicorn.Server(uvicorn.Config(fastapi_app, host="127.0.0.1", port=port, log_level="info"))
+ runtime.start_logging(data)
+ try:
+ server.run()
+ except KeyboardInterrupt:
+ pass
+ finally:
+ runtime.release(data)
+ return 0 if server.started else 3
+
+
+def main() -> int:
+ if "--selfcheck" in sys.argv:
+ return selfcheck()
+ try:
+ return serve()
+ except Exception:
+ logging.getLogger("formdesign").exception("the engine stopped on an error")
+ raise
if __name__ == "__main__":
diff --git a/backend/tests/test_startup.py b/backend/tests/test_startup.py
new file mode 100644
index 0000000..690bddf
--- /dev/null
+++ b/backend/tests/test_startup.py
@@ -0,0 +1,199 @@
+import json
+import os
+import subprocess
+import sys
+import time
+
+import pytest
+
+from conftest import BACKEND
+
+pytestmark = pytest.mark.skipif(os.name != "posix", reason="the stand-in programs are POSIX ones")
+
+FROZEN = "import sys\nsys.frozen = True\nsys.executable = {engine!r}\nsys.argv = ['formdesign-engine']\nimport formdesign_engine as e\nsys.exit(e.main())\n"
+LOG = ("Logs", "formdesign-engine.log")
+
+
+def stand_in():
+ return subprocess.Popen(["sleep", "120"])
+
+
+def stop(*procs):
+ for proc in procs:
+ if proc.poll() is None:
+ proc.kill()
+ proc.wait(timeout=10)
+
+
+def engine_env(data, **more):
+ env = {k: v for k, v in os.environ.items() if not k.startswith("FORMDESIGN_")}
+ env.update(FORMDESIGN_DATA_DIR=str(data), FORMDESIGN_PORT="0", HOME=str(data), PYTHONUNBUFFERED="1", **more)
+ return env
+
+
+def wait_for(check, seconds=30.0):
+ until = time.monotonic() + seconds
+ while time.monotonic() < until:
+ if check():
+ return True
+ time.sleep(0.1)
+ return False
+
+
+def serving(data):
+ log = data.joinpath(*LOG)
+ return log.is_file() and "Uvicorn running on http://127.0.0.1:" in log.read_text()
+
+
+def record(startup, engine, shell):
+ return {"pid": engine.pid, "started": int(time.time()), "born": startup.created(engine.pid), "shell": shell.pid, "shellBorn": startup.created(shell.pid)}
+
+
+def test_a_holder_whose_shell_is_alive_is_respected(tmp_path):
+ from app.core import startup
+
+ engine, shell, mine = stand_in(), stand_in(), stand_in()
+ try:
+ (tmp_path / startup.LOCK_NAME).write_text(json.dumps(record(startup, engine, shell)))
+ with pytest.raises(startup.Busy) as refused:
+ startup.claim(tmp_path, mine.pid)
+ assert f"is already running on {tmp_path} (engine process {engine.pid})" in str(refused.value)
+ assert engine.poll() is None
+ finally:
+ stop(engine, shell, mine)
+
+
+def test_a_holder_whose_shell_is_gone_is_ended_and_replaced(tmp_path):
+ from app.core import startup
+
+ engine, shell, mine = stand_in(), stand_in(), stand_in()
+ try:
+ (tmp_path / startup.LOCK_NAME).write_text(json.dumps(record(startup, engine, shell)))
+ stop(shell)
+ path, replaced = startup.claim(tmp_path, mine.pid)
+ assert replaced == engine.pid
+ assert engine.wait(timeout=10) is not None
+ now = json.loads(path.read_text())
+ assert now["pid"] == os.getpid() and now["shell"] == mine.pid and now["born"] > 0 and now["shellBorn"] > 0
+ finally:
+ stop(engine, shell, mine)
+
+
+def test_a_holder_that_recorded_no_shell_is_replaced_only_by_an_engine_with_a_shell(tmp_path):
+ from app.core import startup
+
+ engine, mine = stand_in(), stand_in()
+ try:
+ (tmp_path / startup.LOCK_NAME).write_text(json.dumps({"pid": engine.pid, "started": int(time.time())}))
+ with pytest.raises(startup.Busy):
+ startup.claim(tmp_path, 0)
+ assert engine.poll() is None
+ assert startup.claim(tmp_path, mine.pid)[1] == engine.pid
+ assert engine.wait(timeout=10) is not None
+ finally:
+ stop(engine, mine)
+
+
+@pytest.mark.parametrize("text", ["not json at all", "[1, 2]", '{"pid": "x"}', ""])
+def test_a_damaged_lock_is_replaced(tmp_path, text):
+ from app.core import startup
+
+ (tmp_path / startup.LOCK_NAME).write_text(text)
+ path, replaced = startup.claim(tmp_path, 0)
+ assert replaced == 0
+ assert json.loads(path.read_text())["pid"] == os.getpid()
+
+
+def test_a_lock_that_names_a_process_which_is_not_the_engine_is_replaced_and_the_process_is_left_alone(tmp_path):
+ from app.core import startup
+
+ other, mine = stand_in(), stand_in()
+ try:
+ for held in ({"pid": other.pid, "started": int(time.time()) - 86400}, {"pid": other.pid, "started": 5, "born": 12345.5, "shell": 999999, "shellBorn": 5.0}):
+ (tmp_path / startup.LOCK_NAME).write_text(json.dumps(held))
+ assert startup.claim(tmp_path, mine.pid)[1] == 0
+ assert other.poll() is None
+ (tmp_path / startup.LOCK_NAME).write_text(json.dumps({"pid": other.pid}))
+ with pytest.raises(startup.Busy):
+ startup.claim(tmp_path, mine.pid)
+ assert other.poll() is None
+ finally:
+ stop(other, mine)
+
+
+def test_the_two_ways_of_reading_a_start_time_agree(monkeypatch):
+ from app.core import startup
+
+ first = startup.created(os.getpid())
+ monkeypatch.setattr(startup, "PROC", "/nonexistent")
+ second = startup.created(os.getpid())
+ assert first > 0 and abs(first - second) <= startup.SLACK
+ assert startup.created(4_000_000) == 0.0
+
+
+def test_the_engine_serves_and_logs_with_its_three_streams_closed(tmp_path):
+ proc = subprocess.Popen(["sh", "-c", 'exec "$0" formdesign_engine.py <&- >&- 2>&-', sys.executable], cwd=BACKEND, env=engine_env(tmp_path))
+ log = tmp_path.joinpath(*LOG)
+ try:
+ assert wait_for(lambda: serving(tmp_path))
+ assert log.read_text().splitlines()[0].endswith(f"engine started, pid {proc.pid}, data folder {tmp_path}")
+ assert (tmp_path / "Logs" / "formdesign-engine-errors.log").is_file()
+ assert json.loads((tmp_path / "engine.lock").read_text())["pid"] == proc.pid
+ finally:
+ proc.terminate()
+ proc.wait(timeout=10)
+ assert proc.returncode == 0
+ assert not (tmp_path / "engine.lock").exists()
+
+
+def test_a_second_engine_is_refused_while_the_first_ones_shell_lives(tmp_path):
+ first_shell, second_shell = stand_in(), stand_in()
+ first = subprocess.Popen([sys.executable, "formdesign_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMDESIGN_SHELL_PID=str(first_shell.pid)), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ try:
+ assert wait_for(lambda: serving(tmp_path))
+ second = subprocess.run([sys.executable, "formdesign_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMDESIGN_SHELL_PID=str(second_shell.pid)), capture_output=True, text=True, timeout=30)
+ assert second.returncode == 2
+ assert f"formdesign is already running on {tmp_path} (engine process {first.pid})." in second.stderr
+ assert first.poll() is None
+ assert "is already running on" in tmp_path.joinpath(*LOG).read_text()
+ finally:
+ stop(first_shell, second_shell, first)
+
+
+def test_the_engine_stops_when_the_shell_it_was_given_ends(tmp_path):
+ shell = stand_in()
+ proc = subprocess.Popen([sys.executable, "formdesign_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMDESIGN_SHELL_PID=str(shell.pid)), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ try:
+ assert wait_for(lambda: serving(tmp_path))
+ assert json.loads((tmp_path / "engine.lock").read_text())["shell"] == shell.pid
+ stop(shell)
+ assert proc.wait(timeout=10) == 0
+ assert not (tmp_path / "engine.lock").exists()
+ finally:
+ stop(shell, proc)
+
+
+def test_a_frozen_engine_started_alone_opens_the_app_beside_it_and_serves_nothing(tmp_path):
+ install, data, mark = tmp_path / "install", tmp_path / "data", tmp_path / "opened"
+ install.mkdir()
+ data.mkdir()
+ app = install / "FormDesign"
+ app.write_text(f'#!/bin/sh\nprintf "%s" "$(pwd)" > "{mark}"\n')
+ app.chmod(0o755)
+ code = FROZEN.format(engine=str(install / "formdesign-engine"))
+ done = subprocess.run([sys.executable, "-c", code], cwd=BACKEND, env=engine_env(data), capture_output=True, text=True, timeout=30)
+ assert done.returncode == 0, done.stderr
+ assert wait_for(mark.is_file, 10)
+ assert mark.read_text() == str(install.resolve())
+ assert not (data / "engine.lock").exists()
+ assert "started without its app" in data.joinpath(*LOG).read_text()
+
+
+def test_a_frozen_engine_started_alone_with_no_app_near_it_says_so_and_serves_nothing(tmp_path):
+ data = tmp_path / "data"
+ data.mkdir()
+ code = FROZEN.format(engine=str(tmp_path / "engine" / "formdesign-engine"))
+ done = subprocess.run([sys.executable, "-c", code], cwd=BACKEND, env=engine_env(data), capture_output=True, text=True, timeout=30)
+ assert done.returncode == 4
+ assert "serves nothing on its own" in done.stderr
+ assert not (data / "engine.lock").exists()
From 362269b90cc2c9fcd4de72db38ad11cb6589397a Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Thu, 19 Nov 2026 22:35:07 -0500
Subject: [PATCH 2/3] fix(shell): the shell tells the engine its process id,
and a failed start shows its message before the last window closes
The engine is started with FORMDESIGN_SHELL_PID set to the shell's own
process id, which the engine records in its lock and watches. Both
failure paths now show their dialog first and only then close the
loading window, stop the engine and end the app; a main window that
fails to build takes the same path with its own sentence. The exit code
of an engine that stopped before it gave its address is kept: code 2
says another copy of its engine holds its data folder, any other code
is named, and the message says where the engine's log is.
src/main.rs only. Not compiled here (the system WebKit libraries are
missing) and not run on any system: read against tauri-plugin-shell 2.4
(Command::env, TerminatedPayload.code) and tauri-plugin-dialog 2
(message, blocking_show). Held: the job object, engine_start.rs, a limit
on the wait for the address, single-instance handling.
---
src-tauri/HASHOUT_LOG.md | 18 ++++++++++++++++++
src-tauri/src/main.rs | 18 +++++++++++++++---
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src-tauri/HASHOUT_LOG.md b/src-tauri/HASHOUT_LOG.md
index b684cac..619c892 100644
--- a/src-tauri/HASHOUT_LOG.md
+++ b/src-tauri/HASHOUT_LOG.md
@@ -4,6 +4,24 @@ Living log for the desktop shell. Source files stay comment-free where this log
---
+## v0.90.0 · the shell tells the engine its process id, and a failed start shows its message before the last window closes (2026-11-19)
+
+- refers-to: src/main.rs :: setup (the engine's start, the spawned task's Terminated arm, the two failure paths)
+- kind: fix
+- logged: v0.90.0 · 2026-11-19
+
+The small part of the family's Windows pattern, the part the engine of this version cannot do without. Not compiled here and not run on any system; each line was read against tauri-plugin-shell 2.4 (`Command::env`, `TerminatedPayload.code`) and tauri-plugin-dialog 2 (`message`, `blocking_show`), which this file already used.
+
+**`FORMDESIGN_SHELL_PID`.** The engine is started with the shell's own process id in that variable. The engine records it in its lock, watches that process and leaves within about two seconds of its ending, so an engine is no longer left behind when the shell is ended or when the kill reaches only the first of the engine's two processes. It must stay: a frozen engine that finds no such variable takes itself for started alone, opens the app and stops (backend log, 0.90.0), so a shell that did not set it would start itself again and again.
+
+**The message comes first.** Both failure paths closed the loading window and then showed the dialog. On Windows the app can end when its last window closes, so the person saw nothing. Now the dialog is shown, and only after it returns the loading window is closed, the engine stopped and the app ended. A main window that fails to build takes the same path with its own sentence; before, it closed the loading window and said nothing.
+
+**What the message says.** The exit code of an engine that stopped before it gave its address is kept from the `Terminated` event. Code 2 is the engine's refusal of a second copy, and the sentence says another copy of its engine holds its data folder. Any other code is named. With no code the old sentence stays. The last two say where the engine's log is.
+
+**Held, not in this version:** the job object that ends the engine with the shell however the shell ends (`win_job.rs`, which wants a `std::process::Child` or the child's handle, and `windows-sys` named in `Cargo.toml` and `Cargo.lock`); `engine_start.rs` with the engine's last lines and the log's full path in the message; a limit on the wait for the engine's address, which is still unlimited; single-instance handling. Until the job object is in, ending the shell is covered by the engine's own watch.
+
+---
+
## v0.88.0 · the shell waits at most ten seconds for the engine's key and opens no window without it (2026-11-19)
- refers-to: src/main.rs :: setup (the spawned task that reads the engine's first lines)
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 20151ff..fa9b89a 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -130,7 +130,7 @@ fn main() {
.setup(|app| {
let handle = app.handle().clone();
reveal::round_splash(&handle);
- let mut cmd = app.shell().sidecar("formdesign-engine")?.env("FORMDESIGN_PORT", "8196").env("FORMDESIGN_WINDOW_KEY_STDOUT", "1");
+ let mut cmd = app.shell().sidecar("formdesign-engine")?.env("FORMDESIGN_PORT", "8196").env("FORMDESIGN_WINDOW_KEY_STDOUT", "1").env("FORMDESIGN_SHELL_PID", std::process::id().to_string());
if let Some(core) = core_path() {
cmd = cmd.env("FORMDESIGN_CORE", core);
}
@@ -143,6 +143,7 @@ fn main() {
let key_pattern = regex::Regex::new(r"formdesign-window-key: ([A-Za-z0-9_-]{32,})").ok();
let mut port: Option = None;
let mut key: Option = None;
+ let mut stopped: Option = None;
while let Some(event) = rx.recv().await {
let line = match event {
CommandEvent::Stdout(bytes) => {
@@ -153,7 +154,10 @@ fn main() {
text
}
CommandEvent::Stderr(bytes) => String::from_utf8_lossy(&bytes).into_owned(),
- CommandEvent::Terminated(_) => break,
+ CommandEvent::Terminated(payload) => {
+ stopped = payload.code;
+ break;
+ }
_ => continue,
};
if let Some(captures) = pattern.as_ref().and_then(|p| p.captures(&line)) {
@@ -222,13 +226,21 @@ fn main() {
reveal::conceal(&window);
traffic_lights::place(&window.as_ref().window());
} else {
+ handle.dialog().message("FormDesign could not open its window. Please relaunch the app.").blocking_show();
close_splash(&handle);
+ kill_backend(&handle);
+ std::process::exit(1);
}
check_for_updates(handle.clone());
}
None => {
+ let text = match stopped {
+ Some(2) => "FormDesign could not start: another copy of its engine holds its data folder. Close the other FormDesign and open it again.".to_string(),
+ Some(code) => format!("FormDesign could not start: its engine stopped with code {code} before the window could open. Its log is formdesign-engine.log, in the Logs folder of the FormDesign data folder."),
+ None => "The FormDesign engine failed to start. Please relaunch the app. Its log is formdesign-engine.log, in the Logs folder of the FormDesign data folder.".to_string(),
+ };
+ handle.dialog().message(text).blocking_show();
close_splash(&handle);
- handle.dialog().message("The FormDesign engine failed to start. Please relaunch the app.").blocking_show();
kill_backend(&handle);
std::process::exit(1);
}
From e3f1ee863913ac1b974af401c4d5837c73c8093d Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Thu, 19 Nov 2026 23:00:05 -0500
Subject: [PATCH 3/3] chore(release): v0.90.0
Ships the engine side of the family's Windows start and stop pattern: the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone, ends an engine that was left running, and serves nothing when started alone; the shell tells the engine its process id and shows a failed start's message before the last window closes. Version sites moved, the same fourteen files as 0.89.0: CHANGELOG, README badge, frontend package.json and both fields of its lock, frontend/src/version.ts, backend/app/__init__.py, native/Cargo.toml and the seven crates in its lock, src-tauri Cargo.toml, tauri.conf.json and the two crates in its lock, and the "Current build version" and "Last updated" lines of the backend, frontend and native HASHOUT logs. Lock files were edited by hand, this project's own version fields only.
Checked on a scratch copy of the commit before this one, with the layout core built and the fonts installed: backend pytest, whole suite, 312 passed; compileall, --selfcheck, the template lint (71 templates, 0 with problems), agents sync --check, the uvicorn boot and probe, ./formdesign make for a newsletter and a flyer, bash -n over the scripts, mcpb check, the em dash and emoji check, npm audit (0 vulnerabilities). The browser window check, 3 passed, ran on the engine commit. After the bump the version sites were read: all fourteen say 0.90.0 and none says 0.89.0 outside history.
Not run: the version tests, agents sync --check and cargo metadata --locked after the bump (the shared build lane was blocked); cargo test for the layout core; a desktop build; the PyInstaller freeze; Windows and macOS; any real agent program.
Left as they are: the recorded demo pages' version; the wiki Home page's "Version 0.19.0"; log entries of 0.89.0 that read "after v0.88.0, no version yet".
---
CHANGELOG.md | 9 +++++++++
README.md | 2 +-
backend/HASHOUT_LOG.md | 4 ++--
backend/app/__init__.py | 2 +-
frontend/HASHOUT_LOG.md | 4 ++--
frontend/package-lock.json | 4 ++--
frontend/package.json | 2 +-
frontend/src/version.ts | 2 +-
native/Cargo.lock | 14 +++++++-------
native/Cargo.toml | 2 +-
native/HASHOUT_LOG.md | 4 ++--
src-tauri/Cargo.lock | 4 ++--
src-tauri/Cargo.toml | 2 +-
src-tauri/tauri.conf.json | 2 +-
14 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f8fba74..af527bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,15 @@
Every release of FormDesign, newest first. Versions follow semver; tags read `v*.*.*`.
+## 0.90.0 · 2026-11-19
+
+- The desktop app's engine stops by itself within about two seconds when the app that started it has gone, so no engine is left running after FormDesign is quit or ended.
+- An engine that was left running without its app is ended by the next start, which then takes over. A second FormDesign on the same data folder is told that FormDesign is already running there.
+- When FormDesign cannot start, it says so before it closes: that another copy of its engine holds its data folder, or the code its engine stopped with, and where the engine's log is. Before, the app could close without a word.
+- The desktop app's engine keeps a log, `Logs/formdesign-engine.log` in the FormDesign data folder (the folder `FormDesign` in your home folder unless you chose another). An error that stops the engine is written there.
+- Opening the engine program by itself opens FormDesign instead of starting an engine that nothing uses.
+- For people who build on the engine: the desktop engine takes `engine.lock` in the data folder and exits with code 2 when another engine holds it, with code 4 when it was started alone and found no app, and with code 5 when it cannot use its data folder. Ended with SIGTERM it exits with code 0. An engine started from source with uvicorn is unchanged.
+
## 0.89.0 · 2026-11-19
- Google's Antigravity (the program `agy`) is a fourth agent program beside Claude Code, Codex and Cursor. It has a tab of its own in the terminal panel, a button in Agent Connect's set-up row, and `./formdesign agents install antigravity` adds FormDesign to the file Antigravity reads its servers from, keeping everything else in that file.
diff --git a/README.md b/README.md
index 38afbc1..4300c1b 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
-
+
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 0792a6f..4ecbc97 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -2,8 +2,8 @@
Living log for the engine service. Source files stay comment-free; what they would have said lives here, indexed. Read it before editing `backend/`.
-Current build version: v0.89.0
-Last updated: 2026-11-19 · the family's finder 1.0.1 for the four agent programs · an Antigravity tab and agents install antigravity · the tests find only stand-in agent programs · the engine starts with no output streams · only the app window can change what agents may do, open a terminal or answer an approval; the stored agent choices are sealed; the command line is an agent like any other; agents/manifest.json says what the app offers agents; the use_tool description says 41 layout tools; the engine side of the shared dock's contract; 2026-11-13 · no engine change in 0.87.0 (version string only; the demo covers and browser demo pages are in the frontend log); a recent document's first-page thumbnail; three demos built on demand by Make; counts --check fails if a sparkle icon returns; the desktop extension, attach mode and the plugin manifest; 2026-11-11 · engine commands run in the active document; Save to a folder that cannot be made answers 422; a tools/call name that is not a string gets a JSON-RPC error; PNG and JPEG export count pages from 1; the in-app token reaches Claude Code in a private file; 2026-11-10 · Claude chat keeps only the screenshots its messages still show; Claude chat history is found under a non-ASCII agent folder; a prompt that starts with "-" reaches Claude Code as a prompt; text with a non-ASCII style name is placed; bad input to open, pack edits, make, tabs and media answers 4xx; LibreOffice gets a well-formed profile URL; links found in contact and footer text keep their query strings; fixed-layout EPUB marks every animated page as scripted; images from different sources with the same name stay distinct; book operations run one at a time; malformed agent, plug-in, package and book input gets an error message; Edit Original opens only image, vector and PDF files; counts --check reads only the MCP tool count; Windows Node check and install --lite; clean.bat --all removes each folder on its own; build_frontend.bat restores its caller's folder; agents install codex writes valid TOML on Windows; the MCP stdio bridge runs under Python 3.9; every window socket request gets an answer; a Claude Code launch is quoted for the login shell that runs it; a failed thumbnail leaves no document open; a video's poster file is used only when it is a real image; only the window installs, enables and removes plug-ins; PDF, DXF and PDF comment imports run off the event loop; one-column CSV files are read; a bad or empty zip becomes an intake warning; a wrong-shaped template spec answers problems; phone photos are measured and placed upright; a long paste reaches the terminal whole; intake and PDF reading by agents no longer freeze the engine; review comments posted at the same time all stay; a failing tool or a malformed MCP request gets a JSON-RPC answer; names without Latin letters get their own file; downloads with non-Latin names arrive; an engine on a fallback port tells everyone its real port; non-Latin names save on Windows; save_document asks before overwriting the file it will really write; an uploaded file name cannot leave the pack folder; a website export never deletes files it did not write; published sites and placed assets run sandboxed; a plug-in's fetch checks every redirect hop; document text stays inside a published page's JSON-LD block; run_commands asks for approval wherever run_command does; a template is saved only inside the template library; only the in-app token makes a client the in-app Claude Code; 2026-10-31 · .js, .mjs and .css keep their types on Windows; formdesign-core links the C runtime statically on Windows; 2026-10-30 · the Windows desktop build stops on a failed bundle step; 2026-10-26 · fixes the test suite found (FB-045 to FB-049); 2026-10-25 · LocalGuard; 2026-10-23 · full fonts for the Reserved Font Name families; the ICC profile in the frozen engine
+Current build version: v0.90.0
+Last updated: 2026-11-19 · the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone and serves nothing when started alone · the family's finder 1.0.1 for the four agent programs · an Antigravity tab and agents install antigravity · the tests find only stand-in agent programs · the engine starts with no output streams · only the app window can change what agents may do, open a terminal or answer an approval; the stored agent choices are sealed; the command line is an agent like any other; agents/manifest.json says what the app offers agents; the use_tool description says 41 layout tools; the engine side of the shared dock's contract; 2026-11-13 · no engine change in 0.87.0 (version string only; the demo covers and browser demo pages are in the frontend log); a recent document's first-page thumbnail; three demos built on demand by Make; counts --check fails if a sparkle icon returns; the desktop extension, attach mode and the plugin manifest; 2026-11-11 · engine commands run in the active document; Save to a folder that cannot be made answers 422; a tools/call name that is not a string gets a JSON-RPC error; PNG and JPEG export count pages from 1; the in-app token reaches Claude Code in a private file; 2026-11-10 · Claude chat keeps only the screenshots its messages still show; Claude chat history is found under a non-ASCII agent folder; a prompt that starts with "-" reaches Claude Code as a prompt; text with a non-ASCII style name is placed; bad input to open, pack edits, make, tabs and media answers 4xx; LibreOffice gets a well-formed profile URL; links found in contact and footer text keep their query strings; fixed-layout EPUB marks every animated page as scripted; images from different sources with the same name stay distinct; book operations run one at a time; malformed agent, plug-in, package and book input gets an error message; Edit Original opens only image, vector and PDF files; counts --check reads only the MCP tool count; Windows Node check and install --lite; clean.bat --all removes each folder on its own; build_frontend.bat restores its caller's folder; agents install codex writes valid TOML on Windows; the MCP stdio bridge runs under Python 3.9; every window socket request gets an answer; a Claude Code launch is quoted for the login shell that runs it; a failed thumbnail leaves no document open; a video's poster file is used only when it is a real image; only the window installs, enables and removes plug-ins; PDF, DXF and PDF comment imports run off the event loop; one-column CSV files are read; a bad or empty zip becomes an intake warning; a wrong-shaped template spec answers problems; phone photos are measured and placed upright; a long paste reaches the terminal whole; intake and PDF reading by agents no longer freeze the engine; review comments posted at the same time all stay; a failing tool or a malformed MCP request gets a JSON-RPC answer; names without Latin letters get their own file; downloads with non-Latin names arrive; an engine on a fallback port tells everyone its real port; non-Latin names save on Windows; save_document asks before overwriting the file it will really write; an uploaded file name cannot leave the pack folder; a website export never deletes files it did not write; published sites and placed assets run sandboxed; a plug-in's fetch checks every redirect hop; document text stays inside a published page's JSON-LD block; run_commands asks for approval wherever run_command does; a template is saved only inside the template library; only the in-app token makes a client the in-app Claude Code; 2026-10-31 · .js, .mjs and .css keep their types on Windows; formdesign-core links the C runtime statically on Windows; 2026-10-30 · the Windows desktop build stops on a failed bundle step; 2026-10-26 · fixes the test suite found (FB-045 to FB-049); 2026-10-25 · LocalGuard; 2026-10-23 · full fonts for the Reserved Font Name families; the ICC profile in the frozen engine
---
diff --git a/backend/app/__init__.py b/backend/app/__init__.py
index fcc1a25..5167a01 100644
--- a/backend/app/__init__.py
+++ b/backend/app/__init__.py
@@ -1 +1 @@
-__version__ = "0.89.0"
+__version__ = "0.90.0"
diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md
index 913736a..0ab3989 100644
--- a/frontend/HASHOUT_LOG.md
+++ b/frontend/HASHOUT_LOG.md
@@ -2,8 +2,8 @@
Living log for the window. Source files stay comment-free; what they would have said lives here, indexed. Read it before editing `frontend/`.
-Current build version: v0.89.0
-Last updated: 2026-11-19 · the shared dock is module 2.2.0 with Antigravity as its fourth agent tab · the terminal panel is the family's shared dock · the window takes the engine's key once and sends it on every write · a reload in development tries the kept key before asking the engine again · Agent Connect says in its own line that the saved agent permission was reset to Ask · AMOLED Black, a true-black theme for OLED screens · 2026-11-13 · keys on Home stay on Home · the window is revealed once the first document state is known · Back in the narrow row, the drop card lights, real demo covers, translated Home · the demos as browser pages that replay the engine · the family Home with a side panel that resizes and collapses · three demos open as new documents · the title bar Claude Code and Terminal buttons light with the dock · the unused two-star make glyph is gone · 2026-11-11 · core toast requests reach the screen · PNG and JPEG export pages count from 1 · 2026-11-10 · Find/Change follows the caret into another story · Publish Online waits for the list · Generate Alt Text shows only the latest answer · the Plugins setup lines quote the folder · each glyph preview font gets its own name · the Adjustments curve keeps drawing when two points share an input · pica lengths with a minus sign or a lone point · z-index on the layer scale, colours on real tokens · ticked stories stay with their own document · Claude Code's context names the open document · the Editor role hides its menus in every language · an empty object style stroke weight keeps the default · Make never reuses a removed file's content · margins and columns come from the page in view · Ctrl+J only on Show Terminal · Play Action works before the Actions panel is shown · every pixel ratio change resizes the canvases · tiles load after a tab change mid-request · a slot preview is never saved over the full story · a closed dropdown leaves nothing behind · Document Setup keeps a per-side bleed · a new animation starts from the preset's defaults · the Story Editor sends whole characters · a dropped Library item lands under the cursor · a cancelled file picker leaves no listener · a Text Options paragraph border draws · the panels follow a new selection or caret · a plug-in's panel title is set as text · copied objects without text paste as themselves · Save As and Open as layout pass the answer on · the Missing Fonts note takes the title as text · copy, cut and paste reach the system clipboard
+Current build version: v0.90.0
+Last updated: 2026-11-19 · no window change in 0.90.0 (the version string only) · the shared dock is module 2.2.0 with Antigravity as its fourth agent tab · the terminal panel is the family's shared dock · the window takes the engine's key once and sends it on every write · a reload in development tries the kept key before asking the engine again · Agent Connect says in its own line that the saved agent permission was reset to Ask · AMOLED Black, a true-black theme for OLED screens · 2026-11-13 · keys on Home stay on Home · the window is revealed once the first document state is known · Back in the narrow row, the drop card lights, real demo covers, translated Home · the demos as browser pages that replay the engine · the family Home with a side panel that resizes and collapses · three demos open as new documents · the title bar Claude Code and Terminal buttons light with the dock · the unused two-star make glyph is gone · 2026-11-11 · core toast requests reach the screen · PNG and JPEG export pages count from 1 · 2026-11-10 · Find/Change follows the caret into another story · Publish Online waits for the list · Generate Alt Text shows only the latest answer · the Plugins setup lines quote the folder · each glyph preview font gets its own name · the Adjustments curve keeps drawing when two points share an input · pica lengths with a minus sign or a lone point · z-index on the layer scale, colours on real tokens · ticked stories stay with their own document · Claude Code's context names the open document · the Editor role hides its menus in every language · an empty object style stroke weight keeps the default · Make never reuses a removed file's content · margins and columns come from the page in view · Ctrl+J only on Show Terminal · Play Action works before the Actions panel is shown · every pixel ratio change resizes the canvases · tiles load after a tab change mid-request · a slot preview is never saved over the full story · a closed dropdown leaves nothing behind · Document Setup keeps a per-side bleed · a new animation starts from the preset's defaults · the Story Editor sends whole characters · a dropped Library item lands under the cursor · a cancelled file picker leaves no listener · a Text Options paragraph border draws · the panels follow a new selection or caret · a plug-in's panel title is set as text · copied objects without text paste as themselves · Save As and Open as layout pass the answer on · the Missing Fonts note takes the title as text · copy, cut and paste reach the system clipboard
---
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 55b396e..f365c9a 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "formdesign",
- "version": "0.89.0",
+ "version": "0.90.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "formdesign",
- "version": "0.89.0",
+ "version": "0.90.0",
"license": "Apache-2.0",
"dependencies": {
"@fontsource/inter": "5.3.0",
diff --git a/frontend/package.json b/frontend/package.json
index a4b01c5..7207942 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "formdesign",
"private": true,
- "version": "0.89.0",
+ "version": "0.90.0",
"description": "FormDesign · page layout and publishing in the NodeMode style",
"license": "Apache-2.0",
"type": "module",
diff --git a/frontend/src/version.ts b/frontend/src/version.ts
index 7d50288..1cba419 100644
--- a/frontend/src/version.ts
+++ b/frontend/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.89.0';
+export const VERSION = '0.90.0';
diff --git a/native/Cargo.lock b/native/Cargo.lock
index 996f69c..ae81961 100644
--- a/native/Cargo.lock
+++ b/native/Cargo.lock
@@ -410,7 +410,7 @@ dependencies = [
[[package]]
name = "formdesign-core"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"fancy-regex",
"formdesign-engine",
@@ -426,7 +426,7 @@ dependencies = [
[[package]]
name = "formdesign-engine"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"fancy-regex",
"formdesign-interchange",
@@ -445,7 +445,7 @@ dependencies = [
[[package]]
name = "formdesign-gpu"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"bytemuck",
"png",
@@ -456,7 +456,7 @@ dependencies = [
[[package]]
name = "formdesign-interchange"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"formdesign-model",
"kurbo",
@@ -467,7 +467,7 @@ dependencies = [
[[package]]
name = "formdesign-model"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"kurbo",
"serde",
@@ -477,7 +477,7 @@ dependencies = [
[[package]]
name = "formdesign-render"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"formdesign-model",
"formdesign-text",
@@ -493,7 +493,7 @@ dependencies = [
[[package]]
name = "formdesign-text"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"fancy-regex",
"fontdb",
diff --git a/native/Cargo.toml b/native/Cargo.toml
index 47d99a9..e4ce0d3 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -3,7 +3,7 @@ resolver = "3"
members = ["formdesign-core", "formdesign-model", "formdesign-text", "formdesign-render", "formdesign-engine", "formdesign-interchange", "formdesign-gpu"]
[workspace.package]
-version = "0.89.0"
+version = "0.90.0"
edition = "2024"
license = "Apache-2.0"
rust-version = "1.90"
diff --git a/native/HASHOUT_LOG.md b/native/HASHOUT_LOG.md
index a65d871..ed9f02e 100644
--- a/native/HASHOUT_LOG.md
+++ b/native/HASHOUT_LOG.md
@@ -2,8 +2,8 @@
Living log for the layout core. Source files stay comment-free; what they would have said lives here, indexed. Read it before editing `native/`.
-Current build version: v0.89.0
-Last updated: 2026-11-19 · no core change in 0.89.0 (the version string only) · no core change in 0.88.0 (the version string and the repository address in Cargo.toml only); 2026-11-13 · no core change in 0.87.0 or 0.86.0 (version string only); 2026-11-11 · PSD header and image data checked before placing; 2026-11-10 · IDML stroke tint and image resolution; 2026-11-10 · HTML entities and intraword underscores on import; 2026-11-10 · IDML link paths decoded as UTF-8; 2026-11-10 · font names filtered in export CSS; 2026-11-10 · PSD formats and sizes checked before decoding; 2026-11-10 · raster scale from the determinant; 2026-11-10 · Separations preview leaves soft masks alone; 2026-11-10 · placed PDF renders bounded per asset; 2026-11-10 · font fallback probes the character map in place; 2026-11-10 · drop cap letters out of the first line's measure; 2026-11-10 · repaint of running headers and live captions; 2026-11-10 · No Break inside the run; 2026-11-10 · newer-format check before parsing; 2026-11-10 · Place reports unplaceable files; 2026-11-10 · thread cursor on groups and refused threads; 2026-11-10 · widow cut takes back its footnotes; 2026-11-10 · Sort Rows keeps exact heights; 2026-11-10 · small caps in website export; 2026-11-10 · Find index markers; 2026-11-10 · raster text brushes in the run's space; 2026-11-10 · unknown align edges refused; 2026-11-10 · hyphenated page names in ranges; 2026-11-10 · rows inserted in a table footer; 2026-11-10 · index order for accented topics; 2026-11-10 · XML tag names checked everywhere; 2026-11-10 · style based-on cycles refused; 2026-11-10 · Trace Image on a transparent picture; 2026-11-10 · Change Case per character; 2026-11-10 · grey percent read back; 2026-11-10 · colour arrays scaled as a whole; 2026-11-10 · RTF code page and Unicode fallback; 2026-11-10 · non-ASCII hex colours refused; 2026-11-10 · GPU tile budget ceiling and error handler; 2026-11-10 · overlapping row and column deletes; 2026-11-10 · page deletion cleans anchored objects and links; 2026-11-10 · native canvas shadows under every page; 2026-11-10 · preflight bleed inside groups; 2026-11-10 · numeric references in Import XML; 2026-11-10 · layer views of duplicated frames; 2026-11-10 · section starts follow duplicated and moved pages; 2026-11-10 · tool state left behind on a document change; 2026-11-10 · IDML OverrideList read back; 2026-11-10 · swatches carried with pasted text and styles; 2026-11-10 · table and cell style rename; 2026-11-10 · frame.thread target check; 2026-11-10 · IDML language names; 2026-11-10 · forced line breaks in IDML export; 2026-11-10 · Arrange on several objects; 2026-11-10 · bounded table import; 2026-11-10 · clipboard in table cells; 2026-11-10 · anchored release in text order; 2026-11-10 · format-only Change All; 2026-11-10 · `$$N` escape in batches; 2026-11-10 · size limit on zipped XML parts; 2026-11-10 · added fonts reach open documents; 2026-11-10 · stale text caret clamped and dropped; 2026-11-10 · XML nesting depth limit; 2026-11-10 · closing a background document; 2026-11-10 · IDML links read only as image files; 2026-11-10 · Change All reaches table cells after body edits; 2026-11-10 · text frames made plain drop their story; 2026-11-10 · a panicking request restores the document; 2026-11-10 · stale recovery snapshots; 2026-11-10 · batch undo entries past the 500-entry limit; 2026-11-10 · table cell lines placed whole; 2026-11-10 · text position map after markers and variables; 2026-10-31 · no core change in 0.85.2 (version string only; the Windows build links the C runtime statically, see the backend log); 2026-10-26 · layout core tests; 2026-10-23 · hyphenation without the GPL Slovak patterns
+Current build version: v0.90.0
+Last updated: 2026-11-19 · no core change in 0.90.0 (the version string only) · no core change in 0.89.0 (the version string only) · no core change in 0.88.0 (the version string and the repository address in Cargo.toml only); 2026-11-13 · no core change in 0.87.0 or 0.86.0 (version string only); 2026-11-11 · PSD header and image data checked before placing; 2026-11-10 · IDML stroke tint and image resolution; 2026-11-10 · HTML entities and intraword underscores on import; 2026-11-10 · IDML link paths decoded as UTF-8; 2026-11-10 · font names filtered in export CSS; 2026-11-10 · PSD formats and sizes checked before decoding; 2026-11-10 · raster scale from the determinant; 2026-11-10 · Separations preview leaves soft masks alone; 2026-11-10 · placed PDF renders bounded per asset; 2026-11-10 · font fallback probes the character map in place; 2026-11-10 · drop cap letters out of the first line's measure; 2026-11-10 · repaint of running headers and live captions; 2026-11-10 · No Break inside the run; 2026-11-10 · newer-format check before parsing; 2026-11-10 · Place reports unplaceable files; 2026-11-10 · thread cursor on groups and refused threads; 2026-11-10 · widow cut takes back its footnotes; 2026-11-10 · Sort Rows keeps exact heights; 2026-11-10 · small caps in website export; 2026-11-10 · Find index markers; 2026-11-10 · raster text brushes in the run's space; 2026-11-10 · unknown align edges refused; 2026-11-10 · hyphenated page names in ranges; 2026-11-10 · rows inserted in a table footer; 2026-11-10 · index order for accented topics; 2026-11-10 · XML tag names checked everywhere; 2026-11-10 · style based-on cycles refused; 2026-11-10 · Trace Image on a transparent picture; 2026-11-10 · Change Case per character; 2026-11-10 · grey percent read back; 2026-11-10 · colour arrays scaled as a whole; 2026-11-10 · RTF code page and Unicode fallback; 2026-11-10 · non-ASCII hex colours refused; 2026-11-10 · GPU tile budget ceiling and error handler; 2026-11-10 · overlapping row and column deletes; 2026-11-10 · page deletion cleans anchored objects and links; 2026-11-10 · native canvas shadows under every page; 2026-11-10 · preflight bleed inside groups; 2026-11-10 · numeric references in Import XML; 2026-11-10 · layer views of duplicated frames; 2026-11-10 · section starts follow duplicated and moved pages; 2026-11-10 · tool state left behind on a document change; 2026-11-10 · IDML OverrideList read back; 2026-11-10 · swatches carried with pasted text and styles; 2026-11-10 · table and cell style rename; 2026-11-10 · frame.thread target check; 2026-11-10 · IDML language names; 2026-11-10 · forced line breaks in IDML export; 2026-11-10 · Arrange on several objects; 2026-11-10 · bounded table import; 2026-11-10 · clipboard in table cells; 2026-11-10 · anchored release in text order; 2026-11-10 · format-only Change All; 2026-11-10 · `$$N` escape in batches; 2026-11-10 · size limit on zipped XML parts; 2026-11-10 · added fonts reach open documents; 2026-11-10 · stale text caret clamped and dropped; 2026-11-10 · XML nesting depth limit; 2026-11-10 · closing a background document; 2026-11-10 · IDML links read only as image files; 2026-11-10 · Change All reaches table cells after body edits; 2026-11-10 · text frames made plain drop their story; 2026-11-10 · a panicking request restores the document; 2026-11-10 · stale recovery snapshots; 2026-11-10 · batch undo entries past the 500-entry limit; 2026-11-10 · table cell lines placed whole; 2026-11-10 · text position map after markers and variables; 2026-10-31 · no core change in 0.85.2 (version string only; the Windows build links the C runtime statically, see the backend log); 2026-10-26 · layout core tests; 2026-10-23 · hyphenation without the GPL Slovak patterns
---
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index ca5ddb2..d222f75 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -984,7 +984,7 @@ dependencies = [
[[package]]
name = "formdesign"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"formdesign-gpu",
"objc2",
@@ -1002,7 +1002,7 @@ dependencies = [
[[package]]
name = "formdesign-gpu"
-version = "0.89.0"
+version = "0.90.0"
dependencies = [
"bytemuck",
"pollster",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 52555fe..75a2625 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "formdesign"
-version = "0.89.0"
+version = "0.90.0"
description = "FormDesign desktop shell"
authors = ["nodemode-ai"]
license = "Apache-2.0"
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 9de26d6..96979e5 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "FormDesign",
- "version": "0.89.0",
+ "version": "0.90.0",
"identifier": "ai.nodemode.formdesign",
"build": {
"frontendDist": "../frontend/dist"