Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
a890511
chore: pin the core dependency to a tag instead of tracking main (#25)
fylorn Sep 23, 2026
a90e9f3
feat!: forward what can be forwarded, convert only what must be (#26)
fylorn Sep 23, 2026
ca7647c
refactor: take the circuit-breaker registry and metric labels back fr…
fylorn Sep 23, 2026
a6678cf
refactor: redact PII with core's guard engine, and restore tool argum…
fylorn Sep 23, 2026
437a671
feat: inspect the tool calls an upstream returns (#29)
fylorn Sep 23, 2026
038796b
build: keep only line tables in dev and test builds (#30)
fylorn Sep 24, 2026
05f52e8
feat: one circuit-breaker state machine, and hidden characters in req…
fylorn Sep 24, 2026
8a76395
fix: make the integration suite pass again (#32)
fylorn Sep 24, 2026
6482690
test: fix the two flaky integration tests (#33)
fylorn Sep 24, 2026
9f46116
fix: bill a Chat stream whose caller did not ask for usage (#34)
fylorn Sep 24, 2026
3c35ab8
fix: a request the upstream refuses no longer fails over or trips bre…
fylorn Sep 24, 2026
234fcce
Merge main (v1.1.0) into dev
fylorn Sep 24, 2026
82f8061
docs: cut releases from a release branch, and keep the tag's headings…
fylorn Sep 24, 2026
bd57b5d
ci: run checks on pull requests into dev, including the integration s…
fylorn Sep 24, 2026
c1b2085
fix: bill cached input at cache prices, estimate missing usage, strip…
fylorn Sep 24, 2026
ad5b75b
refactor: take back what only this side used from core (#41)
fylorn Sep 24, 2026
3a617f3
feat(gateway): take official hosts, output fallback and error shapes …
fylorn Sep 24, 2026
ed1c8b5
feat(gateway): accept Gemini clients, and the Responses API over a We…
fylorn Sep 24, 2026
28d4387
test: count the probes that miss before the streaming cache hit (#44)
fylorn Sep 24, 2026
d3f36fc
refactor(server): move the catalog's SQL into repositories (#45)
fylorn Sep 24, 2026
83e9bcc
refactor(server): move the dashboard, limits and log-forwarding handl…
fylorn Sep 24, 2026
9b5b326
refactor(server): move the MCP handlers' SQL into repositories (#50)
fylorn Sep 24, 2026
86beb82
refactor(gateway): run the request guards on core's tw-guard engines …
fylorn Sep 24, 2026
1c80b83
refactor(server): move the identity handlers' SQL into repositories (…
fylorn Sep 24, 2026
c25b44f
fix(mcp): revoking a default connection no longer fails with a 500 (#51)
fylorn Sep 24, 2026
dbce845
test: leave the cancelled stream after it has started, not on a timer…
fylorn Sep 24, 2026
c3d2d57
refactor(server): move the access handlers' SQL into repositories (#48)
fylorn Sep 24, 2026
d92c2d1
fix(settings): read security.totp_required as a boolean, and seed aut…
fylorn Sep 24, 2026
7e95183
feat(gateway): record a client that leaves before its response exists…
fylorn Sep 24, 2026
367df3c
feat(auth): enforce the TOTP requirement (#55)
fylorn Sep 24, 2026
443de8d
feat(gateway): keep the last response on a Responses WebSocket (#56)
fylorn Sep 24, 2026
6890c72
Merge main (v2.0.0) into dev
fylorn Sep 24, 2026
d4f6d5a
docs(release): CI runs the integration suite on the release PR (#58)
fylorn Sep 24, 2026
ef3de87
docs(contributing): point vulnerability reports at the organization's…
fylorn Sep 25, 2026
c4f8b1c
docs(readme): current description of ThinkWatch Lite and ThinkWatch C…
fylorn Sep 25, 2026
f259962
feat(providers): authenticate Bedrock with an API key (#61)
fylorn Sep 28, 2026
78f9ab5
test: hold the early-cancel client once its key is known, not on a ti…
fylorn Sep 28, 2026
1b752f2
feat(providers): list Bedrock's models, and let the route editor take…
fylorn Sep 28, 2026
1f08421
fix(bedrock): refuse keys that will not decrypt, and keep instance-ro…
fylorn Sep 28, 2026
e480bfd
refactor(bedrock): use core's shared tw-bedrock, and core v0.55.0 (#65)
fylorn Sep 29, 2026
e1e7999
docs(readme): rewrite both READMEs to be short and accurate (#66)
fylorn Sep 30, 2026
af9eb81
Merge main (v2.1.0) into dev
fylorn Sep 30, 2026
ed6dd39
docs(readme): 37 MCP templates, what the setup wizard does, body reda…
fylorn Sep 30, 2026
9afcc08
fix(rbac): make the seeded team_manager work at team scope (#69)
fylorn Sep 30, 2026
fa3a5b9
fix(rbac): require gateway use, and count only grants that give it (#70)
fylorn Sep 30, 2026
a1eed6f
Merge main (v2.2.0) into dev
fylorn Sep 30, 2026
da88b09
Merge main (sponsor line) into dev
fylorn Oct 2, 2026
1a399e7
Allow clippy::double_must_use on the async_trait BlobStore (#73)
fylorn Oct 2, 2026
8d8d96f
Unify the request guards with thinkwatch-core's rule model (#72)
fylorn Oct 3, 2026
2baa123
Fix what the pre-release review of the guard unification found (#75)
fylorn Oct 3, 2026
33c22dc
Merge main (v3.0.0) into dev
fylorn Oct 3, 2026
dcc8616
Merge main (README: ThinkWatch Lite for individual developers) into dev
fylorn Oct 4, 2026
6b73344
Merge main (v3.1.0) into dev
fylorn Oct 5, 2026
03c393c
Usage limits: token limits refuse, key limits count on the key, Retry…
fylorn Oct 5, 2026
4075855
fix(redis): connect over TLS for rediss:// URLs (#82)
fylorn Oct 5, 2026
33234ee
Concurrent startup, body retention on restart, and Helm network polic…
fylorn Oct 5, 2026
b7a34e1
Merge main (v3.2.0) into dev
fylorn Oct 5, 2026
2ce6471
chore(deps): update rust crate rand to v0.10.1 [security] (#77)
renovate[bot] Oct 6, 2026
0682864
chore(deps): update rust crate xxhash-rust to v0.8.16 [security] (#78)
renovate[bot] Oct 6, 2026
1fbe7bd
chore(deps): take the Renovate dashboard upgrades (#85)
fylorn Oct 6, 2026
2e23fd9
chore(deps): pnpm 12, and ClickHouse row validation on (#86)
fylorn Oct 6, 2026
977cab0
ci: save Rust caches only on pushes, and let releases read CI's image…
fylorn Oct 8, 2026
a19ed65
Merge main (v3.2.1) into dev
fylorn Oct 8, 2026
ea2a81f
Merge main (v3.3.0) into dev
fylorn Oct 9, 2026
e8ae1f1
Stream endings and in-stream errors logged like answers; core v0.68.0…
fylorn Oct 10, 2026
0e070a9
Merge main (v3.3.1) into dev
fylorn Oct 10, 2026
633ad90
Merge main (v3.4.0) into dev
fylorn Oct 10, 2026
235e38b
fix(limits): enforce route caps and close the places limits leaked (#94)
fylorn Oct 10, 2026
31cbfc8
feat: GET /v1/usage answers for the key or its owner; API key limits …
fylorn Oct 10, 2026
8151cee
Merge main (v3.5.0) into dev
fylorn Oct 10, 2026
721b5ee
Merge main (README zh) into dev
fylorn Oct 10, 2026
4f87839
feat(console): Add to ThinkWatch Lite; gateway address for every user…
fylorn Oct 11, 2026
042e605
Merge main (v3.6.0) into dev
fylorn Oct 11, 2026
ebdb9dc
chore: add a contributor license agreement signed by PR comment (#102)
fylorn Oct 11, 2026
133d610
ci: name the CLA job cla (#103)
fylorn Oct 12, 2026
eef9ff4
Merge main (3.7.0) back into dev
fylorn Oct 12, 2026
30c5f5b
Merge main (3.7.1) back into dev
fylorn Oct 12, 2026
12f4f82
Merge main (3.8.0) back into dev
fylorn Oct 13, 2026
7ef4ff0
Merge main (3.8.1) back into dev
fylorn Oct 13, 2026
72888a4
Bump rustls to 0.23.46 (RUSTSEC-2026-0346 to -0349) (#108)
fylorn Oct 15, 2026
98b6790
Merge main (3.8.2) back into dev
fylorn Oct 16, 2026
d86570c
Tool inspection: decide on settled input, record whole calls (core v0…
fylorn Oct 19, 2026
a9c5150
chore(deps): update node.js to v24.22.0 (#111)
renovate[bot] Oct 19, 2026
57369f6
chore(deps): update pnpm to v12.14.0 (#99)
renovate[bot] Oct 19, 2026
9549fd6
chore(deps): update ghcr.io/zitadel/zitadel docker tag to v4.19.5 (#110)
renovate[bot] Oct 19, 2026
cf5b29c
chore(release): tag 3.8.3
fylorn Oct 20, 2026
de1425d
build: pin pnpm 12.14.0 in CI and the web image, matching packageManager
fylorn Oct 20, 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
with:
# Pinned — matches `packageManager` in web/package.json.
# Bump together with that field, never alone.
version: 12.9.1
version: 12.14.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
Expand Down
42 changes: 41 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,45 @@ target.

## [Unreleased]

## [3.8.3] — 2026-10-20

Tool-call inspection in streamed answers now decides only on arguments
that have settled, and a hit that is recorded carries the whole call. The
thinkwatch-core crates move from v0.75.0 to v0.77.0. The web image is
built with Node.js 24.22.0 and pnpm 12.14.0.

No setting, schema or API route changes.

### Changed

- The thinkwatch-core crates move from v0.75.0 to v0.77.0.
- Since a recorded hit now waits for the complete call, a streamed tool
call that never completes (the upstream stream breaks off, or the client
leaves, in the middle of it) leaves no tool-inspection row. Such a call
was never whole on the client side either. Rules that cut still check
the arguments while they arrive.
- The web image's build stage uses Node.js 24.22.0 and pnpm 12.14.0. The
served image (nginx) is unchanged.
- The development compose file (`deploy/docker-compose.dev.yml`) runs
Zitadel v4.19.5.

### Fixed

- **Tool-call inspection no longer judges arguments that are still
arriving.** A streamed tool call was checked against its arguments as
far as they had come in. A host cut off in the middle of its name
(`http://127` before `.0.0.1`) looked external, and a pattern anchored
at the end could match the half-received tail. A hit now counts only
once it is settled; rules that cut still act as early as possible.
- **A recorded hit carries the whole call.** A hit that is only recorded,
and every hit in observe mode, was recorded with the arguments as they
stood at the first match. It is now recorded once the call is complete.
A Chat Completions call with no `finish_reason` or `[DONE]` is checked
when the stream ends.
- **`-T` is an upload only in curl.** The upload rule took any `-T` for
`curl -T`, so `docker compose exec -T` next to a URL was recorded as a
file upload.

## [3.8.2] — 2026-10-16

Tool-call inspection now checks every choice of an answer, not only the
Expand Down Expand Up @@ -2450,7 +2489,8 @@ unreleased builds should: stop the gateway, run `db/schema.sql`
against PostgreSQL, restart against this tag. The schema is
idempotent end-to-end, so the apply is safe to repeat.

[Unreleased]: https://github.com/ThinkWatchProject/ThinkWatch/compare/v3.8.2...HEAD
[Unreleased]: https://github.com/ThinkWatchProject/ThinkWatch/compare/v3.8.3...HEAD
[3.8.3]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v3.8.3
[3.8.2]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v3.8.2
[3.8.1]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v3.8.1
[3.8.0]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v3.8.0
Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ members = [
]

[workspace.package]
version = "3.8.2"
version = "3.8.3"
edition = "2024"
# The MSRV: the newest `rust-version` among the locked dependencies
# (sqlx 0.9 and the aws-smithy crates under aws-sigv4). Without it,
Expand Down Expand Up @@ -70,10 +70,10 @@ opt-level = 3
# never re-exported through a local shim. And the reverse: something only
# this side uses (the at-rest crypto, IMDSv2 credentials, the gateway error)
# lives here, not in core.
tw-bedrock = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.75.0" }
tw-breaker = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.75.0" }
tw-dialect = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.75.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.75.0" }
tw-bedrock = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.77.0" }
tw-breaker = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.77.0" }
tw-dialect = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.77.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.77.0" }

# Web framework
axum = { version = "0.8", features = ["macros", "ws"] }
Expand Down
7 changes: 6 additions & 1 deletion crates/gateway/src/lifecycle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,12 @@ pub(crate) fn build_chat_pump(
out.extend(shaper.finish());
// The converter's last bytes can complete a tool call (the block's
// stop), so they are inspected too.
let stop = inspector.as_mut().and_then(|i| i.check(&out));
// A Chat call with no `finish_reason` or `[DONE]` completes only
// as the stream closes; one that stops it keeps the tail back.
let stop = inspector.as_mut().and_then(|i| {
i.check(&out)
.or_else(|| i.finish().map(|err| (err, 0)))
});
if let Some((err, safe)) = stop {
let out = cut(&shaper, None, client, &out[..safe], &err);
tell(&mut done_tx, StreamOutcome::UpstreamError {
Expand Down
86 changes: 85 additions & 1 deletion crates/gateway/src/tool_inspection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ impl ToolInspection {
}

/// A wall for an SSE stream in the client's format. `None` when off.
///
/// Only the rules that can stop the response are checked while a call
/// is still arriving, and only on what has settled (a host cut off at
/// `http://127` is not yet an external one). Everything else waits for
/// the call to complete, so a recorded hit carries the whole call. In
/// observe nothing can stop it, so every rule waits.
pub fn stream(&self) -> Option<Wall> {
self.mode.detects().then(|| Wall::new(self.rules.clone()))
self.mode
.detects()
.then(|| Wall::new(self.rules.clone()).cut_early(self.mode.acts()))
}

/// Inspect a whole response. Empty when off.
Expand Down Expand Up @@ -128,6 +136,29 @@ impl StreamInspector {
}
None
}

/// The stream ran to its end. A Chat call that never got its
/// `finish_reason` or `[DONE]` is complete only now: the client runs it
/// when the stream closes. Returns the refusal when one stops it; the
/// rest of the stream should not go out then.
pub fn finish(&mut self) -> Option<crate::error::GatewayError> {
for v in self.wall.finish() {
let blocked = self.inspection.blocks(&v);
record(
&self.audit,
&self.caller,
&self.provider,
&v,
blocked,
self.inspection.mode,
&self.mask,
);
if blocked {
return Some(refusal(&v));
}
}
None
}
}

/// What the caller is told when a response is cut. Names the tool and the
Expand Down Expand Up @@ -364,6 +395,59 @@ mod tests {
assert_eq!(found[0].rule, "upload-file-to-host");
}

/// A hit that is only recorded waits for the call to complete: the
/// audit row carries the command the client got, not the piece that had
/// arrived when the rule first matched.
#[test]
fn a_recorded_hit_waits_for_the_whole_call() {
let t = ToolInspection::default();
let mut wall = t.stream().expect("on by default");
let ev = |name: &str, d: serde_json::Value| format!("event: {name}\ndata: {d}\n\n");
let delta = |part: &str| {
ev(
"content_block_delta",
serde_json::json!({"type": "content_block_delta", "index": 0,
"delta": {"type": "input_json_delta", "partial_json": part}}),
)
};
wall.feed(
ev(
"content_block_start",
serde_json::json!({"type": "content_block_start", "index": 0,
"content_block": {"type": "tool_use", "id": "t1", "name": "bash", "input": {}}}),
)
.as_bytes(),
);
assert!(
wall.feed(delta(r#"{"command":"rm -rf / "#).as_bytes())
.is_empty()
);
assert!(wall.feed(delta(r#"&& echo done"}"#).as_bytes()).is_empty());
let found = wall.feed(
ev(
"content_block_stop",
serde_json::json!({"type": "content_block_stop", "index": 0}),
)
.as_bytes(),
);
assert_eq!(found.len(), 1, "{found:?}");
assert_eq!(found[0].rule, "rm-rf-root");
assert_eq!(found[0].arguments, r#"{"command":"rm -rf / && echo done"}"#);
}

/// `-T` is an upload only in curl: `docker compose exec -T` turns off
/// the terminal.
#[test]
fn a_dash_t_outside_curl_is_not_an_upload() {
let t = ToolInspection::default();
assert!(
t.whole(&call(
"docker compose exec -T postgres psql -c 'select 1'; open https://docs.example.com"
))
.is_empty()
);
}

#[test]
fn the_excerpt_a_hit_reports_can_be_masked() {
let key = "sk-ant-api03-AAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ services:

# --- Zitadel (OIDC / SSO provider for development) ---
zitadel:
image: ghcr.io/zitadel/zitadel:v4.19.4
image: ghcr.io/zitadel/zitadel:v4.19.5
command: start-from-init --masterkeyFromEnv --tlsMode disabled
environment:
ZITADEL_MASTERKEY: "${ZITADEL_MASTERKEY:?ZITADEL_MASTERKEY is required (32 chars)}"
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker/Dockerfile.web
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# `pnpm install` and `pnpm build` under QEMU: the build alone took 260s
# against 23s natively, and when Node crashed there with SIGILL the step
# never exited — the CI job sat idle until GitHub's six-hour limit.
FROM --platform=$BUILDPLATFORM node:24.21.0-alpine AS builder
FROM --platform=$BUILDPLATFORM node:24.22.0-alpine AS builder

# Pin pnpm to a known-good 12.x, matching `packageManager` in
# web/package.json. The workspace YAML's `allowBuilds` field requires
Expand All @@ -15,7 +15,7 @@ FROM --platform=$BUILDPLATFORM node:24.21.0-alpine AS builder
# a non-reproducible dist/. pnpm 12 is a native binary: Corepack fetches
# the `pnpm` wrapper, whose first run downloads the musl build from the
# npm registry and checks it against npm's signature before running it.
RUN corepack enable && corepack prepare pnpm@12.9.1 --activate
RUN corepack enable && corepack prepare pnpm@12.14.0 --activate

WORKDIR /app
# pnpm-workspace.yaml carries the install-script allowlist (see its
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/think-watch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: think-watch
description: Enterprise AI API Gateway & MCP Management Platform
type: application
version: 3.8.2
appVersion: "3.8.2"
version: 3.8.3
appVersion: "3.8.3"
keywords:
- ai
- gateway
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "web",
"private": true,
"version": "3.8.2",
"version": "3.8.3",
"type": "module",
"packageManager": "pnpm@12.9.1",
"packageManager": "pnpm@12.14.0",
"scripts": {
"dev": "vite",
"build": "node scripts/check-i18n.mjs && tsc -b && vite build",
Expand Down
Loading
Loading