Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
21055c3
Move S3 indexing input cleanup to an operator script
suguanYang Nov 27, 2026
dbbe2f3
Merge branch 'main' into fix/wangbinqi/move-indexing-input-cleanup-to…
suguanYang Nov 27, 2026
53aeaf0
Merge pull request #589 from Ontos-AI/fix/wangbinqi/move-indexing-inp…
suguanYang Nov 27, 2026
c4c3ee1
Prepare production database TLS and API transaction timeouts
suguanYang Nov 27, 2026
7036495
Merge pull request #591 from Ontos-AI/fix/wangbinqi/prepare-neon-data…
suguanYang Nov 27, 2026
daccfc8
Isolate Markdown heading preparation from the Worker loop
suguanYang Nov 28, 2026
1b14de6
Resolve Markdown subprocess review checks
suguanYang Nov 28, 2026
a90c172
Keep Markdown heading isolation on alternate execution paths
suguanYang Nov 28, 2026
5aadf07
Merge pull request #592 from Ontos-AI/fix/wangbinqi/isolate-markdown-…
suguanYang Nov 28, 2026
21771c1
Project heading tree levels in linear time
suguanYang Nov 28, 2026
dc58b0d
Merge pull request #593 from Ontos-AI/fix/wangbinqi/linear-heading-tr…
suguanYang Nov 28, 2026
5603397
Raise production lexical indexing input limit
suguanYang Nov 29, 2026
dc246d1
Merge pull request #594 from Ontos-AI/fix/wangbinqi/production-indexi…
suguanYang Nov 29, 2026
20dc01a
Preserve anchors on TOC rehome path collisions
suguanYang Nov 29, 2026
f7ca9ad
Make Knowhere production S3 placement configurable
suguanYang Nov 29, 2026
59686cb
Merge pull request #595 from Ontos-AI/fix/wangbinqi/preserve-toc-reho…
suguanYang Nov 29, 2026
1840829
Merge pull request #596 from Ontos-AI/ci/wangbinqi/production-s3-region
suguanYang Nov 29, 2026
7b85a35
Retire the Virginia storage fallback from production releases
suguanYang Nov 29, 2026
4cdf625
Merge pull request #597 from Ontos-AI/ci/wangbinqi/retire-virginia-pr…
suguanYang Nov 29, 2026
0e1b31b
Let the OpenSearch worker clear its delete-by-query scrolls
suguanYang Dec 1, 2026
0c6d4f7
Stop deploy/opensearch/operator.py shadowing the stdlib operator module
suguanYang Dec 1, 2026
5db63f8
Merge pull request #600 from Ontos-AI/fix/wangbinqi/worker-scroll-cle…
suguanYang Dec 1, 2026
911faff
Merge pull request #601 from Ontos-AI/fix/wangbinqi/opensearch-operat…
suguanYang Dec 1, 2026
ed37437
Release uncertain lexical leases that can no longer cover a request
suguanYang Dec 1, 2026
b4c21ff
Keep a cold numpy import out of the execution-timeout test's timer
suguanYang Dec 1, 2026
8fccc9d
Merge pull request #602 from Ontos-AI/fix/wangbinqi/release-uncertain…
suguanYang Dec 1, 2026
5973642
Raise production indexing limit and observe parser stalls
suguanYang Dec 3, 2026
0634cc2
Preserve the PyMuPDF thread handoff result type
suguanYang Dec 3, 2026
b0d6cab
Merge pull request #603 from Ontos-AI/fix/wangbinqi/parse-runtime-dia…
suguanYang Dec 3, 2026
a860ce8
Screen page images only for slides and text-less PDFs
EricNGOntos Dec 4, 2026
2b8729a
Keep PDF CPU work off the worker event loop
suguanYang Dec 4, 2026
57711df
Potential fix for pull request finding 'CodeQL / An assert statement …
suguanYang Dec 4, 2026
361ea06
Merge pull request #605 from Ontos-AI/feat/wuchengke/2026-12-03
EricNGOntos Dec 4, 2026
78dd49a
Merge pull request #606 from Ontos-AI/fix/wangbinqi/pdf-main-loop-blo…
suguanYang Dec 4, 2026
e9b3e63
Give the coarse profile scanning evidence and probe images in one pass
EricNGOntos Dec 4, 2026
8b6e147
Time the blocked native wait, not the whole run, in the execution-tim…
EricNGOntos Dec 4, 2026
2554ce2
Merge pull request #607 from Ontos-AI/feat/wuchengke/2026-12-04
EricNGOntos Dec 4, 2026
c1ea114
Merge main into staging: page screen gating, scan evidence for the co…
EricNGOntos Dec 4, 2026
749da16
Give the execution-timeout test a budget a slow runner can reach the …
EricNGOntos Dec 4, 2026
7d1948d
Merge pull request #610 from Ontos-AI/fix/wuchengke/execution-timeout…
EricNGOntos Dec 4, 2026
08ea80c
Merge main into staging: execution-timeout test budget
EricNGOntos Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 37 additions & 9 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ env:
AWS_ECS_PROD_SECRETS_ARN: ${{ secrets.AWS_ECS_PROD_SECRETS_ARN }}
AWS_ECS_PROD_API_SERVICE_NAME: knowhere-api-prod
AWS_ECS_PROD_WORKER_SERVICE_NAME: knowhere-worker-prod
PROD_DB_SSL_MODE: ${{ vars.PROD_DB_SSL_MODE || 'disable' }}

