You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generalizes the CLI-subprocess driver's (#4266, this batch) reuse of redactSecrets and SUBSCRIPTION_CLI_ENV_ALLOWLIST/subscriptionCliEnv into a proper, engine-hosted, reusable helper — rather than every future subprocess-spawning driver (or anything else in gittensory-miner) copy-pasting the pattern from src/selfhost/ai.ts by hand. Today that pattern lives entirely in src/selfhost/ai.ts (SUBSCRIPTION_CLI_ENV_ALLOWLIST at line 349, subscriptionCliEnv at line 391, redactSecrets at line 724, resolveSubscriptionCliPath at line 375) — none of it is exported from packages/gittensory-engine, so #4266's driver either duplicates it or (better, and what this issue is for) the shared bits get promoted to the engine package where both src/selfhost/ai.ts and the new driver can depend on the same source of truth.
Deliverables
packages/gittensory-engine/src/miner/subprocess-env.ts (or equivalent path) exporting a generalized env-allowlist builder (parameterized allowlist, not hardcoded to SUBSCRIPTION_CLI_ENV_ALLOWLIST's exact list — a coding-agent subprocess may need a different/larger allowlist than a review-only CLI call) and a generalized secret-redaction function lifted from redactSecrets's pattern (src/selfhost/ai.ts:724-731) — carry over the SECRET_PATTERNS regex family too (src/selfhost/ai.ts:339-346), not just the function shape.
Decide and document the migration story for src/selfhost/ai.ts's existing copy: refactor it to import from gittensory-engine (matching the shim pattern src/rules/predicted-gate.ts already uses over packages/gittensory-engine/src/predicted-gate.ts), or leave it a parallel copy for now with a comment cross-referencing the new shared helper. Either is acceptable, but must be a deliberate, documented choice — an un-shimmed duplicate is exactly the kind of drift risk issue 🧩 Wave 2 — Analyze, Plan, Create & Deploy (HELD tracker) #2353's Phase 7 section flags as having already bitten signals/change-guardrail.ts once.
Tests for the parameterized allowlist (confirm a caller-supplied allowlist is honored, not just the hardcoded default) and the carried-over SECRET_PATTERNS regex family (OpenAI/Anthropic keys, GitHub tokens, JWTs, AWS keys — same coverage redactSecrets already has, ported not weakened).
Generalizes the CLI-subprocess driver's (#4266, this batch) reuse of
redactSecretsandSUBSCRIPTION_CLI_ENV_ALLOWLIST/subscriptionCliEnvinto a proper, engine-hosted, reusable helper — rather than every future subprocess-spawning driver (or anything else ingittensory-miner) copy-pasting the pattern fromsrc/selfhost/ai.tsby hand. Today that pattern lives entirely insrc/selfhost/ai.ts(SUBSCRIPTION_CLI_ENV_ALLOWLISTat line 349,subscriptionCliEnvat line 391,redactSecretsat line 724,resolveSubscriptionCliPathat line 375) — none of it is exported frompackages/gittensory-engine, so #4266's driver either duplicates it or (better, and what this issue is for) the shared bits get promoted to the engine package where bothsrc/selfhost/ai.tsand the new driver can depend on the same source of truth.Deliverables
packages/gittensory-engine/src/miner/subprocess-env.ts(or equivalent path) exporting a generalized env-allowlist builder (parameterized allowlist, not hardcoded toSUBSCRIPTION_CLI_ENV_ALLOWLIST's exact list — a coding-agent subprocess may need a different/larger allowlist than a review-only CLI call) and a generalized secret-redaction function lifted fromredactSecrets's pattern (src/selfhost/ai.ts:724-731) — carry over theSECRET_PATTERNSregex family too (src/selfhost/ai.ts:339-346), not just the function shape.src/selfhost/ai.ts's existing copy: refactor it to import fromgittensory-engine(matching the shim patternsrc/rules/predicted-gate.tsalready uses overpackages/gittensory-engine/src/predicted-gate.ts), or leave it a parallel copy for now with a comment cross-referencing the new shared helper. Either is acceptable, but must be a deliberate, documented choice — an un-shimmed duplicate is exactly the kind of drift risk issue 🧩 Wave 2 — Analyze, Plan, Create & Deploy (HELD tracker) #2353's Phase 7 section flags as having already bittensignals/change-guardrail.tsonce.SECRET_PATTERNSregex family (OpenAI/Anthropic keys, GitHub tokens, JWTs, AWS keys — same coverageredactSecretsalready has, ported not weakened).References
src/selfhost/ai.ts:339-404(SUBSCRIPTION_CLI_ENV_ALLOWLIST,resolveSubscriptionCliPath,subscriptionCliEnv)src/selfhost/ai.ts:339-346(SECRET_PATTERNS)src/selfhost/ai.ts:724-731(redactSecrets)src/rules/predicted-gate.ts→packages/gittensory-engine/src/predicted-gate.tsas the existing shim-over-engine pattern to mirror if choosing to refactorsrc/selfhost/ai.tsonto this shared helper