Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
31 changes: 31 additions & 0 deletions .agents/evidence/verify/2026-10-26-application-auth-vectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Verification: shared application authentication vectors

- Date: 2026-10-26
- 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.

## 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 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).
- `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. 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.
Original file line number Diff line number Diff line change
@@ -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/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

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).
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 默认提供方范围内解析。
Expand Down
22 changes: 22 additions & 0 deletions client-sdk/tests/test_api/test_application_auth_vectors.py
Original file line number Diff line number Diff line change
@@ -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"]
52 changes: 52 additions & 0 deletions contracts/testing/application-auth-vectors.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
3 changes: 3 additions & 0 deletions docs/en/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions docs/zh/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,6 @@ ABX_PROVIDER=alicloud-express
### 传输尝试

内置平台/envd HTTP 每次只执行一次传输尝试,提供方引擎的读取恢复独立处理。应用重试安全读取时应限制次数;写操作结果未知时,应先核对远端状态,再决定是否重新执行。


应用 HTTP 客户端与 CLI、Node 客户端共用认证回归数据。SDK 继续通过参数及已有的环境变量、dotenv、配置来源取值,没有新增 SDK 初始化向导。
Loading