jobs:
build-and-publish:
Expand Down Expand Up @@ -292,7 +293,7 @@ jobs:
-m alembic upgrade heads

migrate-ecs-production:
name: Run production Aurora database migration
name: Run production database migration
runs-on: ubuntu-latest
needs: build-and-publish
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
Expand Down Expand Up @@ -327,13 +328,14 @@ jobs:
aws ecr get-login-password --region "${AWS_ECS_PROD_REGION}" \
| docker login --username AWS --password-stdin "${ECR_REGISTRY}"

- name: Run migration against production Aurora
- name: Run migration against the production database
env:
DATABASE_URL: ${{ secrets.PRODUCTION_MIGRATION_DATABASE_URL }}
# The image build metadata uses the short release label `prod`, but
# AppConfig validates the runtime environment as `production`.
ENVIRONMENT: production
S3_BUCKET_NAME: knowhere-storage-prod
S3_BUCKET_NAME: ${{ fromJSON(vars.PROD_S3_STORAGE).bucket }}
S3_REGION: ${{ fromJSON(vars.PROD_S3_STORAGE).region }}
S3_TEMP_PATH: /tmp
TMP_PATH: /tmp/aismart_bid
shell: bash
Expand All @@ -343,9 +345,10 @@ jobs:
docker run --rm \
--env DATABASE_URL \
--env S3_BUCKET_NAME \
--env S3_REGION \
--env TMP_PATH \
--env S3_TEMP_PATH \
--env DB_SSL_MODE=disable \
--env "DB_SSL_MODE=${PROD_DB_SSL_MODE}" \
--env ENVIRONMENT \
--entrypoint python \
"${image_uri}" \
Expand Down Expand Up @@ -822,6 +825,28 @@ jobs:
resolve_image knowhere-backend api_image
resolve_image knowhere-worker worker_image

- name: Resolve production S3 storage
id: production_storage
env:
STORAGE_CONFIGURATION: ${{ vars.PROD_S3_STORAGE }}
shell: bash
run: |
set -euo pipefail
if [[ -z "$STORAGE_CONFIGURATION" ]]; then
echo "::error::PROD_S3_STORAGE is not configured."
exit 1
fi
bucket="$(jq -er '.bucket | select(test("^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$"))' <<< "$STORAGE_CONFIGURATION")"
region="$(jq -er '.region | select(test("^[a-z]{2}(-[a-z]+)+-[0-9]+$"))' <<< "$STORAGE_CONFIGURATION")"
topic="$(jq -er '.sns_topic_arn | select(test("^arn:aws:sns:[a-z0-9-]+:107424103509:[A-Za-z0-9_-]+$"))' <<< "$STORAGE_CONFIGURATION")"
if [[ "$topic" != "arn:aws:sns:$region:107424103509:"* ]]; then
echo "::error::Production S3 storage and upload notifications must use the same region."
exit 1
fi
echo "bucket=$bucket" >> "$GITHUB_OUTPUT"
echo "region=$region" >> "$GITHUB_OUTPUT"
echo "sns_topic_arn=$topic" >> "$GITHUB_OUTPUT"

- name: Read lexical backend from the database control row
id: lexical_backend
# Render the backend the database serves. A gated control row means an
Expand All @@ -830,7 +855,8 @@ jobs:
DATABASE_URL: ${{ secrets.PRODUCTION_MIGRATION_DATABASE_URL }}
API_IMAGE: ${{ steps.images.outputs.api_image }}
ENVIRONMENT: production
S3_BUCKET_NAME: knowhere-storage-prod
S3_BUCKET_NAME: ${{ steps.production_storage.outputs.bucket }}
S3_REGION: ${{ steps.production_storage.outputs.region }}
S3_TEMP_PATH: /tmp
TMP_PATH: /tmp/aismart_bid
shell: bash
Expand All @@ -843,8 +869,9 @@ jobs:
--env S3_BUCKET_NAME \
--env S3_TEMP_PATH \
--env TMP_PATH \
--env DB_SSL_MODE=disable \
--env "DB_SSL_MODE=${PROD_DB_SSL_MODE}" \
--env ENVIRONMENT \
--env S3_REGION \
--entrypoint python \
"${API_IMAGE}" \
-m shared.services.retrieval.lexical.deployment_backend)"
Expand All @@ -871,16 +898,17 @@ jobs:
DEPLOYMENT_ENVIRONMENT: prod
RUNTIME_ENVIRONMENT: production
APP_ENV: production
DB_SSL_MODE: disable
DB_SSL_MODE: ${{ env.PROD_DB_SSL_MODE }}
API_DB_POOL_SIZE: "50"
API_DB_MAX_OVERFLOW: "50"
WORKER_DB_SYNC_POOL_SIZE: "5"
WORKER_DB_SYNC_MAX_OVERFLOW: "5"
S3_BUCKET_NAME: knowhere-storage-prod
S3_BUCKET_NAME: ${{ steps.production_storage.outputs.bucket }}
S3_REGION: ${{ steps.production_storage.outputs.region }}
INTERNAL_DASHBOARD_ENDPOINT: https://knowhereto.ai
FRONTEND_URL: https://knowhereto.ai
API_WEBHOOK_ENDPOINT: https://api.knowhereto.ai/v1/internal/s3-events
SNS_TOPIC_ARN: arn:aws:sns:us-east-1:107424103509:knowhere-prod-s3-events
SNS_TOPIC_ARN: ${{ steps.production_storage.outputs.sns_topic_arn }}
QSTASH_CALLBACK_BASE_URL: https://api.knowhereto.ai/api/v1
QSTASH_BASE_URL: https://qstash-us-east-1.upstash.io
API_CPU: "512"
Expand Down
23 changes: 18 additions & 5 deletions apps/api/tests/contract/test_indexing_execution_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,40 @@ def test_execution_timeout_stops_native_wait_and_returns_without_replay(

engine, jobId = parsedRuntime
calls: list[str] = []
executionBudget: float = float(os.environ.get("KNOWHERE_TEST_SHORT_INDEXING_TIMEOUT_SECONDS", "0.08"))
# The budget also covers the database work before the native wait starts. It must be long enough
# for a slow runner to reach the wait, and far shorter than the wait itself.
executionBudget: float = float(os.environ.get("KNOWHERE_TEST_SHORT_INDEXING_TIMEOUT_SECONDS", "1"))
from shared.services.retrieval.lexical.runtime import OpenSearchRuntime
from types import SimpleNamespace
# The RPC is fake; omit unrelated cold TLS/client initialization so this
# check measures cancellation of the blocked native wait itself.
monkeypatch.setattr(OpenSearchRuntime, "resolve", lambda endpoint: SimpleNamespace(client=None, release=lambda: None))

nativeWaitSeconds: float = executionBudget * 20
waitedSeconds: list[float] = []

def blockedNative(self: OpenSearchLexicalIndex, *, isExact: bool,
timeoutSeconds: float) -> NativeLifecycleSnapshot:
calls.append("native")
gevent.sleep(executionBudget * 20)
waitStartedAt: float = time.monotonic()
try:
gevent.sleep(nativeWaitSeconds)
finally:
waitedSeconds.append(time.monotonic() - waitStartedAt)
raise LexicalIndexError("Native wait reached its deliberately long end")

monkeypatch.setattr(settings, "KNOWHERE_INDEXING_TIMEOUT_SECONDS", executionBudget)
monkeypatch.setattr(OpenSearchLexicalIndex, "getLifecycleSnapshot", blockedNative)
startedAt: float = time.monotonic()
# The failure transition's audit metadata goes through make_json_safe, which imports numpy and
# pandas on first use. Load them here so a cold import does not spend the settlement deadline.
from shared.utils.json_utils import make_json_safe
make_json_safe({})
worker: IndexingWorker = IndexingWorker(sessionFactory=sessionmaker(engine, expire_on_commit=False))
assert worker.run(jobId) == "failed"
assert time.monotonic() - startedAt < executionBudget + 0.32 + (
settings.KNOWHERE_INDEXING_SETTLEMENT_TIMEOUT_SECONDS if executionBudget > 0.08 else 0)
assert calls == ["native"]
# Time the blocked native wait itself: the deadline must end it before its own end. The
# settlement that follows has its own deadline, and missing it would return "pending" above.
assert len(waitedSeconds) == 1 and waitedSeconds[0] < nativeWaitSeconds
with Session(engine) as session:
attempt: IndexingAttempt = session.scalars(select(IndexingAttempt)).one()
job: Job = session.scalars(select(Job)).one()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ def resolutionRuntime(monkeypatch: pytest.MonkeyPatch, postgresql_proc: PostgreS
clear_application_modules()
asyncio.run(prepare_contract_storage())
from shared.core.celery_app import celery_app
for taskName in ("maintainLexical", "cleanBuild", "cleanArchivedDocument", "cleanFailedAttempt",
"collectOrphanInputs", "resolveIndex"):
for taskName in ("maintainLexical", "cleanBuild", "cleanArchivedDocument", "cleanFailedAttempt", "resolveIndex"):
celery_app.tasks.pop(f"shared.services.retrieval.lexical.maintenance.{taskName}", None)
from shared.services.retrieval.lexical import resolution
from shared.services.retrieval.lexical.maintenance_signals import LexicalMaintenanceSignals
Expand Down
Loading
Loading