poc-memory: load AppConfig at startup

admin load-context (and any subcommand that reaches config::app())
panicked with "config::app() called before load_app()" because the
poc-memory binary never initialized the global AppConfig. The main
consciousness binary loads it via load_session; poc-memory never did.

Load with default CliArgs before dispatch — figment still pulls from
~/.consciousness/config.json5 and env the same way. Bail on error
instead of limping: a broken config means paths like memory_root are
wrong and the tool will misbehave silently.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-16 18:17:05 -04:00
parent 204ba5570a
commit 6f20e68865

View file

@ -482,6 +482,14 @@ async fn main() {
let cli = Cli::parse();
// Some subcommands (e.g. admin load-context) read from the global
// AppConfig. poc-memory has no config CLI flags of its own, so load
// with defaults — figment still pulls from ~/.consciousness/config.json5
// and env the same way.
if let Err(e) = crate::config::load_app(&crate::user::CliArgs::default()) {
eprintln!("warning: failed to load config: {:#}", e);
}
if let Err(e) = cli.command.run().await {
eprintln!("Error: {}", e);
process::exit(1);