Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bade54a
feat(gateway): enforce execution deadline and cancellation
MaoMengww Nov 7, 2026
f4b4dd2
feat(gateway): bind model delivery to HTTP/1 owners
MaoMengww Nov 7, 2026
a2c5cea
feat(gateway): enforce retry ownership and Core RPC recovery
MaoMengww Nov 7, 2026
89886c8
feat(gateway): bound staged shutdown and complete process exit
MaoMengww Nov 7, 2026
f66ad1d
fix(gateway): correct framing recovery and delivery lifecycle
MaoMengww Nov 7, 2026
58dda71
merge: sync master and reconcile gateway lifecycle evidence
MaoMengww Nov 7, 2026
212de5c
chore(desktop): qualify merged Gateway contract
MaoMengww Nov 7, 2026
5fb2b2d
merge: reconcile latest master contracts and gateway behavior
MaoMengww Nov 10, 2026
7d9dc84
chore(desktop): qualify merged Gateway contract
MaoMengww Nov 10, 2026
1f7b393
merge: sync master and preserve Desktop validation records
MaoMengww Nov 12, 2026
f8ee089
merge: sync latest master gateway semantics
MaoMengww Nov 12, 2026
ad49500
test(gateway): align carrier refusal status
MaoMengww Nov 12, 2026
a211ba8
merge: sync latest master gateway contracts
MaoMengww Nov 13, 2026
3fcf2db
fix(kimi-code): exit after diagnostics output
MaoMengww Nov 13, 2026
e55d7b8
test(desktop): qualify merged gateway contract
MaoMengww Nov 13, 2026
4c9d2ef
merge: sync master integration bundle fixes
MaoMengww Nov 14, 2026
56f0c93
fix(gateway): reduce shutdown signal polling overhead
MaoMengww Nov 14, 2026
33eebdc
test(gateway): cover prepare recovery from closed idle UDS
MaoMengww Nov 14, 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
4 changes: 4 additions & 0 deletions .github/workflows/gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ jobs:
run: cargo fmt --manifest-path gateway/Cargo.toml --all --check
- name: Clippy
run: cargo clippy --locked --manifest-path gateway/Cargo.toml --all-targets -- -D warnings
- name: Install Python Core for mandatory UDS recovery acceptance
uses: ./.github/actions/setup-python-env
with:
python-version: "3.12"
- name: Tests
run: cargo test --locked --manifest-path gateway/Cargo.toml --workspace
144 changes: 144 additions & 0 deletions desktop/VALIDATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,149 @@
# Desktop validation

## Server 58dda714 Gateway contract qualification

`sqlite-gateway-58dda714-v1` qualifies the thirteen generated Desktop operations against
SQLite Server source `58dda7146afe8a1c9241e8c1bc1e645179945330`, including the Gateway
lifecycle contract and listener authentication.

- Normalized OpenAPI SHA-256: `0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb`.
- Wheel: `powercontext-1.5.1.dev0+g58dda714-py3-none-any.whl`.
- Wheel SHA-256: `db79f910642f9b6841e297d50f08d2d05e5b4ecab82dbc8f8e4d6f4c8e875528`.

All 738 packaged runtime files match that exact Git archive after CRLF normalization.
The wheel was built from the archive with an explicit build version. Historical
qualification records retain their original source, contract, artifact and operation identities.

On 2026-11-07, Linux x86_64 / WSL2 / Python 3.14.4 / Rust 1.97.1 passed anonymous
loopback, static Bearer, HTTPS with explicit CA/base path, and enforced Provider modes
through the native `server_probe` and ordinary product `ConnectionManager`.
The harness selected the bundled product record and verified the actual wheel hash before
starting isolated real Python Server processes. All four modes preserve committed-write
response loss as unknown without replay and leave the Server alive after client exit.
The Provider mode additionally passes identity-change invalidation, same-identity revocation,
51-Scope pagination, and scoped native authorization when Server discovery is denied.
These checks establish local native protocol behavior; installed GUI, system credentials,
Windows/macOS, external providers, and production deployment require separate acceptance.

