Skip to content
Closed
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
aacef77
fix(embeddings): route remote agents to provider
seonghobae Aug 26, 2026
e8d2a34
Merge remote-tracking branch 'origin/main' into fix/provider-backed-e…
seonghobae Aug 26, 2026
9846392
Merge remote-tracking branch 'origin/fix/configurable-body-limit' int…
seonghobae Aug 26, 2026
cffb1de
Merge remote-tracking branch 'origin/main' into HEAD
seonghobae Aug 26, 2026
03e95eb
Merge remote-tracking branch 'origin/pr-857-new' into HEAD
seonghobae Aug 26, 2026
d9a56f9
docs: refresh protected delivery gap baseline
seonghobae Aug 26, 2026
9897c18
docs: record structured orchestration full suite
seonghobae Aug 26, 2026
3f5c430
fix(embeddings): preserve batch and metered client methods
seonghobae Aug 26, 2026
5b08cb6
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
a8b3727
fix(api): preserve orchestrator-owned chat model selection
seonghobae Aug 26, 2026
052fdd8
fix(api): accept orchestrator reasoning effort controls
seonghobae Aug 26, 2026
10ece63
fix(embeddings): bind failover to selected provider
seonghobae Aug 26, 2026
b2dd31a
docs: refresh exact-head product gap baseline
seonghobae Aug 26, 2026
d834427
fix(routing): fail over malformed provider responses
seonghobae Aug 26, 2026
9f476e3
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
5ba250e
test: install runtime dependencies for local suite
seonghobae Aug 26, 2026
d28674f
Merge commit 'refs/pull/857/head' of https://github.com/ContextualWis…
seonghobae Aug 26, 2026
3349edf
fix(api): require explicit chat model selection
seonghobae Aug 26, 2026
1b758a4
feat: preserve provenance in bulk embeddings
seonghobae Aug 26, 2026
ae1b8c0
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
7983095
fix(embeddings): reject empty provider inputs
seonghobae Aug 26, 2026
1ecb56b
fix: fail over exhausted provider transports
seonghobae Aug 26, 2026
d9c62be
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
4ca92f4
docs: record exact-head routing verification
seonghobae Aug 26, 2026
ee5272f
fix(embeddings): bind backend to selected provider
seonghobae Aug 26, 2026
ffe036e
feat(embeddings): advertise enforced bulk limits
seonghobae Aug 26, 2026
39a5a6b
fix: bound provider failover by request deadline
seonghobae Aug 26, 2026
0d1ed60
feat(embeddings): advertise enforced bulk limits
seonghobae Aug 26, 2026
a4e71d3
docs: specify request deadline contract
seonghobae Aug 26, 2026
c19bea0
Merge pull request #859 from ContextualWisdomLab/fix/structured-reque…
seonghobae Aug 26, 2026
eacae99
feat(embeddings): execute provider batches asynchronously
seonghobae Aug 26, 2026
0cfe55c
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
57503eb
fix(provider): preserve timeout hook compatibility
seonghobae Aug 26, 2026
503e9b8
fix: propagate deadline through structured transport
seonghobae Aug 26, 2026
44b036e
Merge pull request #860 from ContextualWisdomLab/fix/structured-trans…
seonghobae Aug 26, 2026
b62e6b7
fix(embeddings): publish bounded polling cadence
seonghobae Aug 26, 2026
b6cf8d5
Merge commit '503e9b8631ca6efef3a53743fdb3c785dad4402c' into feat/emb…
seonghobae Aug 26, 2026
2f3feb9
fix(embeddings): publish durable result retention
seonghobae Aug 26, 2026
f0033d9
fix: address provider deadline review findings
seonghobae Aug 26, 2026
79e504f
fix: retain default streaming timeout
seonghobae Aug 26, 2026
4fc7e41
perf(embeddings): send provider bulk in one call
seonghobae Aug 26, 2026
f18fd20
fix: preserve provider timeout hook compatibility
seonghobae Aug 26, 2026
0e19ffd
fix: apply deadlines to embedding and stream transport
seonghobae Aug 26, 2026
2b11707
fix(embeddings): honor provider batch limits
seonghobae Aug 26, 2026
d078ce6
feat(embeddings): enforce OpenAI published batch limits
seonghobae Aug 26, 2026
1cda2e4
fix: preserve streaming timeout hook compatibility
seonghobae Aug 26, 2026
49a5738
fix(embeddings): pack OpenAI batches with Rust tokenizer
seonghobae Aug 26, 2026
2c1a1fb
chore(rust): exclude tokenizer build output
seonghobae Aug 26, 2026
3df12e7
fix: propagate deadlines across provider routes
seonghobae Aug 26, 2026
1fc4d3d
feat(embeddings): resume provider shards durably
seonghobae Aug 26, 2026
9fa56fd
fix: preserve request deadlines through routing
seonghobae Aug 26, 2026
d28f286
fix: classify streamed response deadlines
seonghobae Aug 26, 2026
dadf843
fix(embeddings): move exact packing into PyO3 Rust
seonghobae Aug 26, 2026
6334737
test(embeddings): prove exact Rust packing boundaries
seonghobae Aug 26, 2026
2081476
docs: refresh exact-head product gap evidence
seonghobae Aug 26, 2026
04663e3
Merge branch 'fix/provider-backed-embedding-batch' of https://github.…
seonghobae Aug 26, 2026
5ef299d
fix(embeddings): harden durable provider lifecycle
seonghobae Aug 26, 2026
f9f225b
fix: harden embedding batch completion
seonghobae Aug 26, 2026
a31e622
feat(embeddings): preserve post session across durable shards
seonghobae Aug 26, 2026
fdcabb6
Merge commit 'refs/pull/861/head' of https://github.com/ContextualWis…
seonghobae Aug 26, 2026
ca1c7f0
fix: preserve stacked embedding deadline contracts
seonghobae Aug 26, 2026
02a20b2
docs: refresh embedding batch queue evidence
seonghobae Aug 26, 2026
08e34c9
build: pin Rust extension toolchain image
seonghobae Aug 26, 2026
16d685a
docs: align queue evidence with implementation
seonghobae Aug 26, 2026
5c283cb
build: preserve locked Rust workspace
seonghobae Aug 26, 2026
74091e1
fix(embeddings): retain per-input post sessions
seonghobae Aug 26, 2026
e1450d8
docs: refresh implementation parent evidence
seonghobae Aug 26, 2026
c8284ad
build: package Rust extension under gateway module
seonghobae Aug 26, 2026
61457fe
docs: update built-extension evidence parent
seonghobae Aug 26, 2026
3adbced
Merge commit 'refs/pull/861/head' of https://github.com/ContextualWis…
seonghobae Aug 26, 2026
e8bff69
docs: align evidence after session merge
seonghobae Aug 26, 2026
7b4891a
fix(discovery): activate embedding-capable agents
seonghobae Aug 26, 2026
548b6db
refactor(embeddings): move arithmetic into Rust core
seonghobae Aug 26, 2026
837147d
fix: preserve embedding batch review contracts
seonghobae Aug 26, 2026
6b27ef2
Merge remote-tracking branch 'origin/feat/embedding-batch-capability'…
seonghobae Aug 26, 2026
1f59bc8
test: keep embedding arithmetic contracts in Rust
seonghobae Aug 26, 2026
1437f90
docs: refresh stacked embedding evidence
seonghobae Aug 26, 2026
fba091d
docs: refresh latest dependency evidence
seonghobae Aug 26, 2026
a459ba3
fix: make embedding terminal state transitions atomic
seonghobae Aug 26, 2026
45deb43
docs: bind baseline to terminal-state fixes
seonghobae Aug 26, 2026
d644e8d
fix(embeddings): reject invented reduction inputs
seonghobae Aug 26, 2026
b0d1395
Merge pull request #861 from ContextualWisdomLab/feat/embedding-batch…
seonghobae Aug 26, 2026
7803fa5
Merge remote-tracking branch 'origin/feat/embedding-batch-capability'…
seonghobae Aug 26, 2026
c6a86bd
fix(embeddings): harden durable provider lifecycle
seonghobae Aug 26, 2026
06f27dd
docs: define native accelerator runtime boundaries (#864)
seonghobae Aug 26, 2026
d7329b4
fix(embeddings): preserve clientless server tests
seonghobae Aug 26, 2026
8679341
fix(embeddings): serialize durable job recovery
seonghobae Aug 26, 2026
0ac9a21
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
f8b4537
fix(embeddings): fail closed on unavailable discovery
seonghobae Aug 26, 2026
2c27a59
fix(embeddings): preserve aggregate cost provenance
seonghobae Aug 26, 2026
b92ede3
test(embeddings): require declared capability
seonghobae Aug 26, 2026
1cf837d
fix: close embedding batch review races
seonghobae Aug 26, 2026
08aba86
test(embeddings): declare readiness capability
seonghobae Aug 26, 2026
6abcf55
fix: keep embedding poll metadata out of cache
seonghobae Aug 26, 2026
4212b25
fix(batch): bound registry claim locks
seonghobae Aug 26, 2026
ce5b5f9
fix: fail over structured judge providers
seonghobae Aug 26, 2026
d0e2ba9
fix: close embedding batch review gaps
seonghobae Aug 26, 2026
40515fc
test: bootstrap pinned Rust extension
seonghobae Aug 26, 2026
b0250fc
Merge commit '4212b25db9948c14f366124d92687383b3a0c712' into codex/pr…
seonghobae Aug 26, 2026
2a1810f
Merge remote-tracking branch 'origin/main' into codex/embedding-auto-…
seonghobae Aug 26, 2026
bbf3a70
fix: gate structured failover on readiness
seonghobae Aug 26, 2026
09ce71b
Merge commit '2a1810f46bd0f2a648d2236266e2e5d54a6738bb' into codex/pr…
seonghobae Aug 26, 2026
a660601
fix(embeddings): preserve UTF-8 token boundaries (#865)
seonghobae Aug 26, 2026
98c6337
merge: combine embedding discovery and structured readiness
seonghobae Aug 26, 2026
2576007
merge: refresh pull request base
seonghobae Aug 26, 2026
75c94d2
fix(batch): preserve in-flight claim ownership
seonghobae Aug 26, 2026
134c24f
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
46e46ff
Merge remote-tracking branch 'origin/fix/provider-backed-embedding-ba…
seonghobae Aug 26, 2026
19f870d
Merge pull request #862 from ContextualWisdomLab/fix/embedding-batch-…
seonghobae Aug 26, 2026
da8ecfe
Merge commit '19f870d46bcbc7ac81c4288d0ff3f7f847712fad' into codex/pr…
seonghobae Aug 26, 2026
4dcf952
test: build Rust extension before local suite
seonghobae Aug 26, 2026
34d04ed
Merge commit '4dcf952a38b0b303137813aea5a59aea727b6434' into codex/pr…
seonghobae Aug 26, 2026
ef0213a
refactor: make Rust numeric authority fail closed
seonghobae Aug 26, 2026
edc223c
fix: close embedding batch correctness gaps
seonghobae Aug 26, 2026
0472c02
fix: isolate structured probes and async deadlines
seonghobae Aug 26, 2026
dc5ed7a
fix: avoid empty provider usage records
seonghobae Aug 26, 2026
b49d6ff
fix: scope structured provider failures to request (#867)
seonghobae Aug 26, 2026
22f620d
fix: scope embedding batch dedup to deployment
seonghobae Aug 26, 2026
9ecf696
fix: preserve durable readiness evidence (#875)
seonghobae Aug 26, 2026
77fd436
fix: fail over structured passthrough by readiness (#878)
seonghobae Aug 26, 2026
1b3c979
Merge remote-tracking branch 'origin/main' into HEAD
seonghobae Aug 26, 2026
fcad50a
fix(build): keep native token packer out of source
seonghobae Aug 26, 2026
d3fd9a6
fix(runtime): bound provider claim leases
seonghobae Aug 26, 2026
8cf4197
fix: orchestrate virtual JSON schema responses (#882)
seonghobae Aug 26, 2026
328a3f6
fix: close owned embedding workers
seonghobae Aug 26, 2026
11f831c
fix: renew durable readiness claims
seonghobae Aug 26, 2026
1cee22b
fix: bound readiness renewal lease
seonghobae Aug 26, 2026
eb0a871
Merge pull request #884 from seonghobae/fix/readiness-durable-claim-r…
seonghobae Aug 26, 2026
d68d117
fix: share durable claim token across renewal thread
seonghobae Aug 26, 2026
bc4f115
fix: harden readiness claim renewal
seonghobae Aug 26, 2026
4da9381
Merge remote-tracking branch 'origin/main' into fix/pr884-review-find…
seonghobae Aug 26, 2026
2916bba
fix: clear provider batch security review gates
seonghobae Aug 26, 2026
12d6847
fix: complete property fuzz dependency lock
seonghobae Aug 26, 2026
f61b58e
fix: make native full-suite runner self-consistent
seonghobae Aug 26, 2026
ca60f55
fix(ci): install native token packer in fuzz jobs
seonghobae Aug 26, 2026
cc1ec2c
fix: renew durable embedding execution claims
seonghobae Aug 26, 2026
0aec4a5
fix: verify native wheel and record queued batch health
seonghobae Aug 26, 2026
f1d0fbb
Merge origin/main into provider-backed embedding batch
seonghobae Aug 28, 2026
b2aedb7
fix(ci): compile Python 3.12 fuzz lock completely
seonghobae Aug 28, 2026
cf8df35
feat: combine authenticated discovery with native routing
seonghobae Aug 28, 2026
660810a
fix(server): reject blank embeddings models
seonghobae Aug 28, 2026
cb4d5bc
fix: preserve endpoint identity across request routing
seonghobae Aug 28, 2026
b98a69b
fix(orchestration): preserve bounded provider failover
seonghobae Aug 28, 2026
eee5323
fix(routing): keep endpoint requests synchronous
seonghobae Aug 28, 2026
17f8921
fix(discovery): expand configured gateway catalog
seonghobae Aug 28, 2026
acf93d5
fix(discovery): retain unmatched gateway seed
seonghobae Aug 28, 2026
687f1d1
fix(discovery): normalize gateway seed identity
seonghobae Aug 28, 2026
014ef80
fix(catalog): align privacy model identity
seonghobae Aug 28, 2026
b139790
fix(security): make CLI provider hosts authoritative
seonghobae Aug 28, 2026
895abc6
fix(discovery): retain unmatched gateway seed
seonghobae Aug 28, 2026
4dbf04c
style(tests): separate discovery regressions
seonghobae Aug 28, 2026
ad61870
Merge pull request #902 from ContextualWisdomLab/fix/gateway-catalog-…
seonghobae Aug 28, 2026
f886098
fix: expose actionable admission retry cadence
seonghobae Aug 28, 2026
60c567c
docs: keep one changelog change section
seonghobae Aug 28, 2026
41d7110
test: tolerate elapsed rate-limit window
seonghobae Aug 28, 2026
8048195
Merge pull request #907 from ContextualWisdomLab/fix/actionable-rate-…
seonghobae Aug 28, 2026
2712827
fix: bind structured synthesis to readiness contract
seonghobae Aug 28, 2026
3558a9a
fix: retain partial readiness results
seonghobae Aug 28, 2026
00d5664
fix(batch): bind jobs to authenticated principals
seonghobae Aug 28, 2026
7b2c402
fix(readiness): probe both structured output transports
seonghobae Aug 28, 2026
677340f
test(readiness): accept both native structured formats
seonghobae Aug 28, 2026
d1afcd3
test(privacy): skip unsupported optional mcp api
seonghobae Aug 28, 2026
17a7b13
fix(routing): return typed provider exhaustion
seonghobae Aug 28, 2026
49a2d5c
Merge remote-tracking branch 'origin/main' into repair/provider-exhau…
seonghobae Aug 28, 2026
52d8bf6
fix(routing): reconcile current main contracts
seonghobae Aug 28, 2026
cb8d4da
fix(ci): run full suite with native token packer
seonghobae Aug 28, 2026
017c1ff
fix(ci): keep native full suite on builder image
seonghobae Aug 28, 2026
729c793
fix(ci): include trust store in test runner
seonghobae Aug 28, 2026
31059a6
docs: describe pinned native test runner
seonghobae Aug 28, 2026
13432f3
fix(ci): point Python TLS at Debian CA bundle
seonghobae Aug 28, 2026
80ddc56
chore: run one-shot conflict resolver for PR #857
seonghobae Aug 29, 2026
0a83223
chore: rerun hardened conflict inventory for PR #857
seonghobae Aug 29, 2026
9b9f9e4
fix(cost-router): tolerate readiness-job documents disappearing under…
claude Aug 30, 2026
409e4b9
docs(gap-baseline): record this cycle's #868/#857/#906 findings and f…
claude Aug 30, 2026
63a6e65
chore: remove exhausted one-shot PR #857 conflict-resolver caller
seonghobae Aug 30, 2026
0e04a04
fix: preserve structured exhaustion on provider embedding stack (#969)
seonghobae Aug 31, 2026
77a4967
Merge origin/main and preserve provider-backed embeddings
seonghobae Aug 31, 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
6 changes: 6 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
# fuzz/requirements-property.in (recompile with uv pip compile --generate-hashes).
run: python -m pip install --require-hashes -r fuzz/requirements-property.txt

- name: Install Rust token packer
run: ./scripts/install_native_token_packer.sh

- name: Run property-based fuzz tests
run: python -m pytest tests/fuzz -q

Expand All @@ -64,6 +67,9 @@ jobs:
# fuzz/requirements-atheris.in (recompile with uv pip compile --generate-hashes).
run: python -m pip install --require-hashes -r fuzz/requirements-atheris.txt

- name: Install Rust token packer
run: ./scripts/install_native_token_packer.sh

- name: Set per-target time budget
run: |
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "push" ]; then
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,5 @@ jobs:
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # actions/setup-python@v6
with:
python-version: "3.12"

- name: Install test dependencies
# Hash-pinned per OpenSSF Scorecard Pinned-Dependencies. Install both
# runtime integrations and the property-test tools exercised below.
run: |
python -m pip install --require-hashes -r requirements.lock
python -m pip install --require-hashes -r fuzz/requirements-property.txt

- name: Run full test suite
run: python -m pytest -q
- name: Run hash-locked full test suite
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__/
dist/
build/
*.egg-info/
contextual_orchestrator/_token_packer*.so
tempcred.txt


Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.d/token-packer-utf8-boundary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Preserve complete UTF-8 scalar values when the Rust embedding token packer
divides an input at a provider token ceiling, and fail closed when the
configured ceiling cannot contain one decodable scalar.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

### Added

- ADR 0006 defines evidence-gated CPU, MLX, CUDA/OpenCL, Compose, and
Kubernetes accelerator runtime boundaries.
- Bounded first-valid-completion racing for operator-declared equivalent model
group endpoints across text and media capabilities, with fail-closed contract
comparison and winner/cancellation provenance.
Expand Down Expand Up @@ -61,6 +63,8 @@ and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

### Fixed

- Route embedding batches through configured remote embedding agents instead
of returning the standalone deterministic vector.
- Mixed structured workflows now retain a cost-ledger row for calls whose
provider omitted usage, using the existing token-counting fallback while
preserving reported counts for the other calls in the same workflow.
Expand Down
41 changes: 40 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,32 @@
# see docs/kv-credentials.md for the bootstrap flow.
# Agents: defaults to the bundled mock pool; mount your own and set AGENTS_FILE:
# -v ./agents.json:/app/agents.json -e AGENTS_FILE=/app/agents.json
# Rust and maturin are build-only and pinned by an immutable multi-architecture
# image digest; the runtime remains the pinned slim Python image.
ARG MATURIN_BUILDER_IMAGE=ghcr.io/pyo3/maturin@sha256:b6c8b59a0170b77eb31a35b56034abd39972483ad0ebfff344deaa42a85f3bd3
FROM ${MATURIN_BUILDER_IMAGE} AS token-builder
COPY rust/Cargo.toml rust/Cargo.lock /build/rust/
COPY rust/token_counter/ /build/rust/token_counter/
COPY contextual_orchestrator/ /build/contextual_orchestrator/
WORKDIR /build/rust/token_counter
RUN maturin build --locked --release --out /build/wheels

# Export only the native wheel for host-based fuzz jobs. BuildKit writes this
# scratch stage to a temporary directory without a bind mount into the builder.
FROM scratch AS token-wheel
COPY --from=token-builder /build/wheels /

# python:3.12-slim
FROM python:3.12-slim@sha256:423ed6ab25b1921a477529254bfeeabf5855151dc2c3141699a1bfc852199fbf
FROM python:3.12-slim@sha256:423ed6ab25b1921a477529254bfeeabf5855151dc2c3141699a1bfc852199fbf AS runtime-base
WORKDIR /app

WORKDIR /app
COPY pyproject.toml requirements.lock README.md LICENSE ./
RUN pip install --no-cache-dir --require-hashes -r requirements.lock
COPY contextual_orchestrator/ /usr/local/lib/python3.12/site-packages/contextual_orchestrator/
COPY examples/ examples/
COPY --from=token-builder /build/wheels /tmp/token-wheels
RUN pip install --no-cache-dir /tmp/token-wheels/*.whl && rm -rf /tmp/token-wheels

ENV AGENTS_FILE=/app/examples/agents.mock.json \
PORT=8000
Expand All @@ -31,3 +49,24 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \

# --allow-public-bind: 컨테이너 내부 0.0.0.0 바인딩 필요(외부 노출은 호스트 포트 매핑이 결정)
CMD ["sh", "-c", "python -m contextual_orchestrator --serve --agents \"$AGENTS_FILE\" --host 0.0.0.0 --port \"$PORT\" --allow-public-bind --auth-token-key CONTEXTUAL_ORCHESTRATOR_TOKEN"]

# Local and CI tests share this target. The wheel remains a BuildKit artifact:
# it is installed only into uv's ephemeral, hash-locked Python 3.12 environment.
FROM runtime-base AS test-runner
USER root
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
COPY --from=token-builder /usr/local/bin/uv /usr/local/bin/uv
COPY --from=token-builder /build/wheels /tmp/token-wheels
COPY . /io
WORKDIR /io
RUN set -eu; \
set -- /tmp/token-wheels/*.whl; \
test "$#" -eq 1 && test -f "$1" || { \
echo "pinned Rust token-packer build must produce exactly one wheel" >&2; exit 1; \
}; \
uv run --python /usr/local/bin/python --no-project \
--with-requirements requirements.lock \
--with-requirements fuzz/requirements-property.txt \
--with "$1" python -m pytest -q
Comment thread
seonghobae marked this conversation as resolved.
Resolved
USER orchestrator

FROM runtime-base AS runtime
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: test

test:
uv run --no-project --with-requirements requirements.lock --with-requirements fuzz/requirements-property.txt python -m pytest -q
./scripts/run_hash_locked_tests.sh
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ docker compose up --build --wait
curl http://127.0.0.1:8000/healthz
```

The project defaults to `contextual-orchestrator` and has no fixed
`container_name` values. Run isolated stacks in parallel with distinct project
names and host ports:

```bash
CONTEXTUAL_ORCHESTRATOR_COMPOSE_PROJECT_NAME=contextual-orchestrator-dev2 \
CONTEXTUAL_ORCHESTRATOR_PORT=8001 docker compose up --build --wait
```

Accelerator runtimes stay separate: CPU PyO3 arithmetic is in-process, macOS
MLX is an authenticated native-host provider, and CUDA/OpenCL workers require
measured vendor evidence before overlays or Kubernetes manifests are added.
See [ADR 0006](docs/adr/0006-native-accelerator-runtime-boundaries.md).

Register provider keys separately with `register-credential`; do not put them
in `compose.yaml` or the gateway runtime environment.

Expand Down Expand Up @@ -331,7 +345,8 @@ Grounding papers (LLM cost, routing, load balancing) live in

## Check

Run the full suite with the same hash-locked pytest toolchain as CI:
Run the full suite with the same hash-locked pytest toolchain as CI. The target
builds and installs the Rust token/vector extension before pytest:

```bash
make test
Expand Down
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: contextual-orchestrator
name: ${CONTEXTUAL_ORCHESTRATOR_COMPOSE_PROJECT_NAME:-contextual-orchestrator}

services:
postgres:
Expand Down
12 changes: 11 additions & 1 deletion contextual_orchestrator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"""Public package exports for the contextual orchestration runtime."""

from pkgutil import extend_path

# The ABI3 Rust extension is installed by a wheel while local development and
# CI import Python sources from the checkout. Extend the regular package path so
# the source package can find the wheel-owned native submodule.
__path__ = extend_path(__path__, __name__)

from .batch_routing import (
BatchJob,
BatchRequest,
Expand All @@ -10,6 +17,7 @@
LocalEmbeddingBatchBackend,
PgLlmBatchBackend,
PgLlmBatchEmbeddingBackend,
ProviderEmbeddingBatchBackend,
RoutingDecision,
RoutingHints,
RoutingPolicy,
Expand Down Expand Up @@ -46,7 +54,7 @@
parse_reasoning_effort_profile,
snapshot_role_effort_catalog,
)
from .token_counting import HeuristicTokenCounter, build_token_counter
from .token_counting import HeuristicTokenCounter, RustCl100kTokenCounter, build_token_counter
from .response_cache import (
RedisResponseCacheProvider,
ResponseCacheProvider,
Expand Down Expand Up @@ -103,6 +111,7 @@
"InMemoryConfigStore",
"get_config_store",
"HeuristicTokenCounter",
"RustCl100kTokenCounter",
"build_token_counter",
"ResponseCacheProvider",
"RedisResponseCacheProvider",
Expand All @@ -121,6 +130,7 @@
"EmbeddingBatchResultItem",
"LocalEmbeddingBatchBackend",
"PgLlmBatchEmbeddingBackend",
"ProviderEmbeddingBatchBackend",
"heuristic_embedding",
"build_embeddings_jsonl_body",
"cheapest_upstream",
Expand Down
12 changes: 8 additions & 4 deletions contextual_orchestrator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,17 @@ def _discover_models_command(argv: list[str]) -> None:


def _auto_discover_runtime_agents(orchestrator: TaskOrchestrator) -> dict[str, list[str]]:
"""Discover and activate only models with explicit chat capability evidence."""
"""Activate models carrying explicit provider-declared runtime capabilities."""
discovered, _errors = discover_all_models()
chat_models = [model for model in discovered if "chat" in model.capabilities]
capable_models = [
model
for model in discovered
if {"chat", "embedding"}.intersection(model.capabilities)
]
existing_ids = {agent.id for agent in orchestrator.candidates}
agents = [
replace(agent_from_discovered(model), disabled=False)
for model in chat_models
for model in capable_models
if agent_id_for(model) not in existing_ids
]
if not agents:
Expand Down Expand Up @@ -374,7 +378,7 @@ def main(argv: list[str] | None = None) -> None:
parser.add_argument(
"--auto-discover-model-agents",
action="store_true",
help="discover source-declared chat-capable models at startup and activate them",
help="discover source-declared chat- and embedding-capable models at startup and activate them",
)
args = parser.parse_args(arguments)

Expand Down
83 changes: 78 additions & 5 deletions contextual_orchestrator/api_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,54 @@
"/api/v1/provider_readiness/latest": {
"get": {
"operationId": "get_latest_provider_readiness",
"summary": "Read or explicitly refresh bounded provider chat readiness",
"summary": "Read cached provider chat readiness without starting probes",
"security": [{"admin_bearer_auth": []}],
"parameters": [{
"name": "refresh",
"in": "query",
"required": False,
"schema": {"type": "boolean", "default": False},
}],
"responses": {"200": {"description": "Provider readiness report"}},
"responses": {
"200": {"description": "Provider readiness report"},
"409": {"description": "Inline refresh must use an asynchronous job"},
},
}
},
"/api/v1/provider_readiness_refreshes": {
"post": {
"operationId": "create_provider_readiness_refresh",
"summary": "Probe an explicit provider access list asynchronously",
"security": [{"admin_bearer_auth": []}],
"responses": {"202": {"description": "Readiness refresh accepted"}},
}
},
"/api/v1/provider_readiness_refreshes/{job_id}": {
"get": {
"operationId": "get_provider_readiness_refresh",
"summary": "Poll readiness refresh progress",
"security": [{"admin_bearer_auth": []}],
"parameters": [{
"name": "job_id",
"in": "path",
"required": True,
"schema": {"type": "string"},
}],
"responses": {"200": {"description": "Readiness refresh progress"}},
}
},
"/api/v1/provider_readiness_refreshes/{job_id}/cancel": {
"post": {
"operationId": "cancel_provider_readiness_refresh",
"summary": "Cancel readiness refresh work",
"security": [{"admin_bearer_auth": []}],
"parameters": [{
"name": "job_id",
"in": "path",
"required": True,
"schema": {"type": "string"},
}],
"responses": {"200": {"description": "Readiness refresh cancelled"}},
}
},
"/api/v1/analytics_snapshots/latest": {
Expand Down Expand Up @@ -746,6 +785,16 @@
]
},
"inputs": {"type": "array", "items": {"type": "string"}},
"input_attributions": {
"type": "array",
"items": {"type": "object"},
"description": "Index-aligned cost attribution for each input.",
},
"input_metadata": {
"type": "array",
"items": {"type": "object"},
"description": "Index-aligned provenance metadata returned with each output.",
},
"endpoint": {"type": "string", "description": "batch endpoint alias"},
"metadata": {
"type": "object",
Expand All @@ -766,7 +815,13 @@
"input_part_counts, map_reduce}"
)
},
"202": {"description": "Batch accepted; poll GET /v1/batch/embeddings/{batch_id}"},
"202": {
"description": (
"Batch accepted; poll GET /v1/batch/embeddings/{batch_id} "
"after the returned poll_after_ms; terminal results remain "
"available for job_retention_ms"
)
},
"503": {"description": "No enabled embedding-capable agent is available"},
},
}
Expand All @@ -782,14 +837,32 @@
"responses": {
"200": {
"description": (
"{batch_id, status, embeddings:[[...]], cost_micro_usd, "
"token_counts, input_part_counts, map_reduce}"
"{batch_id, status, poll_after_ms, job_retention_ms, embeddings:[[...]], "
"cost_micro_usd, token_counts, input_part_counts, map_reduce}"
)
},
"404": {"description": "Embeddings batch not found"},
},
}
},
"/v1/batch/embeddings/capabilities": {
"get": {
"operationId": "get_batch_embeddings_capabilities",
"summary": "Read enforced bulk request and provider partition ceilings",
"security": [{"inference_bearer_auth": []}],
"responses": {
"200": {
"description": (
"Enforced max_request_body_bytes, max_tokens_per_part, "
"max_chars_per_part, rate-budget-derived poll_after_ms, "
"configured job_retention_ms, and resolved provider model, "
"max_inputs, max_total_tokens, tokenizer, and "
"capability_authority_url when available"
)
}
},
}
},
"/api/v1/access_reports/{workflow_run_id}": {
"get": {
"operationId": "get_access_report",
Expand Down
Loading
Loading