Skip to content

refactor(codex): deny native child spawns outside runner policy - #8122

Merged
waynesun09 merged 7 commits into
fullsend-ai:mainfrom
dhshah13:refactor/6970-codex-spawn-guard
Oct 8, 2026
Merged

waynesun09 merged 7 commits into
fullsend-ai:mainfrom
dhshah13:refactor/6970-codex-spawn-guard

Conversation

@dhshah13

@dhshah13 dhshah13 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With harness security on, codex runs a fullsend handler before any spawn or resume tool.
Inert until PR 6: [agents] enabled = false (#7829) leaves codex with no spawn tool, and no role
is registered yet, so the handler is written but no run reaches it.

Related Issue

Part of #6970. Implements the enforcement of ADR 0126 (#7827). Replaces the guard part of the
closed #7809.

Changes

  • internal/runtime/codex_hook/fullsend-codex-hook.py: the SpawnGuard mode re-checks hooks.json and the role files against the runner-held digest set (agents/ must hold exactly the registered files), then admits only a V1 spawn from the root thread of a registered role with fork_context: false (absent is denied) and no model or reasoning_effort key, whatever its value. Everything else, its own errors and its own deadline below codex's handler timeout included, is exit 2 with a reason on stderr; an admission is recorded in the findings log (codex_spawn_guard_admit).
  • internal/runtime/codex_config.go: hooks.json gets the guard group first, also with every sandbox hook off (matcher ^(multi_agent_v1|collaboration)|(spawn|resume)_agent$, adapter mode SpawnGuard). On review request, codexTOMLString renders a value with newlines as a TOML multi-line basic string, with the same escaping; the renderer's table and the TOML round-trip test cover both forms. The project table key stays single-line (codexTOMLKey), since a table header cannot hold a multi-line string.
  • internal/runtime/codex_integrity.go, codex_run.go: RoleFiles on the runner-held digest set; FULLSEND_CODEX_SPAWN_DIGESTS exported after .env next to the hook-script digests.
  • internal/runtime/codex_golden_test.go, testdata/codex/golden/*: config.toml, hooks.json and the launch command pinned byte for byte (commit 1, from main); the later commits add the guard group to both hooks.json goldens and one line to the launch command, and regenerate config.toml for the multi-line strings. go test ./internal/runtime/ -run TestCodexGolden -update regenerates them.
  • internal/runtime/codex_config_test.go, codex_hook_test.go, codex_integrity_test.go, codex_run_test.go: one deny row per rule and error branch (35), the admit cases, the matcher and its position, the export fragment. TestCodexHooksJSON_SecurityDisabledPlanRendersNothing becomes TestCodexHooksJSON_AllHooksOffKeepsSpawnGuard, TestCodexHooksJSON_DefaultPlan skips the guard group and TestBuildCodexRunCommand_OrderAndFlags counts one more hooks.json digest; the adapter tests (TestCodexAdapter*) are unedited.
  • docs/contributing/runtime-implementation.md: the guard group, the role-file anchor, the variable, the re-check row.

Points of interpretation, for a maintainer to correct (what the ADR does not say): agent_type
present but not a string is denied, like an unregistered role; the ADR recognises a child by the
agent_id in its hook payload, and the guard also treats a top-level agent_type as that marker
(the pinned CLI sends both in a child's payload and neither in the parent's).

Testing

  • make lint passes (staged first)
  • Tests added or updated: go test -race ./internal/runtime/, make script-test. Every new test was seen failing before its code existed; the golden test was also failed by hand with a changed template value.
  • Base: origin/main at cb9825e6.
  • Patch coverage (go tool cover -func): codexHooksJSON, codexSpawnDigestsValue, buildCodexRunCommand at 80% or more. About 1250 added lines: about 340 production, the rest tests, goldens (about 230 generated lines) and docs.

Checklist

  • Title follows Conventional Commits
  • Commits are signed off
  • I wrote this contribution and can explain every change

🤖 Generated with Claude Code

Golden files rendered from the current code, with no production change,
so the commits that follow show their effect on the rendered files as a
diff. Each SHA-256 in a launch command is stored as <sha256>; a command
is stored one fragment per line. Regenerate after an intended change with
go test ./internal/runtime/ -run TestCodexGolden -update.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
With harness security on, hooks.json starts with one PreToolUse group
whose matcher covers codex's two multi-agent namespaces and any bare
spawn_agent or resume_agent name, and whose handler is the embedded
adapter in a SpawnGuard mode (ADR 0126). The group is written whenever
hooks.json is, with every sandbox hook off included. Inside the matched
set the handler is deny-by-default: it admits a V1 spawn from the root
thread of a registered role with fork_context false and no model or
reasoning_effort argument, passes the V1 wait, close and send_input
through from the parent, and denies everything else, its own errors
included, with exit 2 and a reason on stderr. An admission is recorded
in the findings log with the spawn's tool_use_id and role. No role is
registered yet, so every spawn is denied, and [agents] enabled = false
leaves codex with no spawn tool to reach the handler.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
The runner-held digest set gains RoleFiles, role name to digest of
agents/<name>.toml, and the launch command exports it with the
hooks.json digest as FULLSEND_CODEX_SPAWN_DIGESTS, after .env and next
to the hook-script digests. Before it applies the policy, the spawn
guard re-hashes every listed file and requires agents/ to hold exactly
the registered role files: codex reads both again when a child starts,
so the launch-time guard does not cover a child. It denies on its own
deadline, below the hooks.json timeout at which codex kills a handler
without blocking, and reads only regular files under the adapter's size
cap, so a stalled or swapped file denies the spawn. Nothing registers a
role yet; the value is hooks.json alone and every spawn is denied.

The findings log is written with a non-blocking open and only when the
path is a regular file, the way the digest reads work: every deny, the
deadline handler included, records itself before block(), and a FIFO
planted at the log's path under the workspace would otherwise stall the
deny past codex's timeout, which does not block.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Guard Codex child spawns with runner-held policy and file digests

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add a fail-closed hook that restricts native Codex spawns to registered, runner-governed roles.
• Recheck spawn-relevant files before admission and record decisions in the findings log.
• Pin rendered configuration and launch commands with goldens; test admission, denial, and timeout
 paths.
Diagram

graph TD
  R["Runner digests"] --> L["Launch exports"] --> G["Spawn guard"] --> P{"Policy valid?"} -->|Admit| C["Codex child"]
  H["Hook wiring"] --> G
  F["Hooks and roles"] --> G
  P -->|Deny| D["Exit 2 block"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Runner-brokered spawning
  • ➕ Keeps authorization outside Codex's hook timeout and fail-open behavior.
  • ➖ Requires a runner-owned dispatch path or upstream integration not provided by this PR.
2. Keep native agents disabled
  • ➕ Prevents native child spawns without relying on a hook.
  • ➖ Cannot support governed Codex sub-agents when roles are registered.

Recommendation: The hook is a reasonable enforcement layer for the planned role support while native agents remain disabled. Retain the existing agents-disabled setting until that support is ready, and consider runner-brokered dispatch if an integration becomes available that avoids Codex's hook-timeout fail-open behavior.

Files changed (15) +1254 / -33

Enhancement (3) +61 / -3
codex_config.goWire SpawnGuard first in Codex PreToolUse +31/-3

Wire SpawnGuard first in Codex PreToolUse

• Renders a dedicated guard handler before sandbox hook groups, including when every sandbox hook is off. Its matcher covers native multi-agent namespaces and bare spawn or resume names.

internal/runtime/codex_config.go

codex_integrity.goTrack registered role-file digests +7/-0

Track registered role-file digests

• Extends the runner-held digest set with a role-name-to-digest map for future Bootstrap registration and spawn checks.

internal/runtime/codex_integrity.go

codex_run.goExport spawn digests in the Codex launch command +23/-0

Export spawn digests in the Codex launch command

• Serializes hooks.json and registered role digests and exports them after .env when hooks are enabled, alongside hook-script digests.

internal/runtime/codex_run.go

Bug fix (1) +244 / -12
fullsend-codex-hook.pyEnforce spawn policy in the embedded adapter +244/-12

Enforce spawn policy in the embedded adapter

• Adds SpawnGuard mode with role and hooks-file verification, root-only V1 spawn admission, parent-only V1 pass-through tools, and deny-by-default handling. Adds an internal deadline, nonblocking findings writes, and admission records.

internal/runtime/codex_hook/fullsend-codex-hook.py

Tests (10) +932 / -17
codex_config_test.goTest guard placement and matcher coverage +61/-16

Test guard placement and matcher coverage

• Checks the handler command, first position, uniqueness, matcher behavior, and presence when sandbox hooks are off.

internal/runtime/codex_config_test.go

codex_golden_test.goAdd Codex rendering golden tests +128/-0

Add Codex rendering golden tests

• Pins rendered config, default and all-off hooks, and launch commands with hooks enabled or disabled. Provides an update flag and normalizes SHA-256 values in command snapshots.

internal/runtime/codex_golden_test.go

codex_hook_test.goExercise spawn admission and fail-closed branches +456/-0

Exercise spawn admission and fail-closed branches

• Runs the adapter against registered roles and malformed, tampered, unauthorized, or stalled inputs. Verifies Codex-compatible exit and stderr behavior, deadline enforcement, and admission findings.

internal/runtime/codex_hook_test.go

codex_integrity_test.goPin spawn digest-map serialization +30/-0

Pin spawn digest-map serialization

• Tests the sorted environment-value format for hooks.json alone and for multiple registered roles.

internal/runtime/codex_integrity_test.go

codex_run_test.goVerify spawn digest export timing and scope +32/-1

Verify spawn digest export timing and scope

• Checks digest placement after .env and before Codex launch, and its absence when hooks are disabled. Adjusts the expected hooks.json digest count.

internal/runtime/codex_run_test.go

config.tomlPin rendered Codex configuration +41/-0

Pin rendered Codex configuration

• Adds a byte-for-byte baseline for the agent's generated config, including the currently disabled native-agent setting.

internal/runtime/testdata/codex/golden/config.toml

hooks-all-off.jsonPin guard-only hook configuration +17/-0

Pin guard-only hook configuration

• Captures the generated hooks file when sandbox hooks are all off but harness security still writes SpawnGuard.

internal/runtime/testdata/codex/golden/hooks-all-off.json

hooks-default.jsonPin default hooks with SpawnGuard first +57/-0

Pin default hooks with SpawnGuard first

• Captures the guard before the default PreToolUse sandbox hook groups.

internal/runtime/testdata/codex/golden/hooks-default.json

launch-hooks.txtPin hooks-enabled launch command +83/-0

Pin hooks-enabled launch command

• Captures integrity checks and the new spawn-digest export in a fragment-per-line snapshot with digest placeholders.

internal/runtime/testdata/codex/golden/launch-hooks.txt

launch-nohooks.txtPin hooks-disabled launch command +27/-0

Pin hooks-disabled launch command

• Captures the launch path without hooks or a spawn-digest export.

internal/runtime/testdata/codex/golden/launch-nohooks.txt

Documentation (1) +17 / -1
runtime-implementation.mdDocument spawn-hook policy and integrity anchors +17/-1

Document spawn-hook policy and integrity anchors

• Describes guard ordering, matcher coverage, role-file digests, deadline behavior, and audit findings. Records the Codex behaviors on which enforcement depends.

docs/contributing/runtime-implementation.md

@dhshah13 dhshah13 added the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 6, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 8:26 PM UTC · Ended 8:31 PM UTC

Commit: ce5526e · View workflow run →

@qodo-code-review

qodo-code-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Go coverage drops can pass CI ✗ Dismissed
Description
The new launch command exports an additional digest and changes the Go runtime path, while CI
measures only the current branch's aggregate coverage. Because no base-branch comparison or
one-point drop check exists, a coverage regression larger than the permitted limit can still pass.
Code

internal/runtime/codex_run.go[R400-401]

+		parts = append(parts, "&& export "+codexSpawnDigestsEnv+"="+
+			shellQuote(codexSpawnDigestsValue(digests)))
Relevance

●●● Strong

Explicit coverage-regression rule requires base comparison; aggregate PR coverage alone cannot
enforce it.

PR-#2069

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed run command introduces new Go execution behavior. The workflow computes and uploads only
the PR branch's coverage profile; it has no base-branch checkout, baseline coverage value,
comparison, or one-percentage-point failure condition.

Rule 1062048: Enforce Go project test coverage regression limit (≤1% drop vs base)
/internal/runtime/codex_run.go[400-401]
/.github/workflows/lint.yml[47-60]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR changes Go runtime behavior, but CI does not compare total Go coverage with the base branch. A regression greater than one percentage point can therefore merge.

## Fix Focus Areas
- internal/runtime/codex_run.go[400-401]
- /.github/workflows/lint.yml[47-60]

## Recommended Fix
Add a CI step that checks out or otherwise measures the base branch with the same project-wide Go coverage command, computes current coverage on the PR branch, and fails the required job when `base_coverage - current_coverage > 1.0`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. New Go logic has no patch coverage gate ✗ Dismissed
Description
The new Codex runtime wiring adds executable Go logic, but the CI workflow only generates and
uploads an aggregate coverage profile without calculating coverage for changed lines. Newly added
branches can therefore merge without meeting the required 75% patch floor or the 80% target.
Code

internal/runtime/codex_config.go[R416-419]

+	cfg.Hooks[string(security.HookPhasePreToolUse)] = []codexHookMatcherSet{{
+		Matcher: codexSpawnGuardMatcher,
+		Hooks: []codexHookEntry{{
+			Type:    "command",
Relevance

●●● Strong

Explicit coverage rule targets changed Go lines; current CI only uploads aggregate coverage without
enforcing thresholds.

PR-#2069

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed runtime configuration adds a new executable hook group and command. The CI workflow runs
go test -race -coverprofile=coverage.out ./... and uploads the resulting aggregate profile, but
contains no patch-line coverage calculation or 75%/80% threshold enforcement.

Rule 1062047: Enforce minimum patch test coverage for changed Go lines
/internal/runtime/codex_config.go[416-423]
/.github/workflows/lint.yml[47-60]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds executable Go logic, but CI does not calculate or enforce coverage restricted to changed Go lines. This allows new logic to merge below the required patch coverage thresholds.

## Fix Focus Areas
- internal/runtime/codex_config.go[416-423]
- /.github/workflows/lint.yml[47-60]

## Recommended Fix
Generate a coverage profile for the full Go test suite, compute coverage for the changed Go lines with a patch coverage tool or equivalent script, and fail the required CI job below 75% while reporting the 80% target when it is not met.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Stalled hook input can allow a spawn ✗ Dismissed
Description
main() reads and parses the entire hook payload before dispatching to run_spawn_guard(), where
the fail-closed deadline is first armed. If that read stalls past Codex’s handler timeout, Codex
kills the hook without treating it as a block, so the spawn proceeds without a guard decision.
Code

internal/runtime/codex_hook/fullsend-codex-hook.py[R972-976]

+    if phase == MODE_SPAWN_GUARD:
+        # The raw payload, before tool-name translation: the policy is written
+        # in codex's own names, and a child's payload is told apart by fields
+        # the translation does not touch.
+        run_spawn_guard(hook_input)
Relevance

●●● Strong

Security hook deadlines must cover all blocking I/O; recent Codex fail-open findings were accepted.

PR-#6952
PR-#7726

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new dispatch happens only after the pre-existing stdin read, while the newly added alarm is
armed inside the dispatched function. The adapter documents that a hook killed at Codex’s timeout
does not block.

internal/runtime/codex_hook/fullsend-codex-hook.py[944-976]
internal/runtime/codex_hook/fullsend-codex-hook.py[689-705]
internal/runtime/codex_hook/fullsend-codex-hook.py[791-807]
internal/runtime/codex_hook/fullsend-codex-hook.py[99-110]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The SpawnGuard deadline does not cover reading and parsing its stdin payload. A stalled read can outlast Codex’s timeout, which does not block the tool call.

## Fix Focus Areas
- internal/runtime/codex_hook/fullsend-codex-hook.py[934-976]
- internal/runtime/codex_hook/fullsend-codex-hook.py[689-705]

## Recommended Fix
Arm the guard’s fail-closed deadline before reading stdin in SpawnGuard mode. Keep that deadline active through parsing and the policy decision, and test an input read that stalls.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (1)
4. Admitted spawns can vanish from audit ✗ Dismissed
Description
run_spawn_guard() exits successfully after log_finding() even though that function suppresses
findings-file open and write errors. When the agent-writable findings path is unavailable or
replaced with a symlink, an admitted spawn has no admission entry, and the runner does not reconcile
completed spawns against that log.
Code

internal/runtime/codex_hook/fullsend-codex-hook.py[R821-827]

+    log_finding(
+        SPAWN_ADMIT_FINDING,
+        "info",
+        f"admitted spawn tool_use_id={hook_input.get('tool_use_id')} agent_type={role}",
+        "allow",
+    )
+    signal.setitimer(signal.ITIMER_REAL, 0)  # see block()
Relevance

●●● Strong

Recent security precedents accept fail-open audit and integrity gaps in this Codex hook.

PR-#6952
PR-#7726

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new allow path does not check its audit write. The logger suppresses filesystem errors, and the
runner’s post-run findings handling does not detect a missing admission entry.

internal/runtime/codex_hook/fullsend-codex-hook.py[399-420]
internal/runtime/codex_hook/fullsend-codex-hook.py[820-828]
internal/cli/run.go[2740-2778]
internal/runtime/codex_progress.go[472-488]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new spawn-admission path allows a spawn even when writing its only admission audit entry fails.

## Fix Focus Areas
- internal/runtime/codex_hook/fullsend-codex-hook.py[399-420]
- internal/runtime/codex_hook/fullsend-codex-hook.py[820-828]

## Recommended Fix
Make the admission log write report whether the complete entry was written, and block rather than exit 0 when it was not. Preserve best-effort logging for denial paths, which must still block if the log is unavailable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. Audit log can show a denied spawn as admitted ✓ Resolved
Description
run_spawn_guard writes the codex_spawn_guard_admit finding and only then clears the SIGALRM
timer with signal.setitimer(signal.ITIMER_REAL, 0). If the deadline passes in that gap,
_spawn_guard_deadline_passed logs a block and exits 2, so codex denies the spawn even though the
findings log already holds an admit record. The runner's after-run check, which matches admit
records against completed spawns, would then see an admitted spawn that never ran.
Code

internal/runtime/codex_hook/fullsend-codex-hook.py[R821-828]

+    log_finding(
+        SPAWN_ADMIT_FINDING,
+        "info",
+        f"admitted spawn tool_use_id={hook_input.get('tool_use_id')} agent_type={role}",
+        "allow",
+    )
+    signal.setitimer(signal.ITIMER_REAL, 0)  # see block()
+    sys.exit(0)
Relevance

●●● Strong

A race can create contradictory security decisions; recent Codex hook fail-open findings were
accepted.

PR-#6952
PR-#7726

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The admit log_finding call runs while the alarm armed by arm_spawn_guard_deadline is still
active, and the timer is cleared only on the line after it. The SIGALRM handler always logs a block
and calls os._exit(2), so a deadline that fires during or right after the admit write leaves both
an admit record and a block record for the same call. The SPAWN_ADMIT_FINDING comment says the
runner relies on the admit line as the record that a spawn was decided.

internal/runtime/codex_hook/fullsend-codex-hook.py[818-828]
internal/runtime/codex_hook/fullsend-codex-hook.py[678-686]
internal/runtime/codex_hook/fullsend-codex-hook.py[151-156]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The spawn guard writes the admit finding before it disarms its SIGALRM deadline. If the alarm fires in between, the spawn is denied, but the findings log already says it was admitted.

## Fix Focus Areas
- internal/runtime/codex_hook/fullsend-codex-hook.py[818-828]

## Recommended Fix
In `run_spawn_guard`, call `signal.setitimer(signal.ITIMER_REAL, 0)` right after the policy check passes and before the admit `log_finding(...)`. The decision is already final at that point, so nothing is lost by clearing the timer early. The admit write is non-blocking because the file is opened with O_NONBLOCK and must be a regular file, so the deadline no longer needs to cover it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 89 rules
✅ Skills: 5 invoked
  writing-user-docs
  writing-adrs
  check-patch-coverage
  cutting-releases
  adr-corner
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/agents (sha: d1fa32d5) — View relationship
Review mode: Auto: 🧠 Deep: Security-critical spawn enforcement spans Python, Go, configuration, integrity, and runtime paths.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread internal/runtime/codex_config.go Resolved
Comment thread internal/runtime/codex_run.go Resolved
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://8511277f-site.fullsend-ai.workers.dev

Commit: 33270aeda61839e8322241b4744420826899217e

…n admission

The admit record was written while the guard's SIGALRM deadline was
still armed. An alarm firing between the write and the disarm denied
the spawn after the findings log already said it was admitted, which
the after-run cross-check would read as an admitted spawn that never
ran. The disarm now comes first; the write itself cannot stall, since
the log is opened non-blocking and written only as a regular file.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 8:33 PM UTC · Completed 8:41 PM UTC

Commit: 11adffd · View workflow run →

Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $2.27

@fullsend-ai-review

fullsend-ai-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk: large diff driven predominantly by unit tests and golden test fixtures with no protected paths or dependency modifications, elevated churn in active runtime files, and an inert enforcement slice aligned with ADR 0126 that is safely revertible.

Previous run

Risk Assessment: moderate (2/5)

Details

Moderate risk: large diff driven predominantly by unit tests and golden test fixtures with no protected paths or dependency modifications, elevated churn in active runtime files, and an inert enforcement slice aligned with ADR 0126 that is safely revertible.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Moderate risk: large diff driven predominantly by unit tests and golden test fixtures with no protected paths or dependency modifications, elevated churn in active runtime files, and an inert enforcement slice aligned with ADR 0126 that is safely revertible.

@fullsend-ai-review

fullsend-ai-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Looks good to me

Earlier findings

  • f_0f322de77ac212b1 — reclassified; evidence: the current diff separates table-key escaping with codexTOMLKey, and TestRenderCodexConfig_ParsesAsTOML asserts decoded instruction and project-key equality.
Previous run

Review

Findings

Low

  • [scope-creep] internal/runtime/codex_config.go:218 — The incremental change switches newline-containing values to multiline TOML basic strings and updates the config.toml golden fixture. This serialization-only change is unrelated to PR 1’s spawn-policy enforcement and is not acknowledged in the PR description, which describes the config golden as pinned from main. No escaping regression was demonstrated.
    Remediation: Separate or revert the serialization-only change, or explicitly justify its inclusion and update the PR description to acknowledge the changed config serialization.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (2)

Looks good to me


Labels: The PR adds runner-owned enforcement of Codex child-agent spawning and associated sandbox security checks.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge component/runner Agent runner behavior and lifecycle security Security threat model and related concerns labels Oct 6, 2026
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rh-hemartin

Copy link
Copy Markdown
Member

Could you redo the comments and docs with "redo the comments and docs: be briefer and do not include unnecessary context in them", they are very lengthy and sometimes include context that refers to stuff a few hundred files away, which makes them a pain to read.

@rh-hemartin rh-hemartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my ignorance of this topic, looks good to me.

…trings

A value with newlines, the developer instructions first of all, was one
basic string with \n escapes, which made config.toml and its golden hard
to read. It is now a TOML multi-line basic string: the text reads as
written, and backslashes, quotes and control characters stay escaped,
so a body holding triple quotes or ending in a backslash still cannot
end the literal early. The parsed value is unchanged; the round-trip
test and the renderer's table cover both forms.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review October 7, 2026 11:41

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot removed the ready-for-merge All reviewers approved — ready to merge label Oct 7, 2026
@rh-hemartin
rh-hemartin added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
Comment thread internal/runtime/codex_config.go Resolved
codexTOMLString renders a value with a newline as a multi-line basic
string, and the project table header used the same helper, so a target
directory with a newline in its name rendered a multi-line string as
the key, which TOML does not accept. The header now uses codexTOMLKey,
the single-line form with the same escaping, and the round-trip test's
repository path carries a newline.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:46 PM UTC · Completed 12:56 PM UTC

Commit: 33270ae · View workflow run →

Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $1.78

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Oct 8, 2026
waynesun09
waynesun09 approved these changes Oct 8, 2026 •
@waynesun09
waynesun09 added this pull request to the merge queue Oct 8, 2026
@waynesun09

Copy link
Copy Markdown
Member

Validated locally at 33270ae merged with main 2150af8:

  • go test -race ./internal/runtime/ and the codex golden tests pass.
  • Live codex triage run (--runtime codex, gpt-5.6-luna, codex 0.159.3, fleet image): agent exited 0. In the sandbox, hooks.json has the SpawnGuard group first, config.toml parses with the project key single-line and [agents] enabled = false, and the hooks fired.
  • SpawnGuard run by hand in the sandbox with the image's python: exit 2 with a fail-closed reason.

The guard is inert until a role is registered, as the PR says, so the admit path is covered by the Go tests only. My earlier ProjectKey comment is addressed by codexTOMLKey.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
@ralphbean
ralphbean added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
@waynesun09
waynesun09 added this pull request to the merge queue Oct 8, 2026
Merged via the queue into fullsend-ai:main with commit b3e6b25 Oct 8, 2026
66 of 67 checks passed
@github-actions
github-actions Bot deleted the refactor/6970-codex-spawn-guard branch November 8, 2026 09:45

This branch was successfully deployed

1 active and 1 inactive deployments
dev — 33270aed Deployed Oct 8, 2026 by dhshah13 via behaviour #15847
site-preview — 33270aed Deployed Oct 8, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/runner Agent runner behavior and lifecycle ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) ready-for-merge All reviewers approved — ready to merge risk/moderate PR risk: moderate security Security threat model and related concerns

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants