Skip to content

Investigation: trusted native execution context for complete Codex policy #243

Closed

Description

@erickb336

Codex manual logbook task T3 tracks this investigation. Task IDs are local to the provider logbook.

Purpose and status

Parent: #88. Investigation pending; local Codex task T3 tracks it.

The complete Codex evaluator needs trusted execution context before it can enforce Sage's command, path, file-write and workflow rules. Recovering the model's original command arguments does not establish the executor's resolved settings.

This issue tracks that dependency. Installed automatic Sage remains disabled. Manual multi-agent coordination remains the selected mode. The parent retains its full workflow and gated-autopilot acceptance criteria.

Existing evidence

The verified CLI 0.160.0 command route receives Bash with only tool_input.command at the pre-tool hook. The hook's cwd remains the session directory when an explicit command workdir selects another directory. The protected transcript can supply the original requested arguments, bound to the native actor, turn and call. It does not establish the resolved shell, selected environment or inherited permission defaults.

The pinned native implementation resolves workdir against the selected environment, which can be remote. Shell selection can discover an executable rather than execute the supplied shell path verbatim. Omitted settings can inherit environment or session defaults.

Sources:

Required investigation

Identify a supported native producer and schema for the context used by the exact pending operation. Do not invent a producer, infer defaults from the policy process, or treat model-supplied fields as runtime authority.

Determine how the contract supplies or verifies:

  • The selected executor/environment identity, including local or remote execution and the filesystem namespace.
  • The effective working directory after resolution, including omitted, empty, relative and explicit workdir inputs.
  • The effective shell type, executable and invocation/login behavior.
  • The lookup settings needed by the policy, including PATH, HOME and CDPATH, and the treatment of shell startup state. Minimize disclosure; do not return credentials or a full environment dump.
  • The resolved native permission/sandbox policy and any effective permission additions.
  • The filesystem and checkout evidence needed for canonical paths, links, executable identity and current-branch checks in that same execution namespace.

Bind this evidence to the authenticated native root/session, actor, turn and tool-call identity. Establish when the snapshot is taken and how a change before execution invalidates an earlier decision. A request must not substitute another call's context.

Acceptance

  • Document the supported native producer, versioned schema, timing and trust boundary with authoritative source references.
  • Missing, invalid, stale, mismatched, unsupported or changed context refuses the protected operation. A successful policy result preserves Codex's native permission checks.
  • Verify explicit and inherited settings through the actual native runtime. Include session-cwd versus command-workdir differences and shell resolution.
  • Establish local and remote namespace behavior. Do not apply local filesystem evidence to a remote executor or silently narrow the product's supported scope.
  • Test spoofed request fields, actor/turn/call mismatches, context changes and lost evidence. Compare the policy's evidence with actual execution where safe.
  • Simulated model responses may make probes deterministic. Fabricated execution-context objects alone do not prove native support.
  • Connect the verified context to the consumed production evaluator and shared core policies. Passing fixture callbacks or an unused helper do not complete that work.
  • Preserve current Claude semantics, including its narrow plain-gh exceptions, role rules and mode-off behavior. PR Lead honesty before step 4 (T289) #140 is merged. Keep active Claude-owned Lead build step 4: the sage:lead agent file and the docs (T181) #119, Mode switch: an off request a few words after the on phrase never turns the mode on (PR #104 follow-up) #105 and T198: Investigate merges and pushes that bypass the command tools #67 separate; recheck ownership before implementation.
  • Retain required filesystem sandbox protection and state the limits of static command analysis. Context metadata cannot prove arbitrary programs harmless.

Separate upstream dependency

openai/codex#41979 requests fail-closed handling when a pre-tool hook fails, times out or cannot deliver a valid result. It does not provide resolved execution context. Both dependencies matter before installed activation can be safe.

Record whether a separate upstream schema request is needed after this investigation. No upstream request or publication is authorized by this issue creation alone.

Released-source refresh: 0.163.0

