Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/cli.codex_smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,20 @@ Deno.test({
defaultRun.requestLog.includes('"method":"thread/start"'),
true,
);
assertEquals(
defaultRun.requestLog.includes('"sandbox":"workspace-write"'),
true,
);
assertEquals(
defaultRun.requestLog.includes(
'"sandboxPolicy":{"type":"workspaceWrite","writableRoots":[',
),
true,
);
assertEquals(
defaultRun.requestLog.includes('"networkAccess":true'),
true,
);
assertEquals(defaultRun.requestLog.includes('"model":null'), true);
assertEquals(
defaultRun.requestLog.includes(
Expand Down Expand Up @@ -455,6 +469,40 @@ Deno.test({
projectDocRun.argsLog.includes("project_doc_max_bytes=0"),
true,
);

await Deno.remove(mock.requestLogPath).catch((err) => {
if (err instanceof Deno.errors.NotFound) return;
throw err;
});
const yoloDeck = await writeDeck(
dir,
"codex-cli/default",
undefined,
"Smoke deck.",
"additionalParams = { gambitYolo = true }",
);
const yoloRun = await runDeck({
deckPath: yoloDeck,
codexBinPath: mock.binPath,
argsLogPath: mock.argsLogPath,
requestLogPath: mock.requestLogPath,
cwd: dir,
});
assertEquals(
yoloRun.code,
0,
formatCommandDiagnostics("run codex-cli/default yolo", yoloRun),
);
assertEquals(
yoloRun.requestLog.includes('"sandbox":"danger-full-access"'),
true,
);
assertEquals(
yoloRun.requestLog.includes(
'"sandboxPolicy":{"type":"dangerFullAccess"}',
),
true,
);
} finally {
await Deno.remove(dir, { recursive: true }).catch((err) => {
if (err instanceof Deno.errors.NotFound) return;
Expand Down
2 changes: 1 addition & 1 deletion src/decks/actions/policy_read/PROMPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ label = "policy_read"
execute = "../policy_read.deck.ts"
+++

Compute-only deck for loading policy docs under `workloops/policy/`.
Compute-only deck for loading policy docs under `memos/vault/policies/`.
4 changes: 2 additions & 2 deletions src/decks/actions/policy_search/PROMPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Your job: read and summarize the most relevant policies for an upcoming change.

Discovery flow:

1. Call `policy_read` with `path="workloops/policy/README.md"` first.
1. Call `policy_read` with `path="memos/vault/policies/README.md"` first.
2. Discover candidate policy file paths from the README markdown links.
3. Select the most relevant policy paths for the requested change.
4. Call `policy_read` for each selected policy path.
Expand All @@ -29,7 +29,7 @@ Selection rules:
- Prefer 2-3 docs by default unless a broader set is clearly needed.
- Always include `policy/deck-format-1.0.md` when frontmatter, schema, or deck
structure may change.
- If uncertain, include `workloops/policy/README.md` first.
- If uncertain, include `memos/vault/policies/README.md` first.

Response requirements:

Expand Down
14 changes: 7 additions & 7 deletions src/decks/gambit-bot/INTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
`INTENT.md` first, then make deck/file changes that implement that intent.
- `INTENT.md` and `policy/*.md` are guidance-only and must not be treated as
executable prompts.
- Treat `workloops/policy/` as a discovery mechanism for long-term behavior,
- Treat `memos/vault/policies/` as a discovery mechanism for long-term behavior,
edge cases, and documented preferences that should shape assistant behavior
over time.
- The assistant being built should be able to understand its purpose thoroughly
by relying on the guidance in `workloops/policy/` plus the current
by relying on the guidance in `memos/vault/policies/` plus the current
`INTENT.md`.
- Do not distract users with internal processes or jargon. Focus on helping
them, and avoid details that do not directly improve their understanding of
Expand Down Expand Up @@ -75,7 +75,7 @@
`packages/gambit/src/decks/gambit-bot/scenarios/`.
- Ensure guidance remains consistent with
`packages/gambit/src/decks/gambit-bot/policy/` and
`workloops/policy/templates/INTENT.md`.
`memos/vault/policies/templates/INTENT.md`.

## Activation / revalidation

Expand All @@ -90,12 +90,12 @@

### Inputs

- `workloops/policy/templates/INTENT.md`
- `memos/vault/policies/templates/INTENT.md`
- `packages/gambit/src/decks/gambit-bot/PROMPT.md`
- `packages/gambit/src/decks/gambit-bot/workloops/policy/product-command.md`
- `packages/gambit/src/decks/gambit-bot/memos/vault/policies/product-command.md`
- `packages/gambit/src/decks/gambit-bot/policy/deck-format-1.0.md`

### Related

- `packages/gambit/src/decks/gambit-bot/workloops/policy/README.md`
- `workloops/initiatives/gambit-product-command-launch/INTENT.md`
- `packages/gambit/src/decks/gambit-bot/memos/vault/policies/README.md`
- `memos/vault/vault/gambit-product-command-launch/INTENT.md`
6 changes: 3 additions & 3 deletions src/decks/gambit-bot/policy/deck-format-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ Every deck folder MUST include:
Deck folders SHOULD include:

- `INTENT.md`
- `workloops/policy/`
- `memos/vault/policies/`

Notes (recommended behavior):

- Gambit tooling looks for `INTENT.md` and MAY scaffold it if missing.
- `INTENT.md` SHOULD follow the canonical intent headings from
`workloops/policy/templates/INTENT.md`.
`memos/vault/policies/templates/INTENT.md`.
- `INTENT.md` explains **what** the deck should accomplish and why: goals,
non-goals, constraints, tradeoffs, and escalation conditions. It is the source
of truth for human alignment and for Gambit Build Assistant decisions about
Expand All @@ -209,7 +209,7 @@ Deck folders MAY include:
- `README.md` (recommended)
- `samples/` (recommended)
- `snippets/` (recommended)
- `workloops/policy/` (optional policy docs)
- `memos/vault/policies/` (optional policy docs)
- `reviews/` (optional AARs / retros)
- `actions/`, `scenarios/`, `graders/` (recommended organization only)

Expand Down
2 changes: 1 addition & 1 deletion src/decks/guides/gambit-bot-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bot creation and updates.
Required behavior

- First step for new builds: draft `INTENT.md` using the Product Command
headings from `workloops/policy/templates/INTENT.md`.
headings from `memos/vault/policies/templates/INTENT.md`.
- Ask for the minimum kickoff inputs needed to complete intent: purpose, 2-3
example user prompts, success criteria, and data sources.
- Use Deck Format v1.0 by default: `PROMPT.md` as the single entrypoint with
Expand Down
18 changes: 9 additions & 9 deletions src/providers/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,17 +629,14 @@ async function prepareCodexMcpRootDeck(input: {
};
}

function appServerThreadSandboxPolicy(input: {
function appServerSandboxMode(input: {
cwd: string;
params?: Record<string, unknown>;
}): Record<string, unknown> {
}): "danger-full-access" | "workspace-write" {
if (shouldSkipCodexSandboxConfig(input.params)) {
return { type: "dangerFullAccess" };
return "danger-full-access";
}
return {
type: "workspaceWrite",
writableRoots: [input.cwd],
};
return "workspace-write";
}

function appServerTurnSandboxPolicy(input: {
Expand All @@ -652,6 +649,9 @@ function appServerTurnSandboxPolicy(input: {
return {
type: "workspaceWrite",
writableRoots: [input.cwd],
networkAccess: true,
excludeTmpdirEnvVar: false,
excludeSlashTmp: false,
};
}

Expand Down Expand Up @@ -1444,7 +1444,7 @@ async function defaultAppServerTurnRunner(
model: model && model !== "default" ? model : null,
cwd: input.cwd,
approvalPolicy: "never",
sandboxPolicy: appServerThreadSandboxPolicy({
sandbox: appServerSandboxMode({
cwd: input.cwd,
params: input.params,
}),
Expand All @@ -1454,7 +1454,7 @@ async function defaultAppServerTurnRunner(
model: model && model !== "default" ? model : null,
cwd: input.cwd,
approvalPolicy: "never",
sandboxPolicy: appServerThreadSandboxPolicy({
sandbox: appServerSandboxMode({
cwd: input.cwd,
params: input.params,
}),
Expand Down
Loading