From fff0a027b5bc559388a5b01f5866573e6dc8c876 Mon Sep 17 00:00:00 2001 From: Jordan Partridge Date: Fri, 3 Jul 2026 20:33:10 -0700 Subject: [PATCH 1/2] fix: queue enhancements under the resolved project namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The enhancement queue was enqueuing every entry with the default project, while storage is project-aware. The worker then looked up entries in knowledge_default, found nothing, and recorded a failure — every enhancement since project namespacing rolled out has failed (8,560 failures, last success 2026-03-09). One-line fix: pass resolveProject() at the enqueue call site, matching the upsert above. --- app/Commands/KnowledgeAddCommand.php | 2 +- .../Commands/KnowledgeAddCommandTest.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/Commands/KnowledgeAddCommand.php b/app/Commands/KnowledgeAddCommand.php index 66c5a67..063df04 100644 --- a/app/Commands/KnowledgeAddCommand.php +++ b/app/Commands/KnowledgeAddCommand.php @@ -192,7 +192,7 @@ public function handle(GitContextService $gitService, QdrantService $qdrant, Wri // Queue for Ollama enhancement unless skipped if (! $skipEnhance && (bool) config('search.ollama.enabled', true)) { - $enhancementQueue->queue($data); + $enhancementQueue->queue($data, $this->resolveProject()); } info('Knowledge entry created!'); diff --git a/tests/Feature/Commands/KnowledgeAddCommandTest.php b/tests/Feature/Commands/KnowledgeAddCommandTest.php index e5d3ed1..3d62fa8 100644 --- a/tests/Feature/Commands/KnowledgeAddCommandTest.php +++ b/tests/Feature/Commands/KnowledgeAddCommandTest.php @@ -376,3 +376,25 @@ '--content' => 'Content', ])->assertSuccessful(); }); + +it('queues enhancement under the resolved project namespace', function (): void { + mockProjectDetector('mesh-status'); + + $this->mockQdrant->shouldReceive('upsert') + ->once() + ->with(Mockery::any(), 'mesh-status', Mockery::any()) + ->andReturn(true); + + $mockQueue = Mockery::mock(\App\Services\EnhancementQueueService::class); + $mockQueue->shouldReceive('queue') + ->once() + ->with(Mockery::type('array'), 'mesh-status'); + $this->app->instance(\App\Services\EnhancementQueueService::class, $mockQueue); + + config(['search.ollama.enabled' => true]); + + $this->artisan('add', [ + 'title' => 'Project Scoped Entry', + '--content' => 'Enhancement must look in the same collection the entry was stored in', + ])->assertSuccessful(); +}); From e6c24242ea8fa2f66bc5de6ca1ac90440d9712b4 Mon Sep 17 00:00:00 2001 From: Jordan Partridge Date: Fri, 3 Jul 2026 20:38:57 -0700 Subject: [PATCH 2/2] test: update legacy enqueue expectation for project argument --- tests/Feature/KnowledgeAddCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/KnowledgeAddCommandTest.php b/tests/Feature/KnowledgeAddCommandTest.php index 3c1b1e2..2d51c67 100644 --- a/tests/Feature/KnowledgeAddCommandTest.php +++ b/tests/Feature/KnowledgeAddCommandTest.php @@ -199,7 +199,7 @@ $this->enhancementQueue->shouldReceive('queue') ->once() - ->with(Mockery::on(fn ($data): bool => $data['title'] === 'Enhanced Entry')); + ->with(Mockery::on(fn ($data): bool => $data['title'] === 'Enhanced Entry'), 'default'); $this->artisan('add', [ 'title' => 'Enhanced Entry',