#17690: scaffolds: Phase 0 plumbing (passthrough)
docs
agents
stale
size: M
Cluster:
Configuration Fixes and Enhancements
## Summary
Phase 0 “reasoning scaffolds” plumbing: adds the scaffolds module surface area, config wiring, and tests.
**Phase 0 is intentionally passthrough / no behavior change.** It only establishes a safe choke-point for future phases.
## RFC
- `docs/scaffolds-rfc.md`
## What changed (Phase 0)
- Adds `src/scaffolds/**` (types + adapter surface)
- Wires config parsing / validation for `config.scaffolds.*`
- Adds baseline tests to ensure Phase 0 remains inert
## Behavior / passthrough truth table
Phase 0 does **not** modify model calls or tool behavior. It only *post-processes* final payloads via `ScaffoldAdapter.enforceFinal(...)`, which is implemented as a passthrough.
| Condition | Result |
|---|---|
| `config.scaffolds.enabled !== true` | Adapter not applied (no change) |
| `config.scaffolds.enabled === true` | Adapter invoked but returns identical payloads (no change) |
## Verification
- `pnpm test`
- `pnpm lint`
- `pnpm check` (includes `tsgo`)
## Notes
- Untracked local logs in the branch were not committed.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds Phase 0 "reasoning scaffolds" plumbing: a new `src/scaffolds/` module with an adapter that post-processes embedded-run payloads (currently a no-op passthrough), Zod schema validation for `config.scaffolds.reasoning`, and corresponding tests. Also centralizes sensitive-key detection into `src/config/sensitive.ts` (previously duplicated across `redact-snapshot.ts`, `schema.ts`, and `schema.field-metadata.ts`), adds SSRF edge-case tests for numeric/hex hostname forms, and updates search provider help text to include "grok".
- **Scaffolds adapter** (`src/scaffolds/adapter.ts`, `phase0.ts`): When `config.scaffolds.reasoning.enabled` is true, calls `applyReasoningScaffoldsPhase0` which returns payloads unchanged. When disabled, returns payloads directly. Both paths are no-ops in Phase 0.
- **Config wiring**: `ScaffoldsSchema` added to `zod-schema.ts` with `phase: z.literal(0)` constraint; `ScaffoldsConfig` types added to `src/config/types.ts` and `src/scaffolds/types.ts`.
- **Sensitive-key centralization**: `isSensitiveKey` + `DEFAULT_SENSITIVE_KEY_PATTERNS` extracted to `src/config/sensitive.ts`; all consumers now import from there.
- **Unrelated additions**: SSRF tests for numeric/hex IPv4 hostname forms, "grok" added to search provider help text — these appear to be bundled fixes from the same branch.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge — Phase 0 is a verified no-op passthrough with no behavioral changes.
- Score of 4 reflects that the core scaffolds plumbing is clean and well-tested, with intentional no-op behavior verified by both unit and integration tests. Minor design issues (duplicate type definitions, double cast workaround, orphaned JSDoc) were already flagged in prior review threads and don't affect runtime behavior. The Zod schema correctly constrains phase to literal 0. No security or logic bugs found.
- Previously flagged: `src/scaffolds/types.ts` (duplicate types with `src/config/types.ts`), `src/agents/pi-embedded-runner/run.ts` (double cast workaround), `src/config/redact-snapshot.ts` (orphaned JSDoc). No new files require special attention.
<sub>Last reviewed commit: eb4547c</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17715: scaffolds: Phase 1 executor (g-v-p) + gates + manifests
by swmeyer1979 · 2026-02-16
78.4%
#16412: fix(config): align tools.web.fetch schema with firecrawl/readabilit...
by ciberponk · 2026-02-14
68.5%
#10943: fix(config): resolve Control UI "Unsupported schema node" for confi...
by kraftbj · 2026-02-07
67.6%
#15571: feat: infrastructure foundation — hooks, model failover, sessions, ...
by tangcruz · 2026-02-13
65.9%
#21589: Post-Performance Roadmap: Milestones A–D (contracts, observability,...
by Doji-Hammer · 2026-02-20
65.8%
#23669: refactor(logging): migrate node-host and tailscale console calls to...
by kevinWangSheng · 2026-02-22
65.6%
#23534: fix(config): add firecrawl and readability fields to ToolsWebFetchS...
by slayoffer · 2026-02-22
65.6%
#16290: fix: add field-level validation for custom LLM provider config
by superlowburn · 2026-02-14
64.1%
#20561: feat: add Sisyphus-style orchestration features
by dfggggx198601 · 2026-02-19
63.9%
#6095: feat(gateway): support modular guardrails extensions for securing a...
by Reapor-Yurnero · 2026-02-01
63.7%