The command handler still supplies only command in the Bash hook input. The hook request still uses host-local environment cwd with a turn-cwd fallback; the input schema does not supply the resolved execution tuple.

This checks the latest released source at this refresh, not a native 0.163.0 trial. Upstream #54427 remains open without a reply. Preserve refusal where required context is unavailable; no activation or default changes follow.

Source refresh: 0.166.0-alpha.6 (2026-11-06)

The outside-sandbox command guard still lacks effective execution evidence in the inspected official source, pinned to 4f093f2748667f3b0e6a07e3d4055121cbd3ce64. This is a source assessment, not an installed-runtime trial or a change to the separate local native prototype.

  • PreToolUse exposes caller identity and requested tool input, without the selected execution sandbox.
  • PermissionRequest also lacks the effective sandbox and tool-use ID. permission_mode reflects approval policy, not sandbox state.
  • Correction to the earlier cache assumption: command permission hooks run before the approval-cache lookup. Cached approval can therefore reach the hook. This improves event coverage but does not expose execution state.
  • The orchestrator selects the actual SandboxAttempt later. Skipped approval and retries also prevent PermissionRequest from covering every effective attempt.
  • Negotiated MCP sandbox metadata describes its MCP call. It does not attest a separate native command attempt.

Keep the owner's original outside-sandbox-only scope. Do not infer effective execution from requested escalation, approval policy or an unrelated MCP call, and do not extend the rule to sandboxed commands without a product decision.

Upstream #54427 remains open. The required producer must bind effective context to the command and each execution attempt, covering fresh/cached/skipped approval, no-sandbox operation, retries and executor-managed execution. Then verify backend/source parity and harmless native enforcement cases. The inspected evidence does not establish that contract; it is not a claim that every possible API was excluded.

No production patch, installed update, activation or guard relaxation follows from this assessment. The owner-message autopilot cancellation gap remains separate.

