Skip to content

Bug/plat 655/kb database host path change not applied on update#416

Closed
moizpgedge wants to merge 2 commits into
mainfrom
Bug/PLAT-655/kb_database_host_path-change-not-applied-on-update
Closed

Bug/plat 655/kb database host path change not applied on update#416
moizpgedge wants to merge 2 commits into
mainfrom
Bug/PLAT-655/kb_database_host_path-change-not-applied-on-update

Conversation

@moizpgedge

Copy link
Copy Markdown
Contributor

kb_database_host_path pointing at a directory passed the deploy-time existence check (afero.Exists is true for directories), so the service deployed and only failed later at query time when MCP tried to open the directory as a SQLite database.

checkKBFileExists now rejects a directory with a clear error at deploy time, and a regression test covers it.

plat-662

KB config changes (path, provider, model, key) had no effect after an
update: config.yaml is bind-mounted so SIGHUP-only reload kept the old
KB path, causing "file not found" / SQLite errors. Embed a
PGEDGE_CONFIG_VERSION hash in the MCP container env (like RAG) so a
config change forces a restart and re-initializes the KB.

Also refresh the service instance's UpdatedAt before an update redeploy
so the monitor doesn't briefly mark it failed during the restart.
@moizpgedge moizpgedge closed this Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ecca33ef-6e7e-4b93-acfd-a45732d83b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7390c and 5726453.

📒 Files selected for processing (3)
  • server/internal/orchestrator/swarm/service_instance.go
  • server/internal/orchestrator/swarm/service_spec.go
  • server/internal/orchestrator/swarm/service_spec_test.go

📝 Walkthrough

Walkthrough

The PR introduces two independent changes to the swarm orchestration package: (1) a serviceConfigHash helper replaces ragConfigHash and is now applied to both MCP and RAG service-type branches to embed PGEDGE_CONFIG_VERSION in container environments, triggering Swarm task restarts on config changes; (2) ServiceInstanceResource.Update performs a best-effort DB state refresh to running before redeployment to prevent the monitor from prematurely marking instances as failed.

Changes

serviceConfigHash Unification for MCP and RAG

Layer / File(s) Summary
serviceConfigHash helper and injection into MCP and RAG specs
server/internal/orchestrator/swarm/service_spec.go
Adds serviceConfigHash (replacing ragConfigHash), injects PGEDGE_CONFIG_VERSION via serviceConfigHash into the MCP container env branch, and updates the RAG branch to use serviceConfigHash.
Tests for serviceConfigHash and MCP PGEDGE_CONFIG_VERSION
server/internal/orchestrator/swarm/service_spec_test.go
Updates RAG hash and env var tests to call serviceConfigHash, updates the MCP spec test to assert PGEDGE_CONFIG_VERSION is present, and adds TestServiceContainerSpec_MCPHasConfigVersionEnv covering value correctness and config-change sensitivity.

Pre-deploy UpdatedAt Refresh

Layer / File(s) Summary
Best-effort UpdatedAt refresh before redeploy
server/internal/orchestrator/swarm/service_instance.go
In Update, fetches a logger and DB service, sets the instance state to running to refresh UpdatedAt, logs a warning on failure, and always continues to deploy.

Poem

🐇 Hop, hop—before we restart,
We stamp the clock with a running heart!
One hash for RAG, one hash for MCP,
PGEDGE_CONFIG_VERSION sets them free.
No false failures while Docker's away—
The monitor bunny says: "All is okay!" 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Bug/PLAT-655/kb_database_host_path-change-not-applied-on-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

1 participant