```sh
cargo build --locked --manifest-path desktop/src-tauri/Cargo.toml --example server_probe
uv run --no-sync python desktop/tests/real_server.py \
--product-qualification sqlite-gateway-58dda714-v1 \
--wheel desktop/.artifacts/server-58dda714/powercontext-1.5.1.dev0+g58dda714-py3-none-any.whl
```

The wheel, aggregate report, and source-equivalence report are retained under ignored
`desktop/.artifacts/server-58dda714/`. Per-mode process artifacts remain under ignored
`desktop/.artifacts/real-server-*/`.

## Gateway contract 0df224e7 authenticated legacy qualification

The `authenticatedClients` entries for `sqlite-atomic-112db11e-v1` and
`sqlite-atomic-3cefa45a-v1` qualify their original eleven operations for client contract
`0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb` in authenticated mode.
Their original Server commits, contract digests, artifact hashes, operation sets and existing evidence are preserved.

On 2026-11-07, Linux x86_64 / WSL2 / Python 3.14.4 / Rust 1.97.1 passed static Bearer,
HTTPS with explicit CA/base path, and enforced Provider modes for both historical Servers through the
unchanged native probe. The explicit rebuilt-source fixture verified every packaged runtime file against
each historical Git archive before execution. The rebuilt artifacts are the same fixture wheels and
SHA-256 values recorded under Gateway contract authenticated legacy qualification; these checks do not
qualify them as the original product wheels. Anonymous legacy use still requires an upgrade.

```sh
uv run --no-sync python desktop/tests/real_server.py \
--rebuilt-qualification sqlite-atomic-112db11e-v1 \
--wheel desktop/.artifacts/legacy-112db11e/powercontext-1.5.1.dev0+g112db11e-py3-none-any.whl
uv run --no-sync python desktop/tests/real_server.py \
--rebuilt-qualification sqlite-atomic-3cefa45a-v1 \
--wheel desktop/.artifacts/legacy-3cefa45a/powercontext-1.5.1.dev0+g3cefa45a-py3-none-any.whl
```

Reports are retained in `.scratch/gateway-g3-follow-up/merge-2538/` and the harness process artifacts
under ignored `desktop/.artifacts/`. These checks establish local native protocol behavior, not installed
GUI, system credentials, Windows/macOS, external providers, or production deployment acceptance.

## Server c527f3f6 Gateway contract qualification

`sqlite-gateway-c527f3f6-v1` qualifies the thirteen generated Desktop operations against
SQLite Server source `c527f3f65c3d3a38f53399230075eceef9364078`. Gateway lifecycle schemas
are included in the authoritative OpenAPI document; Desktop's existing operation set
and native wire models remain unchanged.

- Normalized OpenAPI SHA-256: `ee13915c5a1d53a7d3f7b59416d37a22601b0bffd14430997708f19f68a8354f`.
- Wheel: `powercontext-1.5.1.dev0+gc527f3f6-py3-none-any.whl`.
- Wheel SHA-256: `bbf4227a828a8964fa5eb5eab8b08c499cd3a76fbdcf986600c3db74aeff3106`.

All 739 packaged runtime files match that exact Git archive after CRLF normalization.
The wheel was built from the archive with an explicit build version. All historical
qualification records retain their original source, contract, artifact and operation identities.

On 2026-11-07, Linux x86_64 / WSL2 / Python 3.14.4 / Rust 1.97.1 passed anonymous
loopback, static Bearer, HTTPS with explicit CA/base path, and enforced Provider modes
through the unchanged native `server_probe` and ordinary product `ConnectionManager`.
The harness selected the bundled product record and verified the actual wheel hash before
starting its isolated real Python Server processes; no fixture qualification was injected.
All four modes preserve committed-write response loss as unknown without replay and leave
the Server alive after client exit. The Provider mode additionally passes identity-change
invalidation, same-identity revocation, 51-Scope pagination, and scoped native authorization
when Server discovery is denied. These are local protocol checks, not installed UI, system
vault, Windows, macOS, external-provider, or production-deployment acceptance.

```sh
cargo build --locked --manifest-path desktop/src-tauri/Cargo.toml --example server_probe
uv run --no-sync python desktop/tests/real_server.py \
--product-qualification sqlite-gateway-c527f3f6-v1 \
--wheel desktop/.artifacts/server-wheel/powercontext-1.5.1.dev0+gc527f3f6-py3-none-any.whl
```

