Repository navigation
feat(backend): mimic first-party client identity anonymously - #23
Conversation
Spawned backend pins OPENCODE_CLIENT to a known first-party value (cli default), strips OPENCODE_API_KEY=public footgun, maps the only-be-used-from-within-OpenCode free-tier gate to 403 fail-fast (no retry/fallback), and adds ses_/msg_ ID drift-signal validators.
Verdict matrix
Sensitive paths
Deterministic pre-checks
gateway_safetyVERDICT: APPROVE
BLOCKING:
(none)
SHOULD_FIX:
(none)
NITS:
(none)Rationale
api_compatAPI Compatibility ReviewSummaryThis PR adds anonymous first-party identity mimicry for the spawned backend, free-tier gate error handling (403 fail-fast), tool-override stripping for free-tier models, and session ID format validation (debug-only). The changes touch all four route files and the collector. BLOCKING(none) No wire-shape violations detected. All four route error exits retain their existing shapes:
The SHOULD_FIX
NITS
Test gap notes
Cross-protocol regression check
VERDICT: NEEDS_CHANGES The docs_configVERDICT: NEEDS_CHANGES BLOCKING:
SHOULD_FIX:
NITS:
Files that must change to close matrix gap (if
FINAL_VERDICT: NEEDS_CHANGES Session: response_id=resp_XHitatupFs3V1e8P5bi2kAs,resp_req_vrtx_011CfBKLdT2LaXp291ERaMTT,chatcmpl-1515bf9c-96fc-4a3f-9794-9dd300a02b5c (chain via previous_response_id, 30min TTL). model=[model] provider=[provider]. |
Live-verified against local backend: Zen returns FreeTierError 403 when (a) the prompt tools map disables everything, (b) project config carries a wildcard permission rule, or (c) the session dir is not in a git work tree. Real opencode run passes the same model anonymously. - proxy + 4 routes: omit all-false tools maps only for likely-free Zen models (isFreeTierSuspectModel); paid/other providers keep the exact old hard-disable behavior - manager: git-init the jail workspace (best-effort); no permission files are written (wildcard rules trip the gate, verified live) - upstream: match structured FreeTierError class; tighten gate anchors (used-from-within) with false-positive regression tests - tests: prompt-tool-overrides, free-model route case, gate fixtures
|
Follow-up addressing the AI review (pushed as 76230a3), verified by targeted subagent reviews + live tests against a local backend: BLOCKING #1 — invalid, no change needed. The cited '[REDACTED]' is the literal word SHOULD_FIX #2/#3 — fixed. Gate anchors tightened to #4 — already covered. #5 — premise incorrect. The drift check sits at function top (once per request, not per poll iteration) and Root cause found live (beyond the review): Zen's |
…rity, tests, changelog
Live verification round 2: ANY false entry in the tools map gates
(single-false and mixed false+true both 403; {} / omitted / true-only
pass). Free-tier suspects now send true-only maps; paid/other tiers
unchanged. Also confirmed: any permission-deny content gates (wildcard
or explicit), plain dirs pass (git-ness not required), benign files
pass.
…typing Stage 1 (docs/comments, zero behavior change): sync all-false -> strip-false/true-only semantics across docs/configuration.md, CHANGELOG, 5 route call-site comments; soften jail git-init comment per round-2 (plain dirs pass); add out-of-matrix OPENCODE_CLIENT backend-identity docs + AGENTS.md notes (no six-way matrix change by design). Stage 2 (tests): DISABLE_TOOLS:true response-stripping cases for chat + responses; interactions stream + non-stream strip cases; fail-closed pin for the wider transform gate anchor. Stage 3 (type hygiene): stripFunctionCalls unknown -> string, drop redundant casts; session-ids upstream-pin + explicit fixture constants.
Anonymous first-party posture for the spawned backend (no login, no credential injection).
AGENTS.md checks: §4 no new proxy knob (no matrix update), §6 no secrets/forbidden files, §8 ESM pattern clean, §7 no docs change.
Verify: npm run typecheck && npm run build && npm test -- --runInBand