From 43f2dfcd64ef1348f2037bbc53f3c0b396f7708e Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 28 Nov 2025 19:08:35 +0530 Subject: [PATCH 1/4] chore: bump runner ubuntu to 24.04 Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4f96d49..ce0f9f9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -23,7 +23,7 @@ concurrency: jobs: scan-test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: # do not stop on another job's failure @@ -330,7 +330,7 @@ jobs: tail -v -n +1 context_chat_backend/persistent_storage/logs/* || echo "No logs in logs directory" cron-test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: # do not stop on another job's failure @@ -627,7 +627,7 @@ jobs: tail -v -n +1 context_chat_backend/persistent_storage/logs/* || echo "No logs in logs directory" listener-test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: # do not stop on another job's failure From 04bd604b896a8959fbda6b2ab08f39f98618c949 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 28 Nov 2025 19:11:26 +0530 Subject: [PATCH 2/4] fix(ci): use the cpu version of torch in static analysis Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ce0f9f9..43d129d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -215,6 +215,9 @@ jobs: run: | cd context_chat_backend pip install --upgrade pip setuptools wheel + # use the cpu version of torch to not run out of space + pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu + sed -i '/torch(vision)?/d' requirements.txt pip install -r requirements.txt cp example.env .env echo "NEXTCLOUD_URL=http://localhost:8080" >> .env @@ -466,6 +469,9 @@ jobs: run: | cd context_chat_backend pip install --upgrade pip setuptools wheel + # use the cpu version of torch to not run out of space + pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu + sed -i '/torch(vision)?/d' requirements.txt pip install -r requirements.txt cp example.env .env echo "NEXTCLOUD_URL=http://localhost:8080" >> .env @@ -771,6 +777,9 @@ jobs: run: | cd context_chat_backend pip install --upgrade pip setuptools wheel + # use the cpu version of torch to not run out of space + pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu + sed -i '/torch(vision)?/d' requirements.txt pip install -r requirements.txt cp example.env .env echo "NEXTCLOUD_URL=http://localhost:8080" >> .env From 3a69df1b6bc680a7309c97f5f518f265958ea7ff Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 4 Dec 2025 14:03:26 +0530 Subject: [PATCH 3/4] fix: setup user FS before getting files by ID Signed-off-by: Anupam Kumar --- lib/Service/MetadataService.php | 35 ++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/Service/MetadataService.php b/lib/Service/MetadataService.php index 5c0dadd..fb52786 100644 --- a/lib/Service/MetadataService.php +++ b/lib/Service/MetadataService.php @@ -7,6 +7,7 @@ namespace OCA\ContextChat\Service; +use OC\Files\SetupManager; use OCA\ContextChat\Logger; use OCA\ContextChat\Public\ContentManager; use OCA\ContextChat\Public\IContentProvider; @@ -166,14 +167,34 @@ public function getEnrichedSources(string $userId, string ...$sources): array { } } - # for files - foreach ($sources as $source) { - if (!str_starts_with($source, ProviderConfigService::getDefaultProviderKey() . ': ')) { - continue; - } - $enrichedSources[] = $this->getMetadataObjectForId($userId, $source); + $setupManager = \OCP\Server::get(SetupManager::class); + $user = $this->userManager->get($userId); + + if ($user === null) { + $this->logger->warning('User not found for enriching sources', ['userId' => $userId]); + return $enrichedSources; } - return $enrichedSources; + try { + $setupManager->setupForUser($user); + } catch (\Throwable $e) { + $this->logger->error('Error setting up filesystem for user ' . $userId . ': ' . $e->getMessage(), ['exception' => $e]); + return $enrichedSources; + } + + try { + # for files + foreach ($sources as $source) { + if (!str_starts_with($source, ProviderConfigService::getDefaultProviderKey() . ': ')) { + continue; + } + $enrichedSources[] = $this->getMetadataObjectForId($userId, $source); + } + } catch (\Throwable $e) { + $this->logger->error('Error enriching file sources: ' . $e->getMessage(), ['exception' => $e]); + } finally { + $setupManager->tearDown(); + return $enrichedSources; + } } } From 12343c278ab810f738878b36b2171173433807fb Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 4 Dec 2025 15:12:58 +0530 Subject: [PATCH 4/4] fix psalm Signed-off-by: Anupam Kumar --- tests/psalm-baseline.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 5e64b85..2e90ec5 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -34,4 +34,11 @@ + + + + + + +