The debug native probe SHA-256 is
`347ac20bbdf1574776e16c487a713afae263de05b4d602d916348a76f685bcda`.
The report identifies source `c527f3f6` with the new qualification record in the working
tree. Raw reports, per-mode Server logs, the source-equivalence report, and the exact wheel
are retained under ignored `desktop/.artifacts/`.

## Gateway contract authenticated legacy qualification

The `authenticatedClients` entries for `sqlite-atomic-112db11e-v1` and
`sqlite-atomic-3cefa45a-v1` qualify their original eleven operations for client contract
`ee13915c5a1d53a7d3f7b59416d37a22601b0bffd14430997708f19f68a8354f` in Bearer mode.
Their original Server commits, Server contract digests, artifact hashes, operations and
evidence remain unchanged. Anonymous legacy use still requires an upgrade.

On 2026-11-07, the unchanged native probe passed static Bearer, HTTPS with explicit CA/base
path, and enforced Provider modes for each historical Server on Linux x86_64 / WSL2 /
Python 3.14.4 / Rust 1.97.1. The existing explicit rebuilt-source fixture path compared every
packaged runtime file with each exact Git archive before execution. The rebuilt wheels are
distinct fixture artifacts; these runs do not qualify them as the original product wheels.

| Historical Server source | Rebuilt fixture wheel | Actual fixture SHA-256 |
| --- | --- | --- |
| `112db11e885c38b997da2177e03a4065a7e35dc3` | `powercontext-1.5.1.dev0+g112db11e-py3-none-any.whl` | `567d0cd4a4c7488d6ba76325f0652593a9fddf8782eb0008e75b2b88a76c5c87` |
| `3cefa45ad08490423391148439c9eb73f1d48f58` | `powercontext-1.5.1.dev0+g3cefa45a-py3-none-any.whl` | `9831d1e045b21267d3cd6d6c04fada5f54f2180013c0de9aaf477fa6861a8f6b` |

```sh
uv run --no-sync python desktop/tests/real_server.py \
--rebuilt-qualification sqlite-atomic-112db11e-v1 \
--wheel desktop/.artifacts/legacy-112db11e/powercontext-1.5.1.dev0+g112db11e-py3-none-any.whl
uv run --no-sync python desktop/tests/real_server.py \
--rebuilt-qualification sqlite-atomic-3cefa45a-v1 \
--wheel desktop/.artifacts/legacy-3cefa45a/powercontext-1.5.1.dev0+g3cefa45a-py3-none-any.whl
```

Aggregate reports and harness output are retained under ignored `desktop/.artifacts/g3-legacy-*`.
Per-mode Server logs and process reports are under `desktop/.artifacts/real-server-*/`;
the process reports identify each fixture by its wheel SHA-256.
The probe identity and platform limits are the same as in the current product qualification above.

The native regression suite also passes with these product and authenticated-client records:

```sh
cargo test --locked --manifest-path desktop/src-tauri/Cargo.toml --tests
```

One existing case is explicitly ignored. The passing suite includes the legacy compatibility
regressions and bundled-product assertions; it does not establish installed GUI or platform acceptance.

## Server 7d89a97a identity Runtime and statistics qualification

`sqlite-identity-stats-7d89a97a-v1` qualifies thirteen Desktop operations against
Expand Down
52 changes: 50 additions & 2 deletions desktop/src-tauri/src/connections/compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,9 @@
"32d75b58058ae0a9a3e159f47d67ab421649cefe86f662e12e75b4215f1f35d9": "desktop/VALIDATION.md#authenticated-server-112db11e-current-client-qualification",
"6d7cc69254c757895f82a5f71db1676f35fb85d97c268a806679180d38068f18": "desktop/VALIDATION.md#server-afa13bcb-current-client-qualification",
"9aabe2565d9cbd36075be03a83b7370e07e38e9f25232e20dd47812aba65e508": "desktop/VALIDATION.md#server-7d89a97a-identity-runtime-and-statistics-qualification",
"e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb": "desktop/VALIDATION.md#server-63feca70-identity-and-statistics-product-qualification"
"ee13915c5a1d53a7d3f7b59416d37a22601b0bffd14430997708f19f68a8354f": "desktop/VALIDATION.md#gateway-contract-authenticated-legacy-qualification",
"e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb": "desktop/VALIDATION.md#server-63feca70-identity-and-statistics-product-qualification",
"0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb": "desktop/VALIDATION.md#gateway-contract-0df224e7-authenticated-legacy-qualification"
}
},
{
Expand Down Expand Up @@ -806,7 +808,9 @@
"authenticatedClients": {
"6d7cc69254c757895f82a5f71db1676f35fb85d97c268a806679180d38068f18": "desktop/VALIDATION.md#server-afa13bcb-current-client-qualification",
"9aabe2565d9cbd36075be03a83b7370e07e38e9f25232e20dd47812aba65e508": "desktop/VALIDATION.md#server-7d89a97a-identity-runtime-and-statistics-qualification",
"e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb": "desktop/VALIDATION.md#server-63feca70-identity-and-statistics-product-qualification"
"ee13915c5a1d53a7d3f7b59416d37a22601b0bffd14430997708f19f68a8354f": "desktop/VALIDATION.md#gateway-contract-authenticated-legacy-qualification",
"e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb": "desktop/VALIDATION.md#server-63feca70-identity-and-statistics-product-qualification",
"0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb": "desktop/VALIDATION.md#gateway-contract-0df224e7-authenticated-legacy-qualification"
}
},
{
Expand Down Expand Up @@ -1140,6 +1144,28 @@
],
"evidence": "desktop/VALIDATION.md#server-7d89a97a-identity-runtime-and-statistics-qualification"
},
{
"id": "sqlite-gateway-c527f3f6-v1",
"serverCommit": "c527f3f65c3d3a38f53399230075eceef9364078",
"contractSha256": "ee13915c5a1d53a7d3f7b59416d37a22601b0bffd14430997708f19f68a8354f",
"artifactSha256": "bbf4227a828a8964fa5eb5eab8b08c499cd3a76fbdcf986600c3db74aeff3106",
"operations": [
"get_access_principal",
"get_artifact_revision",
"get_capabilities",
"get_connection_identity",
"get_default_scope",
"get_liveness",
"get_readiness",
"get_scope",
"get_server_info",
"get_stats",
"list_scopes",
"remember_memory",
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-c527f3f6-gateway-contract-qualification"
},
{
"id": "sqlite-stats-1998909e-v1",
"serverCommit": "1998909eaea9fdc8ea6a0d16bbda3c2232ae0c70",
Expand Down Expand Up @@ -1182,5 +1208,27 @@
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-63feca70-identity-and-statistics-product-qualification"
},
{
"id": "sqlite-gateway-58dda714-v1",
"serverCommit": "58dda7146afe8a1c9241e8c1bc1e645179945330",
"contractSha256": "0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb",
"artifactSha256": "db79f910642f9b6841e297d50f08d2d05e5b4ecab82dbc8f8e4d6f4c8e875528",
"operations": [
"get_access_principal",
"get_artifact_revision",
"get_capabilities",
"get_connection_identity",
"get_default_scope",
"get_liveness",
"get_readiness",
"get_scope",
"get_server_info",
"get_stats",
"list_scopes",
"remember_memory",
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-58dda714-gateway-contract-qualification"
}
]
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/transport/operations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contractSha256": "e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb",
"contractSha256": "0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb",
"operations": {
"get_liveness": {
"method": "GET",
Expand Down
30 changes: 30 additions & 0 deletions desktop/ui/src/generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,18 @@ export interface paths {
export type webhooks = Record<string, never>;
export interface components {
schemas: {
/** @enum {string} */
GatewayLifecycleDecision: "deadline_exceeded" | "gateway_shutdown" | "request_cancelled";
/**
* @description Sending facts known at the stop boundary. Possibly sent never means safe to resend; response received does not authorize release or establish client receipt.
* @enum {string}
*/
GatewayModelSend: "no_send" | "definitely_not_sent" | "possibly_sent" | "response_received";
/** @description Lifecycle control result, independent of Core allow/block/withhold and local delivery. */
GatewayLifecycleError: {
decision: components["schemas"]["GatewayLifecycleDecision"];
model_send: components["schemas"]["GatewayModelSend"];
};
/** @description A major/minor compatibility version. A major increment may remove or incompatibly change the governed contract. A minor increment only adds backward-compatible behavior or fields. */
ContractVersion: {
major: number;
Expand Down Expand Up @@ -6346,6 +6358,24 @@ export interface components {
};
};
responses: {
/** @description Total monotonic work deadline exceeded. Best effort only while HTTP status can still be sent; an expired deadline or unavailable connection may prevent delivery. Does not imply zero cost or permit retry. */
GatewayDeadlineExceeded: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["GatewayLifecycleError"];
};
};
/** @description Gateway shutdown, or explicit in-process cancellation when a response channel remains available. No HTTP cancellation endpoint or nonstandard cancellation status is defined. Already started HTTP status and completed execution terminals are preserved. */
GatewayStopped: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["GatewayLifecycleError"];
};
};
/** @description This response requires a coordinated client supporting Dream contract 2. Upgrade the Python SDK, CLI or integration and send X-PowerContext-Dream-Contract: 2. Original operations and compatible candidate shapes remain available without the header. */
ClientUpgradeRequired: {
headers: {
Expand Down
2 changes: 1 addition & 1 deletion desktop/ui/src/generated/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

// Generated from openapi/powercontext.yaml. Do not edit.
export const contractSha256 = "e54d69cdcbeef19a816e92670901aacda9c7e44df289c88c18ad5ae364a6efeb";
export const contractSha256 = "0df224e7027e81be9e2f6d768a7d38c46ce36297a4b60b2ebb03031558b465fb";
export const operations = {
"get_liveness": {
"method": "GET",
Expand Down
19 changes: 17 additions & 2 deletions docs/en/docs/operate/deploy-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,23 @@ Smaller, completely received responses still pass `before_release` before releas
Transparent Core/MCP forwarding retains the deployment body limit rather than consuming the model input allowance.
`PC_GATEWAY_MAX_CONCURRENT` (default 64) applies independently to model calls and fallback calls, so an active
fallback SSE connection cannot exhaust the model semaphore. The combined ceiling is therefore up to twice the
configured value, excluding exempt health probes; this setting is not a process-wide concurrency ceiling. Each permit stays attached to the response body
until drop; `/healthz` is exempt from both semaphores. A fallback request with a known oversized Content-Length
configured value, excluding exempt health probes; this setting is not a process-wide concurrency ceiling.
Model permits stay with the actual HTTP/1 connection owner through local response delivery and the end of
related request work, including writes still buffered after body EOF/drop. Model responses declare
`Connection: close`; normal connection completion establishes local completion, without proving client receipt.
The original 180-second monotonic deadline covers intake, execution, and local delivery. Expiration ends the
connection without an extra delivery/cleanup window; a response may be truncated and error JSON is best effort.
Framework-observed disconnects stop local work with `request_cancelled`; unobserved network loss is bounded by
the deadline. A delivery interruption preserves completed execution and model-send facts, including
`ReleaseAuthorized` and `ResponseReceived`. Cancellation does not prove provider rollback or safe resend.
The process-local `ExecutionSnapshot::local_delivery` reports model content delivery as `NotStarted`, `InProgress`,
`Completed`, or `Interrupted(reason)`; rejection and lifecycle-error responses do not start model content delivery.
It is independent of the execution terminal and does not retain response bytes or permits.
Fallback permits remain attached to their response body until drop. Fallback retains authentication,
keep-alive and streaming behavior without the model deadline or forced connection closure. Provider sends and HTTP
Core RPCs use fresh HTTP/1 connections with idle pooling disabled; the UDS Core client retains its bounded idle pool.
Gateway shutdown allows up to 25 seconds to drain and bounds process exit to 30 seconds from the first shutdown signal.
`/healthz` is exempt from both semaphores. A fallback request with a known oversized Content-Length
returns 413 before forwarding. Unknown-length overflow produces a body error: a prefix may already have reached
Core, and the proxy returns 502 if forwarding fails. It is not successful truncation, and the gateway does not
buffer an entire MCP stream to force a uniform error status.
Expand Down
Loading
Loading