Skip to content

Commit d0162d6

Browse files
committed
Harden agent: sandbox to workspace-write, ban shortcut patterns, add concrete examples
- Switch sandbox from danger-full-access to workspace-write with approvalPolicy: never — agent can only access its workspace and the explicitly listed additionalDirectories (TS source, existing client). It can no longer browse river-python or other repos. - Prompt overhaul: - Quality bar framing: output will be discarded if not clean/readable - BANNED patterns section: RootModel, make_schema_model, __get_pydantic_json_schema__, SchemaAdapter, create_model, raw JSON Schema dicts — all explicitly rejected - 6 concrete TypeBox-to-Pydantic translation examples covering Type.Object, $kind unions, error unions, Optional/Record/Array, recursive types, and Type.Intersect flattening - Directory scope section: only access workspace + TS source - Stronger anti-shortcut language throughout - Verification script improvements: - Code quality pre-check: scans all .py files for banned patterns before comparing schemas, fails with exit code 2 if found - New normalizations: Uint8Array->string, strip type alongside const, enum->anyOf+const, strip null variant from 2-element anyOf (handles TypeBox Optional vs Pydantic Optional mismatch), strip discriminator and additionalProperties metadata
1 parent b76e151 commit d0162d6

File tree

3 files changed

+657
-182
lines changed

3 files changed

+657
-182
lines changed

codegen-llm/src/codegen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export async function runCodegen(opts: CodegenOptions): Promise<void> {
5353

5454
const thread = codex.startThread({
5555
model: opts.model,
56-
sandboxMode: "danger-full-access",
56+
sandboxMode: "workspace-write",
57+
approvalPolicy: "never",
5758
modelReasoningEffort: opts.effort,
5859
workingDirectory: workDir,
5960
skipGitRepoCheck: true,

0 commit comments

Comments
 (0)