Skip to content

fix(guardrails): Codex's override file is an instruction file, ~/.codex runs code, and the pull worker reads a refusal from its body (abilityai/trinity-enterprise#978) - #4792

Open
webmixgamer wants to merge 1 commit into
devfrom
feature/978-review-round
Open

webmixgamer wants to merge 1 commit into
devfrom
feature/978-review-round

Conversation

@webmixgamer

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4782, which merged before this review round was pushed. Two of its review notes, plus what the /cso --diff pass on it found. Same issue, same ruling (instruction file names count at any depth).

Codex's AGENTS.override.md is an instruction file name. The pinned Codex CLI reads it ahead of AGENTS.md in the same folder. It was not in INSTRUCTION_FILE_NAMES, so the share tier could write it, at the top level too, and the owner's next Codex turn (run in the agent home) would load it instead of the owner's instructions. It joins the names in all three byte-identical copies: owner tier to write or delete at any depth, and an agent key needs instructions.manage.

~/.codex/ runs code. Codex has a project .codex/config.toml layer, read from its working directory above its own settings, whose MCP servers it starts as commands. Trinity keeps Codex's own state in CODEX_HOME (~/.tmp/codex, already runtime config), so ~/.codex has no platform use. .codex joins RUNS_CODE_DIRS: owner-tier write, never an agent key's. Whether Codex applies that layer to an untrusted folder was not established; this holds either way.

The agent's pull worker reads a refusal from its body (review note I2 on #4782). _PULL_STATUS_MAP mapped a bare 403 to turn_refused; item 3 reads a refusal from the typed body only, as the push and /chat paths now do. The 403 entry is gone, so a bare 403 there is agent_error, as in the async callback's map.

A CLAUDE.md inside a skill folder is instructions as well as skills (review note I1). Kept as built (the any-depth rule; Claude Code loads it when a turn works in that folder) and pinned by a test row, so writing one takes instructions.manage as well as skills.manage.

Gating

OSS-core: a fix of code that already shipped publicly (the path policy, the pull worker). No private module is edited and the submodule pointer does not move.

Changes

  • Policy (three byte-identical copies): src/backend/services/file_path_policy.py, docker/base-image/agent_server/file_path_policy.py, docker/base-image/hooks/file_path_policy.py.
  • Agent server: services/pull_worker.py.
  • Tests: test_ent978_typed_refusals_and_owner_names.py, test_ent164_self_change_grants.py, test_ent820_files_tier_census.py.
  • Docs: feature-flows/file-browser.md, requirements/auth.md, user-docs/agents/agent-files.md, and the /cso --diff report docs/security-reports/cso-diff-2026-11-26-978-typed-refusals-and-owner-names.{md,json}.

No migration. No change under src/frontend/ or src/mcp-server/. docker/base-image/ changes: agents pick up the hook copy and the pull worker when recreated on the new image; the backend copy of the policy (the Files routes) applies at once.

Test plan

  • Each new check was red first, then green: 13 for the new name and .codex (nested and top level, share and key tiers, folder delete, the census row, the grants rows), 2 for the pull worker's bare and untyped 403 (the typed 403 control stayed green).
  • Mutation: moving the name test inside the skills exclusion turns the skill-folder CLAUDE.md row red; file restored byte-identical.
  • On this branch (cherry-picked onto dev at 85dd5d143): the item, grants, census, parity, pull-worker and bug: exception text in HTTPException detail across backend and agent-server routes (py/stack-trace-exposure siblings CodeQL does not flag) #4284 suites, 706 passed.
  • test_ent926_turn_tier_hook.py cannot run on macOS (the hook's resolve() maps /home elsewhere); re-run with resolve lexical, 172 of 173 pass, the one left being the symlink case that needs realpath. CI is the judge.

Part of abilityai/trinity-enterprise#978

🤖 Generated with Claude Code

…ex runs code, and the pull worker reads a refusal from its body (Abilityai/trinity-enterprise#978)

Review round on the item 2-5 change.

- AGENTS.override.md joins INSTRUCTION_FILE_NAMES (all three byte-identical
  copies). The pinned Codex CLI reads it ahead of AGENTS.md in the same folder,
  so a person the agent is shared with could replace the standing instructions
  of the owner's Codex turns through the Files tab. Owner tier at any depth now,
  and an agent key needs instructions.manage for it.
- .codex joins RUNS_CODE_DIRS. Codex has a project .codex/config.toml layer whose
  MCP servers it starts as commands; Trinity keeps Codex's own state in
  CODEX_HOME (~/.tmp/codex), so ~/.codex has no platform use. Owner-tier write,
  never an agent key's.
- The agent's pull worker no longer maps a bare 403 to turn_refused: a refusal
  is read from the typed body only, as on the push and /chat paths (item 3).
- A CLAUDE.md inside a skill folder is instructions as well as skills (the
  any-depth rule); a test row pins it.
- /cso --diff report for this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Nightly unit-suite clean when this PR is merged into dev, all 3 seeds (head_sha: 851f2850de00eb5e604ef444b23eae50de2fec75).

@webmixgamer

Copy link
Copy Markdown
Contributor Author

The nightly comment above is the known flake in #4138 (same test, 1 of 3 seeds, no subprocess or signal code in this diff). No change made.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant