mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-16 09:55:29 +02:00
Merge origin/main (v1.64.1.0 code-smell wave) into test-evals-ci-speedup
Both sides shipped overlapping test-infra work in parallel; resolutions compose intent rather than picking sides: - free-tests.yml (both added): keep this branch's lane (canonical strict-parallel runner, secretless, plain runner, ~2min) over main's per-file-serial container loop (45min budget, hand-curated skip list, needs GITHUB_TOKEN); ported main's git safe.directory insight. - Dockerfile.ci Bun install: main discovered the installer IGNORES the BUN_VERSION env var (the old form silently installed latest) — main's arg-form mechanism + this branch's 1.3.13 target. - parity baseline: both sides rebased after hitting the same silent drift; adopted main's v1.64.1.0 union-normalized fixture and dropped this branch's interim v1.64.0.0 capture. carve-guards caps: main's tighter re-ratchets win (all four). - touchfiles: kept this branch's three-file facade split; ported main's pure-data removals (dead sidebar-agent entries, spec judge entry, ship-idempotency) into touchfiles-data.ts. - ship-idempotency SDK variant: main deliberately removed it as redundant with the real-PTY test; adopted — dropped this branch's rehomed copy and its periodic matrix row (the zombie-monolith deletion stands; coverage-audit + triage rehomes verified untouched by main). - e2e-tier-alignment: taught the new parent-mapper hard check main's consolidated describeE2ETier()/e2eTierEnabled() self-gate shapes (the helper's header names this file as a required recognizer). - browse/test/compare-board.test.ts: quarantined behind GSTACK_COMPARE_BOARD_TESTS=1 — all 16 tests fail identically on origin/main solo on dev machines (blame protocol receipts in-file); main's own CI lane skip-lists it. An always-red file would block every PR now that free-tests is a required check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -125,7 +125,6 @@ gstack/
|
||||
│ ├── gen-skill-docs.ts # Template → SKILL.md generator (config-driven)
|
||||
│ ├── host-config.ts # HostConfig interface + validator
|
||||
│ ├── host-config-export.ts # Shell bridge for setup script
|
||||
│ ├── host-adapters/ # Host-specific adapters (OpenClaw tool mapping)
|
||||
│ ├── resolvers/ # Template resolver modules (preamble, design, review, gbrain, etc.)
|
||||
│ ├── skill-check.ts # Health dashboard
|
||||
│ ├── test-paid-shards.ts # Sharded paid-tier runner (one Bun process per shard)
|
||||
@@ -399,47 +398,39 @@ every `git pull`.
|
||||
|
||||
| Layer | Module | Lives in |
|
||||
|-------|--------|----------|
|
||||
| L1-L3 | `content-security.ts` | both server and agent — datamarking, hidden element strip, ARIA regex, URL blocklist, envelope wrapping |
|
||||
| L4 | `security-classifier.ts` (TestSavantAI ONNX) | **sidebar-agent only** |
|
||||
| L4b | `security-classifier.ts` (Claude Haiku transcript) | **sidebar-agent only** |
|
||||
| L5 | `security.ts` (canary) | both — inject in compiled, check in agent |
|
||||
| L6 | `security.ts` (combineVerdict ensemble) | both |
|
||||
| L1-L3 | `content-security.ts` | server + read path — datamarking, hidden element strip, ARIA regex, URL blocklist, envelope wrapping |
|
||||
| L4 | `security-classifier.ts` (TestSavantAI ONNX) | **security sidecar subprocess only** (`security-sidecar-entry.ts`, driven by `security-sidecar-client.ts` from server.ts) |
|
||||
| Canary | `security.ts` (generate/inject/detect) | pure utilities — no production injector today (the chat prompt-builder that injected them was ripped) |
|
||||
| Combiner | `security.ts` (combineVerdict + THRESHOLDS) | pure, tested; retains transcript/deberta vote handling for LayerSignal inputs no live layer produces anymore |
|
||||
|
||||
History note: an L4b Haiku transcript classifier and an opt-in DeBERTa ensemble
|
||||
(`GSTACK_SECURITY_ENSEMBLE=deberta`) existed until the chat-path agent that
|
||||
invoked them was ripped; both were deleted as dead code (zero production
|
||||
callers). Do not re-document them as live.
|
||||
|
||||
**Critical constraint:** `security-classifier.ts` CANNOT be imported from the
|
||||
compiled browse binary. `@huggingface/transformers` v4 requires `onnxruntime-node`
|
||||
which fails to `dlopen` from Bun compile's temp extract dir. Only `security.ts`
|
||||
(pure-string operations — canary, verdict combiner, attack log, status) is safe
|
||||
for `server.ts`. See `~/.gstack/projects/garrytan-gstack/ceo-plans/2026-04-19-prompt-injection-guard.md`
|
||||
§"Pre-Impl Gate 1 Outcome" for full architectural decision.
|
||||
which fails to `dlopen` from Bun compile's temp extract dir — hence the sidecar
|
||||
subprocess. Only `security.ts` (pure-string operations — canary utilities,
|
||||
verdict combiner, status) is safe for `server.ts`. See
|
||||
`~/.gstack/projects/garrytan-gstack/ceo-plans/2026-04-19-prompt-injection-guard.md`
|
||||
§"Pre-Impl Gate 1 Outcome" for the original architectural decision.
|
||||
|
||||
**Thresholds** (in `security.ts`):
|
||||
- `BLOCK: 0.85` — single-layer score that would cause BLOCK if cross-confirmed
|
||||
- `WARN: 0.75` — cross-confirm threshold. When L4 AND L4b both >= 0.75 → BLOCK
|
||||
- `LOG_ONLY: 0.40` — gates transcript classifier (skip Haiku when all layers < 0.40)
|
||||
- `SOLO_CONTENT_BLOCK: 0.92` — single-layer threshold for label-less content classifiers
|
||||
(testsavant, deberta). Intentionally higher than `BLOCK` because these layers can't
|
||||
distinguish "this is an injection" from "this looks like phishing aimed at the user."
|
||||
The transcript classifier keeps a separate, label-gated solo path at `BLOCK` (0.85).
|
||||
|
||||
**Ensemble rule:** BLOCK only when the ML content classifier AND the transcript
|
||||
classifier both report >= WARN. Single-layer high confidence degrades to WARN —
|
||||
this is the Stack Overflow instruction-writing FP mitigation. Canary leak
|
||||
always BLOCKs (deterministic).
|
||||
**Thresholds** (in `security.ts`): `BLOCK: 0.85`, `WARN: 0.75`, `LOG_ONLY: 0.40`,
|
||||
`SOLO_CONTENT_BLOCK: 0.92` (label-less content classifiers can't distinguish
|
||||
"injection" from "phishing aimed at the user", so their solo bar is higher).
|
||||
The live L4 path applies these in server.ts's sidecar-scan handling; canary
|
||||
leak always BLOCKs (deterministic).
|
||||
|
||||
**Env knobs:**
|
||||
- `GSTACK_SECURITY_OFF=1` — emergency kill switch. Classifier stays off even if
|
||||
warmed. Canary is still injected; just the ML scan is skipped.
|
||||
- `GSTACK_SECURITY_ENSEMBLE=deberta` — opt-in DeBERTa-v3 ensemble. Adds
|
||||
ProtectAI DeBERTa-v3-base-injection-onnx as L4c classifier for cross-model
|
||||
agreement. 721MB first-run download. With ensemble enabled, BLOCK requires
|
||||
2-of-3 ML classifiers agreeing at >= WARN (testsavant, deberta, transcript).
|
||||
Without ensemble (default), BLOCK requires testsavant + transcript at >= WARN.
|
||||
warmed; the L1-L3 filters keep running.
|
||||
- Classifier model cache: `~/.gstack/models/testsavant-small/` (112MB, first run only)
|
||||
plus `~/.gstack/models/deberta-v3-injection/` (721MB, only when ensemble enabled)
|
||||
- Attack log: `~/.gstack/security/attempts.jsonl` (salted sha256 + domain only,
|
||||
rotates at 10MB, 5 generations)
|
||||
- Per-device salt: `~/.gstack/security/device-salt` (0600)
|
||||
- Session state: `~/.gstack/security/session-state.json` (cross-process, atomic)
|
||||
- Attack log: `~/.gstack/security/attempts.jsonl` — written by
|
||||
`tunnel-denial-log.ts` (tunnel-surface rejections; rotates at 10MB, 5 generations)
|
||||
- Session state: `~/.gstack/security/session-state.json` (cross-process, atomic;
|
||||
NOTE: classifierStatus currently has no live writer — shield status derives
|
||||
from what's on disk)
|
||||
|
||||
## Dev symlink awareness
|
||||
|
||||
@@ -510,7 +501,7 @@ determined leaker (a CHANGELOG line that does would fail a hostile screenshotter
|
||||
`--auto-redact`, `--repo-visibility`, `--from-file`). `bin/gstack-redact-prepush`
|
||||
is the opt-in git hook.
|
||||
- **Skill docs are generated** from `scripts/resolvers/redact-doc.ts`
|
||||
(`{{REDACT_TAXONOMY_TABLE}}`, `{{REDACT_INVOCATION_BLOCK:<sink>}}`) so /spec,
|
||||
(`{{REDACT_INVOCATION_BLOCK:<sink>}}`) so /spec,
|
||||
/cso, /ship, /document-release, /document-generate never drift from the engine.
|
||||
- **Scan-at-sink:** always scan the EXACT bytes that will be sent — write to a
|
||||
temp file, scan that file, pass the SAME file to `gh`/`git`. Never scan a string
|
||||
|
||||
Reference in New Issue
Block a user