Skip to content

fix: resolve upgrade DB issue, production startup failure, add debug/stop commands#38

Open
MoYoez wants to merge 3 commits into
Innei:mainfrom
MoYoez:main
Open

fix: resolve upgrade DB issue, production startup failure, add debug/stop commands#38
MoYoez wants to merge 3 commits into
Innei:mainfrom
MoYoez:main

Conversation

@MoYoez

@MoYoez MoYoez commented May 4, 2026

Copy link
Copy Markdown
  • I have read the checklist above (put an x in the brackets)

Description

Before

  • Database Problem

First time I tried using "npm install -g @innei/kagura" to install the latest version of kagura, found that I cannot interact with slack bot, so I pull the main branch and built a version and linked to the latest version.

The problem is here, looks like the program itself will not migrate.

image
  • Start Problem

Looks like the program just exit and didnt run in the background,
image

image

After

image

Also I added a simple command prefix (--debug), to check whever the program work correctly.

image

Linked Issues

none

AI collaboration (required; say if you used none)

1. Workflow

I used AI to read the relevant startup, database, and CLI code paths, and run local verification.

I reviewed and adjusted the behavior through several iterations, especially around migration timing, debug output, daemon startup, and stop semantics.

2. Prompt (or equivalent task description)

  • Investigate why database table changes were not applied after a new build/release

  • Check what happened when using "Kagura" and application not response.

3. Reasoning and trade-offs

My local machine is Windows, and I cannot fully run the normal Slack workflow there, so I focused on inspecting the program behavior and adding better diagnostics.

I was not sure what happened after running the kagura command, so I added a --debug mode to print startup diagnostics such as config paths, environment presence, database path, and migration path. During that investigation, I found that the CLI could return after startup instead of keeping the Slack Socket Mode process alive, so I changed the normal startup path to launch Kagura as a background daemon.

To make local testing easier, and to avoid manually killing Node processes from Task Manager, I also added a kagura stop command.

While debugging startup, I also found that upgraded versions did not automatically apply database migrations before using newer tables or columns. I fixed that by running packaged Drizzle migrations during database initialization.

Additional context

btw I found that the when using "pnpm dev" after following the readme, looks like the .env didnt read correctly?

image

working platform is Windows 11

@safedep

safedep Bot commented May 4, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

@Loongphy

Copy link
Copy Markdown

Same here.

 kagura
◇ injecting env (4) from .config/kagura/.env // tip: ⌘ multiple files { path: ['.env.local', '.env'] }
◇ injecting env (0) from .config/kagura/.env // tip: ⌘ enable debugging { debug: true }
◇ injecting env (0) from .env // tip: ◈ secrets for agents [www.dotenvx.com]
ℹ Memory reconciler disabled by config; expired-only prune via startup hook                     bootstrap 4:27:01 PM
[bootstrap:claude:session 4:27:01 PM] ℹ Claude Code runtime config at executor startup: CLAUDE_MODEL=(unset) ANTHROPIC_MODEL=(unset) ANTHROPIC_DEFAULT_SONNET_MODEL=(unset) ANTHROPIC_DEFAULT_HAIKU_MODEL=(unset) ANTHROPIC_DEFAULT_OPUS_MODEL=(unset) ANTHROPIC_BASE_URL=(unset)
[bootstrap:codex:session 4:27:01 PM] ℹ Codex CLI provider configured: model=(config default) reasoning=(config default) sandbox=danger-full-access
[bootstrap:pi-agent:session 4:27:01 PM] ℹ Pi Agent provider configured: command=pi args=["-p","--mode","json"] model=(unknown)
[bootstrap:slack:commands 4:27:01 PM] ℹ Registered 7 slash commands: /usage, /workspace, /memory, /session, /version, /provider, /model
[bootstrap:claude:session 4:27:02 PM] ℹ Claude Code auth status at executor startup: loggedIn=true authMethod=oauth_token apiProvider=firstParty subscriptionType=(unknown) email=(unknown) orgName=(unknown)
ℹ Slack Socket Mode application started.                                                        bootstrap 4:27:02 PM
⚠ Memory reconciler tick failed: no such table: memories                      bootstrap:memory-reconciler 4:27:02 PM

 ERROR  Failed to recover interrupted agent executions: no such table: agent_executions          bootstrap 4:27:02 PM

cc @Innei can we merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants