Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
docs: clarify doclib owner diagnostics
jinzhenjf12256777f6e
diff --git a/docs/plans/2026-07-22-doclib-home-ownership-lock-design.md b/docs/plans/2026-07-22-doclib-home-ownership-lock-design.mdindex fa56e025..d859bb46 100644--- a/docs/plans/2026-07-22-doclib-home-ownership-lock-design.md+++ b/docs/plans/2026-07-22-doclib-home-ownership-lock-design.md@@ -21,9 +21,15 @@ concurrent CLI behavior but does not establish ownership. The server-side`doclib.lock` is authoritative and also covers direct app invocation.The lock path is always derived from `MINERU_HOME` and is not independently-configurable. The lock file may remain on disk permanently; its existence does-not indicate ownership and it must not contain required metadata. PID,-`server_id`, and transports remain in `doclib.endpoint.json`.+configurable. Lock-file retention is platform-specific; its existence does not+indicate ownership and it must not contain required metadata. PID, `server_id`,+and transports remain in `doclib.endpoint.json`.++No separate owner metadata file is introduced. While `doclib.lock` remains the+ownership authority, `doclib.endpoint.json` also acts as a cooperative+diagnostic record for the current owner. PID is diagnostic only: clients must+not use it to establish ownership, automatically terminate a process, or decide+that a stale lock can be removed.## Lifecycle@@ -32,8 +38,19 @@ Startup proceeds in this order:1. Create `MINERU_HOME` if necessary.2. Acquire `doclib.lock` without waiting.3. Remove stale endpoint and UDS files.-4. Create the app, initialize doclib state, and start managed services.-5. Write the endpoint only after transports bind successfully.+4. Create the app identity and atomically write an endpoint containing the+ current PID, `server_id`, and an empty transport list.+5. Bind transports and atomically update the endpoint with the usable transport+ list.+6. Initialize doclib state and start managed services through app lifespan.++Writing the empty-transport endpoint closes the normal startup diagnostic gap:+when ownership is held but no transport responds yet, CLI errors can report the+current owner's PID. If endpoint metadata is absent or invalid, the CLI omits+the PID rather than guessing. It never falls back to platform-specific lock+inspection or automatic process cleanup. A PID may belong to another runtime+namespace when a home is shared, so the message presents it only as reported+diagnostic information.Shutdown stops the managed parse server and background workers, closes doclibresources, removes endpoint and UDS discovery files while ownership is still@@ -41,10 +58,18 @@ held, and finally releases `doclib.lock`. Abrupt process exit releases the OSlock automatically; the next owner removes stale discovery files after itacquires the lock.+CLI stop and restart wait for both endpoint unavailability and ownership lock+release. After acquiring the released lock, the CLI performs fallback endpoint+and UDS cleanup while still holding ownership. Endpoint disappearance alone does+not prove that shutdown cleanup has finished or that a replacement can safely+start.+Failure to acquire the lock exits startup with a concise message identifyingthe home and lock path. It does not remove endpoint, UDS, database, or lockfiles. A live endpoint may still be queried for diagnostics, but endpoint state-never overrides ownership.+never overrides ownership. When the lock is held but the endpoint does not+respond, `start`, `stop`, and `status` include the endpoint PID if a valid value+is available; otherwise they retain the same error without a PID.The guarantee applies between versions that implement `doclib.lock`. Existingendpoint probing remains useful during upgrades, but an older process that does@@ -64,4 +89,6 @@ Tests cover lock-path derivation, direct double startup, concurrent CLI startup,lock release after graceful and abrupt exit, startup cleanup only after lockacquisition, and preservation of discovery files when acquisition fails. Areal-process test confirms that only one server can initialize a shared home and-that a replacement can start after the owner exits.+that a replacement can start after the owner exits. Endpoint tests also cover+the early empty-transport diagnostic record and CLI error rendering with and+without an available PID.