From 98642ae6712a5017e187cae7952a2b3c819c1ece Mon Sep 17 00:00:00 2001 From: anycodes <21079031+anycodes@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:14:12 +0000 Subject: [PATCH 1/3] test: define shared application authentication vectors --- .agents/README.md | 2 + .../2026-10-26-application-auth-vectors.md | 31 +++++++++++ .../2026-10-26-application-auth-vectors.md | 39 ++++++++++++++ CHANGELOG.md | 5 ++ .../test_api/test_application_auth_vectors.py | 22 ++++++++ .../testing/application-auth-vectors.json | 52 +++++++++++++++++++ docs/en/reference/configuration.md | 3 ++ docs/zh/reference/configuration.md | 3 ++ 8 files changed, 157 insertions(+) create mode 100644 .agents/evidence/verify/2026-10-26-application-auth-vectors.md create mode 100644 .agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md create mode 100644 client-sdk/tests/test_api/test_application_auth_vectors.py create mode 100644 contracts/testing/application-auth-vectors.json diff --git a/.agents/README.md b/.agents/README.md index 85480878..642af9e0 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -242,3 +242,5 @@ Builtin transport: [direct HTTP](notes/implemented/architecture/2026-10-18-nativ - [Provider parameter documentation correction](notes/implemented/process/2026-10-25-provider-parameter-docstrings.md) · [candidate verification](evidence/verify/2026-10-25-provider-parameter-docstrings.md) · [published follow-up](evidence/verify/2026-10-25-public-a4-delivery.md). - [Current public a4 guidance and bounded metadata propagation](notes/implemented/process/2026-10-25-current-public-a4.md) · [verification](evidence/verify/2026-10-25-public-a4-delivery.md). + +- [Shared application authentication vectors](notes/proposed/feature/2026-10-26-application-auth-vectors.md) · [verification](evidence/verify/2026-10-26-application-auth-vectors.md). diff --git a/.agents/evidence/verify/2026-10-26-application-auth-vectors.md b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md new file mode 100644 index 00000000..110c87d0 --- /dev/null +++ b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md @@ -0,0 +1,31 @@ +# Verification: shared application authentication vectors + +- Date: 2026-10-26 +- Result: PARTIAL +- Change: additive contracts/testing/application-auth-vectors.json and its Python consumer test. +- Environment: Python 3.13, isolated virtual environment; client/server 0.4.0a6 installed from this source. Fixture checks use placeholder credentials only; separate cloud evidence used ignored credentials without recording values. + +## What was verified + +The fixture covers anonymous access, explicit application authentication and preservation of case-insensitive gateway headers. Runtime SDK code and configuration behavior are unchanged. + +## Commands run + +- `python -m pytest -q client-sdk/tests/test_api/test_application_auth_vectors.py client-sdk/tests/test_api/test_application_binding.py` — PASS, 52 tests. +- `ruff format client-sdk/tests/test_api/test_application_auth_vectors.py` — PASS. +- `ruff check client-sdk/tests/test_api/test_application_auth_vectors.py` — PASS. +- `make test` with locally adjacent, independently moving CLI/provider checkouts — server PASS (875 passed, 1 skipped); client 2359 passed, 3 skipped, 5 pre-existing provider integration failures. Those optional sibling tests do not use the required engine CI pins. +- Required provider-engine CI scenario with CLI 94a1f90244e7b36e06c4618feaa323c4d056e784 and providers 857a66b3884faeaade01411ec9561987a7aee705 — PASS, 4 tests. +- `make test` in an isolated standalone checkout matching the ordinary SDK CI layout — running; final result required before review readiness. +- `make lint`; `make typecheck`; `make format-check` — PASS for both packages. +- `make build dist-check` — PASS: both wheel/sdist pairs, twine checks, py.typed and clean combined install. +- `pytest e2e/test_server_http_e2e.py -q` with the E2E credential prerequisite supplied — PASS, 22 actual local HTTP/server tests (initial credential-free invocation explicitly skipped them). +- `pytest e2e/test_standard_contract.py::test_standard_sync_lifecycle_files_processes_and_interpreter -q` — PASS on real Express, 1 test including lifecycle/files/process/interpreter; existing tracker cleanup ran. + +## Cleanup + +The fixture tests create no cloud resources. The separate real Express standard-contract test used the existing owned-resource tracker and cleaned up its sandbox; HTTP test subprocesses stopped normally. Credentials were injected from ignored configuration, with no values recorded. + +## Not verified + +No new SDK cloud or model behavior is claimed. Full owner gates and consumer source pins remain pending. diff --git a/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md b/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md new file mode 100644 index 00000000..a3658501 --- /dev/null +++ b/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md @@ -0,0 +1,39 @@ +# Decision: Share application authentication test vectors + +Status: proposed + +## Problem + +The CLI, Python client and Node HTTP client maintained similar authentication examples independently. User-requested CLI onboarding work must not introduce SDK configuration commands or change the library's input responsibilities. + +## Decision + +Own a small, language-neutral application authentication fixture under contracts/. Consumers verify the same anonymous, application-token and case-insensitive gateway-header cases. Python continues to accept its existing parameters, environment/dotenv and configuration inputs. No runtime API, cloud behavior or package version changes. + +## API Design + +N/A — additive test vectors and tests only. The fixture contains a version and cases with headers, optional token and expected lowercase header names. All values are placeholders. + +## Alternatives considered + +- Share runtime code across languages: unnecessary and couples independent distributions. +- Add SDK setup commands: outside this library's role. + +## Dependencies + +Existing ServerClient and pytest. Consumer follow-up: https://github.com/Alibaba-Agent-Sandbox/agent-sandbox/issues/189. + +## Test Strategy + +Run the fixture and application-binding tests, both package test suites, repository checks and CI. Consumers pin the reviewed source revision rather than requiring sibling checkouts. + +## Acceptance criteria + +- All consumers run byte-identical vectors. +- Gateway credentials remain separate from explicitly supplied application credentials. +- No SDK configuration command, prompting behavior or public export is added. +- Owner evidence distinguishes fixture checks from cloud acceptance. + +## Evidence + +- [Verification](../../../evidence/verify/2026-10-26-application-auth-vectors.md). diff --git a/CHANGELOG.md b/CHANGELOG.md index 4992c410..319a1da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] +### Tests + +- Add canonical application authentication vectors for the Python, CLI and Node clients; SDK runtime/configuration APIs remain unchanged. + + ### Changed - Normalize Python MCP background-task `sandbox_id` handles to the actual `provider:id`. Return the opaque handle unchanged when querying/cancelling; callers parsing a raw ID must update. Legacy raw IDs still resolve within a unique lifecycle cache or the SDK's default-provider scope. / Python MCP 后台任务的 `sandbox_id` 句柄规范为实际 `provider:id`;查询和取消须原样回传,拆分原始 ID 的调用者需要更新。历史原始 ID 仍可在无歧义的生命周期缓存或 SDK 默认提供方范围内解析。 diff --git a/client-sdk/tests/test_api/test_application_auth_vectors.py b/client-sdk/tests/test_api/test_application_auth_vectors.py new file mode 100644 index 00000000..4d05e4f3 --- /dev/null +++ b/client-sdk/tests/test_api/test_application_auth_vectors.py @@ -0,0 +1,22 @@ +"""Application authentication vectors shared with the CLI and Node HTTP client.""" + +import json +from pathlib import Path + +import pytest + +from agent_sandbox.api.server_client import ServerClient + +VECTORS = json.loads( + ( + Path(__file__).resolve().parents[3] / "contracts/testing/application-auth-vectors.json" + ).read_text() +)["cases"] + + +@pytest.mark.parametrize("case", VECTORS, ids=lambda case: case["id"]) +def test_application_auth_vectors(case): + client = ServerClient( + "https://example.invalid/owned", token=case.get("token"), headers=case["headers"] + ) + assert {key.lower(): value for key, value in client.auth_headers().items()} == case["expected"] diff --git a/contracts/testing/application-auth-vectors.json b/contracts/testing/application-auth-vectors.json new file mode 100644 index 00000000..bed64c67 --- /dev/null +++ b/contracts/testing/application-auth-vectors.json @@ -0,0 +1,52 @@ +{ + "version": 1, + "cases": [ + { + "id": "anonymous", + "headers": {}, + "expected": {} + }, + { + "id": "application", + "headers": {}, + "token": "placeholder-application", + "expected": { + "authorization": "Bearer placeholder-application", + "x-access-token": "placeholder-application" + } + }, + { + "id": "gateway", + "headers": { + "X-Gateway-Token": "placeholder-gateway" + }, + "expected": { + "x-gateway-token": "placeholder-gateway" + } + }, + { + "id": "separate-audiences", + "headers": { + "X-Access-Token": "placeholder-gateway" + }, + "token": "placeholder-application", + "expected": { + "authorization": "Bearer placeholder-application", + "x-access-token": "placeholder-gateway" + } + }, + { + "id": "case-insensitive-gateway", + "headers": { + "x-aCcEsS-tOkEn": "placeholder-gateway", + "X-Gateway-Token": "placeholder-extra" + }, + "token": "placeholder-application", + "expected": { + "authorization": "Bearer placeholder-application", + "x-access-token": "placeholder-gateway", + "x-gateway-token": "placeholder-extra" + } + } + ] +} diff --git a/docs/en/reference/configuration.md b/docs/en/reference/configuration.md index 3086f749..5e00452e 100644 --- a/docs/en/reference/configuration.md +++ b/docs/en/reference/configuration.md @@ -263,3 +263,6 @@ Reading and writing this configuration from the command line is a CLI feature: ` ### Transport attempts Builtin platform/envd HTTP performs one transport attempt. Provider-engine read recovery is separate. Applications that retry safe reads must bound attempts; reconcile an unknown write outcome before repeating a mutation. + + +Application HTTP clients share authentication regression vectors with CLI and Node consumers. SDK configuration remains through parameters and its existing environment/dotenv/configuration sources; there is no SDK setup wizard. diff --git a/docs/zh/reference/configuration.md b/docs/zh/reference/configuration.md index d8c28a93..d10edec5 100644 --- a/docs/zh/reference/configuration.md +++ b/docs/zh/reference/configuration.md @@ -263,3 +263,6 @@ ABX_PROVIDER=alicloud-express ### 传输尝试 内置平台/envd HTTP 每次只执行一次传输尝试,提供方引擎的读取恢复独立处理。应用重试安全读取时应限制次数;写操作结果未知时,应先核对远端状态,再决定是否重新执行。 + + +应用 HTTP 客户端与 CLI、Node 客户端共用认证回归数据。SDK 继续通过参数及已有的环境变量、dotenv、配置来源取值,没有新增 SDK 初始化向导。 From 1f1a23ae625e36708ddaa1c30a31d607a8040665 Mon Sep 17 00:00:00 2001 From: anycodes <21079031+anycodes@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:23:46 +0000 Subject: [PATCH 2/3] docs: record owner authentication contract verification --- .../evidence/verify/2026-10-26-application-auth-vectors.md | 6 +++--- .../proposed/feature/2026-10-26-application-auth-vectors.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.agents/evidence/verify/2026-10-26-application-auth-vectors.md b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md index 110c87d0..0508cefe 100644 --- a/.agents/evidence/verify/2026-10-26-application-auth-vectors.md +++ b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md @@ -1,7 +1,7 @@ # Verification: shared application authentication vectors - Date: 2026-10-26 -- Result: PARTIAL +- Result: PASS for the additive authentication contract - Change: additive contracts/testing/application-auth-vectors.json and its Python consumer test. - Environment: Python 3.13, isolated virtual environment; client/server 0.4.0a6 installed from this source. Fixture checks use placeholder credentials only; separate cloud evidence used ignored credentials without recording values. @@ -16,7 +16,7 @@ The fixture covers anonymous access, explicit application authentication and pre - `ruff check client-sdk/tests/test_api/test_application_auth_vectors.py` — PASS. - `make test` with locally adjacent, independently moving CLI/provider checkouts — server PASS (875 passed, 1 skipped); client 2359 passed, 3 skipped, 5 pre-existing provider integration failures. Those optional sibling tests do not use the required engine CI pins. - Required provider-engine CI scenario with CLI 94a1f90244e7b36e06c4618feaa323c4d056e784 and providers 857a66b3884faeaade01411ec9561987a7aee705 — PASS, 4 tests. -- `make test` in an isolated standalone checkout matching the ordinary SDK CI layout — running; final result required before review readiness. +- `make test` in an isolated standalone checkout matching ordinary SDK CI — server 875 passed/1 skipped; client 2339 passed/27 conditional skips/1 transient PTY delete connection failure. The complete affected server-client E2E module reran successfully: 35 passed. A final client full run is recorded separately before merge. - `make lint`; `make typecheck`; `make format-check` — PASS for both packages. - `make build dist-check` — PASS: both wheel/sdist pairs, twine checks, py.typed and clean combined install. - `pytest e2e/test_server_http_e2e.py -q` with the E2E credential prerequisite supplied — PASS, 22 actual local HTTP/server tests (initial credential-free invocation explicitly skipped them). @@ -28,4 +28,4 @@ The fixture tests create no cloud resources. The separate real Express standard- ## Not verified -No new SDK cloud or model behavior is claimed. Full owner gates and consumer source pins remain pending. +No new SDK cloud or model behavior is claimed. PR https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/142 passed all 13 checks at 98642ae6712a5017e187cae7952a2b3c819c1ece: client/server Python 3.10/3.11/3.12, distributions, hygiene, pinned public contract, required provider engine, both public runtime Docker fixtures and Markdown links. Subsequent evidence-only heads still require their own checks/review before merge. Consumers pin the immutable canonical fixture source rather than requiring a workspace checkout. diff --git a/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md b/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md index a3658501..feed76ff 100644 --- a/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md +++ b/.agents/notes/proposed/feature/2026-10-26-application-auth-vectors.md @@ -8,7 +8,7 @@ The CLI, Python client and Node HTTP client maintained similar authentication ex ## Decision -Own a small, language-neutral application authentication fixture under contracts/. Consumers verify the same anonymous, application-token and case-insensitive gateway-header cases. Python continues to accept its existing parameters, environment/dotenv and configuration inputs. No runtime API, cloud behavior or package version changes. +Own a small, language-neutral application authentication fixture under contracts/testing/. Consumers verify the same anonymous, application-token and case-insensitive gateway-header cases. Python continues to accept its existing parameters, environment/dotenv and configuration inputs. No runtime API, cloud behavior or package version changes. ## API Design From 88052f0f37a0d171ccef2797450d256953f74eee Mon Sep 17 00:00:00 2001 From: anycodes <21079031+anycodes@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:25:00 +0000 Subject: [PATCH 3/3] docs: finalize standalone SDK test evidence --- .agents/evidence/verify/2026-10-26-application-auth-vectors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/evidence/verify/2026-10-26-application-auth-vectors.md b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md index 0508cefe..52068299 100644 --- a/.agents/evidence/verify/2026-10-26-application-auth-vectors.md +++ b/.agents/evidence/verify/2026-10-26-application-auth-vectors.md @@ -16,7 +16,7 @@ The fixture covers anonymous access, explicit application authentication and pre - `ruff check client-sdk/tests/test_api/test_application_auth_vectors.py` — PASS. - `make test` with locally adjacent, independently moving CLI/provider checkouts — server PASS (875 passed, 1 skipped); client 2359 passed, 3 skipped, 5 pre-existing provider integration failures. Those optional sibling tests do not use the required engine CI pins. - Required provider-engine CI scenario with CLI 94a1f90244e7b36e06c4618feaa323c4d056e784 and providers 857a66b3884faeaade01411ec9561987a7aee705 — PASS, 4 tests. -- `make test` in an isolated standalone checkout matching ordinary SDK CI — server 875 passed/1 skipped; client 2339 passed/27 conditional skips/1 transient PTY delete connection failure. The complete affected server-client E2E module reran successfully: 35 passed. A final client full run is recorded separately before merge. +- `make test` in an isolated standalone checkout matching ordinary SDK CI — server 875 passed/1 skipped; client 2339 passed/27 conditional skips/1 transient PTY delete connection failure. The complete affected server-client E2E module reran successfully: 35 passed. Final standalone client full rerun — PASS: 2340 passed, 27 conditional skips in 176.75 seconds. The corresponding standalone server run passed 875 with 1 skip. - `make lint`; `make typecheck`; `make format-check` — PASS for both packages. - `make build dist-check` — PASS: both wheel/sdist pairs, twine checks, py.typed and clean combined install. - `pytest e2e/test_server_http_e2e.py -q` with the E2E credential prerequisite supplied — PASS, 22 actual local HTTP/server tests (initial credential-free invocation explicitly skipped them).