Log kli witness start failures and prevent startup stalls (#238) — v1.3 backport - #1486
Merged
pfeairheller merged 3 commits intoJul 31, 2026
Merged
Conversation
…ust#1367) runWitness opened the boot Keeper to read the aeid but never closed it before Habery/setupHby re-opened the same keystore. On Linux LMDB then raised "environment is already open in this process" and the witness could not start. Close the boot Keeper immediately after reading the aeid, matching the fix already present on the 1.2 and 2.0 lines. Regression test spies on Keeper.close to confirm it runs before the re-open; reverting the fix turns the test red with the LMDB error. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
…bOfTrust#238) Startup/runtime failures in kli witness start are now logged at CRITICAL with a traceback so they surface even at the default --loglevel, and the Habery is closed in a finally block so a failed start leaves no stale LMDB lock. An encrypted keystore started with no passcode on a non-TTY now fails fast with a logged AuthError (threaded through a new setupHby noPrompt argument and a --no-prompt flag) instead of blocking on an interactive getpass prompt. --loglevel is normalized with .upper() so a lowercase level such as debug is honored. Backport of WebOfTrust#1477 to the 1.3 line. Fixes WebOfTrust#238. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
…rust#238) --logfile is renamed to the accurately-named --logdir: the logging backend derives the log file name from --name and the log subdirectory from its own prefix, so only the directory is meaningful. The old code mis-assigned the whole file path as the log head directory. --logfile is retained as a deprecated alias whose directory portion is used, and a deprecation notice reporting the resolved log path is printed to stderr. Backport of WebOfTrust#1477 to the 1.3 line. Part of WebOfTrust#238. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
kentbull
approved these changes
Jul 11, 2026
Contributor
|
I reviewed the |
Contributor
Author
|
@kentbull — approved on 2026-07-11 and still open. Could this land on Worth flagging an inversion this has created: the 1.2 backport (#1487) merged on 2026-07-14, so the 1.2 line now carries the #238 fix while 1.3.5 and Unchanged from your review: three individually-droppable commits, the first being the boot-Keeper |
pfeairheller
approved these changes
Jul 31, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #1477 to the 1.3 line (base
v1.3.5).kli witness startcouldstall during startup and did not reliably log error conditions (#238). This PR
makes the command log every startup/runtime failure visibly, eliminates the
interactive-prompt stall, and deprecates the mis-named
--logfilein favor of theaccurate
--logdir. Fixes #238.The change is split into three commits so pieces can be dropped independently:
ks.close()fix that the 1.2 and 2.0 lines already carry, so on Linux LMDBraises
environment is already open in this processand the witness cannotstart once
runWitnessreaches the Habery/setupHbyre-open. This commitrestores it. Note: on 1.3.5 this is a functional prerequisite, not merely
optional — the Ensure
kli witness startlogs errors correctly #238 logging fix can't be exercised without it, so droppingthis commit would also require adjusting one test.
kli witness startlogs errors correctly #238). Startup/runtime failures arelogged at CRITICAL with a traceback (so they surface at the default
--loglevel), theHaberyis closed in afinallyso a failed start leavesno stale LMDB lock, and an encrypted keystore started with no passcode on a
non-TTY fails fast with a logged
AuthErrorinstead of blocking on aninteractive
getpass.--loglevelis normalized with.upper()so alowercase level (e.g.
debug) is honored.--logfilein favor of--logdir(Ensurekli witness startlogs errors correctly #238). The logging backendderives the file name from
--nameand the subdirectory from its own prefix,so only the directory is meaningful; the old code mis-assigned the whole file
path as the log head directory.
--logfileis retained as a deprecated aliaswhose directory portion is used, with a stderr deprecation notice. Droppable
if you'd rather not change the CLI surface in a patch release.
Tests
Regression + unit tests added to
tests/app/cli/test_kli_commands.py, coveringthe boot-Keeper close ordering, CRITICAL failure logging +
Haberycleanup, thenon-TTY fast-fail (both the no-passcode and wrong-passcode paths),
--loglevelnormalization, and
--logdir/--logfiledirectory handling + the deprecationnotice. Each assertion was mutation-checked — reverting the corresponding fix
turns the targeted test red. The 1.3 CI does not run pytest under
-n auto, sothe shared-store xdist isolation fix from #1477 is not needed here.
Relationship to #1477
Same fix as the approved #1477 (base
main, 2.0), adapted to the 1.3 CLI layout(
keri.app.cli.*, absolute imports,help.ogler). Opened per your request on#1477.
This code was developed with Claude (using the Opus 4.8 model, mostly). However,
I (Daniel the human) have read, reviewed, and worked the code, and I stand behind
it and take responsibility for it.