Activity

  1. added
    codex
    on Oct 15, 2026
  2. erickb336 commented on Oct 15, 2026

    @erickb336
    OwnerAuthor

    Released-source audit for Codex-local T3: neither reviewed release provides the complete runtime-resolved execution context through the pre-tool hook. This is source inspection, not native proof of a new capability.

    Exact available evidence

    Correction to the cwd description

    The hook cwd is not necessarily the session cwd. tool_hook_cwd uses local_environment_cwd() and falls back to turn.cwd. It deliberately retains a host-local fallback for remote environments. This is not the command's resolved workdir, which the handler resolves separately. The pinned 0.160.0 hook construction uses the same helper boundary.

    Why the other inspected surfaces do not close the gap

    • The hook schemas expose no resolved shell/login mode, PATH, executor identity, command workdir, or effective sandbox grants.
    • permission_mode is a coarse approval-policy label: Never maps to bypassPermissions; several other policies map to default. It is not an attestation of effective execution permissions.
    • PermissionRequest is not a replacement. Its serialized schema lacks tool_use_id, and its Bash payload contains command and optional description. It does not provide the complete tuple for every call.
    • The execution runtime can modify PATH and shell arguments during later launch preparation. Internal runtime and network-approval structures hold additional values, but the inspected source does not expose them through a supported external pre-execution surface for every call.

    Protected transcript recovery can authenticate the requested arguments for an exact call. It cannot turn those requests into proof of runtime-resolved values or fill omitted defaults. These are separate evidence boundaries.

    Planning result

    Retain refusal when required execution context is unavailable. Complete evaluation needs a verified upstream pre-execution interface or a separately approved execution boundary. Do not implement a synthetic contract or producer and treat it as native support.

    No source changes, tests, native runs, upstream publication, or new tasks occurred in this audit. Native compatibility and complete evaluation remain unverified. All parent activation blockers remain in place.

  3. erickb336 commented on Oct 15, 2026

    @erickb336
    OwnerAuthor

    Published the approved upstream request: openai/codex#54427

    It links the existing workdir and permission-context reports. The evidence is scoped to the 0.162.1 source audit; newly released 0.163.0 has not been tested in this investigation. This tracking issue remains open pending a supported contract and Sage integration.

  4. erickb336 commented on Oct 21, 2026

    @erickb336
    OwnerAuthor

    T26 diagnostic update: actual CLI 0.160.0 provides a possible controller-owned execution backend through standalone stdio exec-server. Safe local controls verified native filesystem and process sandbox behavior.

    A permitted file write produced the expected bytes. A read-only replacement returned EPERM and left those bytes unchanged. Two fixed Node workers used explicit argv vectors without a shell: both reported macosSeatbelt; the read-only worker returned EPERM/exit 23 without changing the file, and the write-permitted worker exited 0 with the exact expected effect. Both process/closed events and service/stdio closure were observed. All fixtures were removed. No paid inference or external effect occurred.

    Independent diagnostic code review found a final-evidence-read cleanup hazard in the reusable harness. New versioned harnesses repaired it; both normal controls and both actual-service injected-read-failure controls passed. Repair review is clean. Historical failed attempts and original source bytes remain retained.

    This does not complete this issue. The supplied policies were synthetic fixture inputs, not the selected owner's native permission profile. A trusted adapter still needs to bind the actual argv/cwd/environment/permissions and native request identity, preserve approvals, and enforce role/task/gate/common ownership before effects. The service permits omitted sandbox contexts and must not become a generic model-facing RPC path. Model-host startup/tool isolation remains separate in #295; remote namespace and abrupt-loss recovery remain unverified. No production/default or Claude-active source changed.

  5. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    Progress: a local pinned native-host experiment now verifies an operation-specific file context path. It does not complete this issue or enable installed automatic Sage.

    The native ToolExecutor receives executing-step ToolEnvironment data, including the executor filesystem, cwd and sandbox context. The experiment passes that original context to the same native filesystem adapter.

    Four actual controlled native runs produced distinct results:

    • Allowed write: independently read file bytes changed as expected.
    • Protected write: the native filesystem returned permission denied; bytes stayed unchanged.
    • Controller refusal: no filesystem operation; bytes stayed unchanged.
    • Malformed arguments: refusal before a controller decision or filesystem operation; bytes stayed unchanged.

    All four owned processes exited cleanly. Portable evidence checks passed 16/16. Independent diagnostic review R242 found no issues within that scope and checked all 15 retained evidence hashes. Each native arm ran once, using synthetic authentication and fixed simulated model responses. These are local experiment results; no production implementation is claimed.

    Native source references at the tested revision:

    The fixture controller decision is not native user approval or Sage task admission. The custom file message does not impersonate a native dynamic-tool request. Generic command/shell resolution, native approval orchestration, remote namespaces, changed authority, task/ownership gates and production integration remain unfinished. No default, installed setting or Claude-owned source changed. The next investigation concerns a supported command admission boundary that preserves native permissions and approvals.

  6. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    The next native-adapter design now has a source-backed boundary map and fresh diagnostic review. This is a reviewed requirements checkpoint, not an implemented interface or runtime completion.

    The pinned source confirms that:

    • Direct and command-intercepted patches reach the native patch runtime; interception occurs before the command-start observer.
    • Shell snapshot/fork preparation occurs before final process launch, so a final-spawn guard alone does not cover all relevant preparation.
    • Isolated native sessions can replace the optional extension registry. A mandatory guard must survive that replacement without restoring removed optional capabilities.
    • The inspected filesystem writes use paths; retaining a patch description and filesystem object does not pin its eventual target across a policy wait.

    Independent review R244 found two medium gaps: resource identity across awaited admission, and mandatory policy inheritance across isolation. Revision2 now requires atomic protected resource consumption, deterministic alias/rename controls, separate immutable mandatory authority and empty/replacement-registry child/fork/resume controls. Fresh R245 review is clean for those corrected requirements. Both design findings are closed; their runtime capabilities remain unverified.

    Seven artifacts and thirteen pinned source hashes matched. Nine source-location checks passed; these are static observations, not execution or complete coverage tests. The original checker mistake and prior review remain preserved.

    Source references: native patch runtime, filesystem contract, isolated extension contract, thread construction.

    The recommendation is a separate local native-adapter feasibility experiment before any production distribution choice. Preserve native sandbox/approval behavior and the full issue88 scope, including command/patch, remote, ownership, routes/gates and recovery requirements. No native-core patch, installed/default change or Claude-owned edit has started. This issue stays open.

  7. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    Local native admission prototype: independently reviewed (R246), with no new findings in its bounded scope.

    • Fourteen actual native fixture cases produced five allowed file changes and nine refusals. These include direct and intercepted patch calls, isolated roots, missing/error evaluators, native permission denial, native approval denial, and native approval followed by an evaluator veto.
    • Portable evidence checks pass 42/42. These checks use retained event records and actual file results; they are not 42 native trials.
    • A separate intentionally broken native binary ignored the evaluator refusal. It changed the file, and the observer rejected that result. The correct source is restored.
    • The required authority lives in private session services, independent of the optional extension registry. The native runtime awaits its decision before applying the patch and retains the native sandbox and approval path.

    This is a local research prototype against a pinned native source revision, not released Codex support or full Sage autopilot. No native fork was published, installed defaults changed, or production change merged for this unit. Synthetic fixture approval is not owner approval.

    Still open: stable resource identity and atomic use, descendant/fork/resume qualification, commands and remote execution, interruption/revocation/recovery, shared Sage ownership and task gates, and release qualification. Source plumbing alone does not prove those contracts. The investigation remains open. All owned native fixture processes terminated; the reviewer started no background tasks.

  8. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    Native admission follow-up: two additional paths now have independently reviewed local fixture evidence.

    • Internal session: two actual cases create a real loaded parent and use the native internal-session producer. The isolated child retains the required evaluator. Allow writes the intended file; deny preserves both files. R248 is clean; eight portable evidence controls pass.
    • Prepared-history fork: two actual cases first complete one synthetic parent turn, then obtain and consume the native store's prepared fork. Both saved parent messages appear in the fork's model input. Allow/deny effects match the evaluator decision. Ten portable evidence controls pass. R249 found one incorrect historical count in the report; revised documents correct it, and R250 is clean.

    The initial legacy subagent setup refused paginated history before a model turn. A separate no-turn-parent attempt had one metadata item but no durable history prefix, so it was excluded from fork-history evidence. Both failures are preserved. The corrected trials each ran once; review corrections did not trigger native reruns.

    Qualified cases confirm both native sessions shut down, the owned process and streams ended, the listener closed, and temporary profiles were removed. No real model or shell command ran. No production Sage change or installed default changed, and no native fork was published.

    This remains a local prototype against pinned native source. Manager-wide evaluator inheritance does not prove AgentControl scheduling or per-assignment authority. Cold resume, abrupt recovery, stable resource identity/atomic use, commands/remote execution, shared ownership, task gates and release qualification remain open. Next: native restart/resume evidence while preserving these requirements.

  9. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    Two bounded local controller checks now have recorded evidence.

    • Graceful fresh-process resume: three actual cases across six sequential native processes restore saved messages and the same thread identity. Allow changes only the intended file; deny and missing evaluator preserve both files. Independent diagnostic review R253 is clean. Portable observer checks pass 12/12. The initial observer wrongly required another cloud-policy fetch; corrected validation of the same retained run accepts the native cache path. No native retry was used. Policy freshness and abrupt recovery remain unverified.
    • Missing-authority session refusal: the new local prototype rejects a missing required evaluator in the shared native Session constructor. Five actual cases cover normal missing authority, isolated missing authority, allow, deny and unmanaged behavior. Both missing cases send zero model/MCP requests and register no manager thread. The other cases preserve expected file effects. Portable checks pass 18/18. Independent diagnostic review R254 is clean. No native case needed a retry.

    All owned native processes, streams and fixture listeners ended. The native binaries and evidence are archived separately. No production Sage source, installed executable or default changed. This is local native research; no native fork was published and no claim of full autopilot or production qualification is made.

    The constructor refusal is later than configuration and manager preparation. It is not complete pre-bootstrap integration isolation. The new guard has not yet received live internal/fork/resume qualification; previous binaries retain their prior limited evidence. Stable resource identity and atomic use, full native agent hierarchy, arbitrary commands/remote execution, common ownership, task gates, abrupt-loss settlement and release qualification remain open. Supplied evaluator presence alone does not authenticate a Sage task. The complete investigation route remains unfinished.

  10. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    Two further controller requirements now have independently reviewed local native evidence.

    • Current guard across resume and child producers: eight actual cases across twelve processes pass. A fresh host with missing authority refuses resumed session creation before any model request, despite loading saved history. Valid authority survives isolated internal-session and prepared-fork paths. Allow/deny effects and full owned cleanup pass. Independent diagnostic review R255 is clean; portable observer checks pass 23/23.
    • Interruption during evaluator wait: direct, isolated and command-intercepted patch cases stop without a file change. The waiting evaluator future drops, the native turn reports interruption, and an actual late one-use grant is rejected. A matching allow control completes the real write. Independent diagnostic review R256 is clean; portable checks pass 20/20. Four actual native cases are distinct from those twenty checks.

    The first interruption observer had a patch-terminator typo. The native run had already stopped correctly. Corrected validation accepts its retained evidence without a native rerun; the original failed receipt and data remain preserved. The finding is fixed and closed after review.

    All owned native processes, streams and fixture listeners ended. No runtime source changed in these two units; new fixture hosts use the reviewed local constructor guard. No production Sage source, installed default or executable changed, and no native fork was published. These results do not certify the full investigation route or production autopilot.

    Still required: stable resource identity and atomic use, complete startup/integration isolation, per-assignment task/role/ownership/gate authority, full native hierarchy, commands/remote execution, abrupt-loss settlement and release qualification. Interruption while waiting does not prove rollback after an effect starts. Next, use an owned disposable fixture to observe a file replaced while admission waits, then design the executor-side remedy. Do not substitute a path recheck for a held resource capability.

  11. erickb336 commented on Oct 22, 2026

    @erickb336
    OwnerAuthor

    The local native prototype has one confirmed, unresolved target-binding failure.

    A real patch reached the policy evaluator and waited. The controlled fixture renamed its target and created a replacement at the same path, with the same starting bytes. After the evaluator allowed the operation, the native patch changed the replacement. The original file remained unchanged under its new name. The protected file also remained unchanged.

    This occurred inside the permitted disposable directory. It is not evidence of a sandbox escape. It shows that retaining the patch text and path does not retain the approved file through execution. The existing path-based executor cannot yet satisfy the proposed resource-binding requirement.

    Independent diagnostic review R257 confirms the failure and the retained evidence. The finding F-T26-PATCH-TARGET-REBIND-1 remains open/fix. One new native trial and one retained, identical-binary control support the result. The 13 passing portable checks validate the observations; they do not establish a working fix. All owned processes, streams and the fixture listener ended. The failure files remain available for review.

    The next step is an executor-side design that preserves native permissions and consumes the approved resource. It must cover parent paths, creation, deletion, move destinations and remote execution. A path recheck followed by another path lookup is insufficient. Existing read handles do not supply a prepared write capability. No remedy is implemented yet.

    No production Sage source, installed executable, setting or default changed. No native fork was published. The shipped controller still exposes no model-turn operation. Complete startup isolation, common ownership, task/role/gate authority, full native hierarchy, abrupt-loss settlement and release qualification remain separate requirements. Claude's active documentation work is excluded.

  12. erickb336 commented on Nov 9, 2026

    @erickb336
    OwnerAuthor

    Closing as obsolete. The native Codex runtime and its policy evaluator were deleted in PR #467 (T732) and PR #468 (T914). Owner decision 2026-11-09.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    codex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions