---
slug: the-agent-app-asks-before-it-acts
title: "The agent app asks before it acts"
tag: Security
date: 2026-10-26
published: 2026-11-17
receipts:
  - https://github.com/supernovae-st/nika/commit/a03fc0fba4190de15713bac3d9f1620643538af4
  - https://github.com/supernovae-st/nika/commit/e120fa1dc2a62d0b69b8d2521dc52fa527339731
  - https://github.com/supernovae-st/nika/commit/216f5b68d86c4c0b2e9498088e3082c52db68bf8
  - https://github.com/supernovae-st/nika/commit/5591478a70d6da18e8948f38e4e229ea660f9dfa
description: "From v0.123.2, an agent task on Codex, Claude Code or Gemini CLI is held to the workflow's permits as far as the seat allows, and pauses beyond them."
---

A Nika workflow says what it may touch in its `permits:` block: files, hosts, programs and tools. `nika check` judges the file against that block before anything runs, and the run judges each effect again.

That model has a weak spot when a task is handed to an agent application. An `agent:` task can run on Codex, Claude Code or Gemini CLI, an application you are already signed into. The engine's guide calls this a **harness seat**. The application then runs its own tools: its file edits, its shell, its fetches. Nika does not execute them, so it cannot judge each one the way it judges an `exec:` task or a built-in `nika:*` tool.

The commit that fixed it says that before the change, a Codex seat "was never held to `permits:`." The 0.123.2 release notes describe the result: "On codex-acp the session kept the adapter's default `agent` mode, whose own reviewer approves most actions, so a Codex task wrote `./out` and read files outside the project without a single `permit_checked` frame." A `permit_checked` frame is the line Nika writes in the run's journal for each permission decision. None was written: the adapter's own reviewer did the approving.

## Hold the session, judge every ask

v0.123.2 changes how Nika opens such a session. The [harness guide](https://github.com/supernovae-st/nika/blob/main/docs/usage/harness-agents.md) describes two levers.

The first acts before the prompt. The session works in the project the run was admitted for, never in whatever directory the Nika process started from. Nika selects the application's measured asking mode, the mode in which it asks before acting, and reads that mode back from the application's own answer, or refuses to start. In the notes' words, it "never picks a mode that approves on its own". For Codex that mode is `read-only`. For Claude Code it is `default`, instead of a user's `auto`. For Gemini CLI it is `default`. If the application reports a mode change during the turn, the session ends. Nika also offers the application no file or terminal methods: a call to one gets an error, and the refusal is journaled.

The second lever acts on every permission the application asks for. Inside your `permits:` grants, the ask is allowed once, never "allow always". Outside them, the run pauses with the application's question and waits for a person. Three kinds of ask pause whatever the grants say, even under `permits.exec: true`:

- network access, including Codex's SOCKS approvals, which the notes say "carry no URL and were answered `allow_once` as plain commands" before the fix;
- a request to widen the application's own sandbox (Codex `additionalPermissions`, Claude Code `dangerouslyDisableSandbox`);
- an approval for one of the application's own MCP tools, because `permits.tools` names your workflow's MCP tools, not the application's.

Paths are judged where the operating system will land. Each path is walked through every symlink and every `..`. The notes give the case that used to pass: "`out/link/../x` with `out/link` pointing outside the project was judged as `out/x` and allowed". A path that cannot be resolved now pauses.

## Running on a seat

A seat is declared in the file with `run: { access: { via: codex, protocol: acp } }` (the declaration told in [The file says how it reaches its model](/blog/the-file-says-how-it-reaches-its-model)), or chosen at launch. The harness guide of the documentation site (`guides/harness-access.mdx` in `nika-docs`) shows the launch form:

```sh
nika check flow.nika --access codex   # installed? signed in? fit for each task?
nika run flow.nika --access codex
```

On every `agent:` task a seat will run, `nika check` prints a `[harness]` hint that says what `permits:` does not cover on that seat. `nika explain harness` prints the same lesson.

When an ask falls outside your grants, the run pauses with the question in view. The guide gives the line that answers it, with `false` to refuse:

```sh
nika run --resume <trace> --answer <task>=true
```

The application is shut down at the pause. The resumed run starts the task again in a new session, and your answer decides its first ask outside the grants.

Every decision lands in the trace. Each harness task records one `permit_checked` frame for the session mode, with the decision `confine` when the measured mode was selected, then one frame per ask: `allow`, `deny` (your answer) or `escalate` (paused for you).

## v0.124.0 closed the gap 0.123.2 named

The 0.123.2 guide said that in `read-only`, Codex runs ordinary commands inside its own sandbox without asking, so a command it does ask about usually wants to run outside that sandbox, and that `permits.exec: true` admitted such a command "like any command". Its advice was to leave `permits.exec` unset.

v0.124.0, published the next day, removed the need for that advice. Its notes say Nika used to read such an ask "as `execute · <prose>`: under `permits: { exec: true }` it was allowed, and Codex fetched a site outside its sandbox." Such an ask now always pauses, with the command and Codex's reason in the question.

The same release tightened three more things:

- The pause question is one line the application cannot steer: control characters become spaces and invisible ones (direction overrides, zero-width characters) are removed, so a title cannot erase itself on your terminal.
- One `--answer` decides one ask for the task. An attempt that `retry:` replays never reuses it.
- A turn Codex could not complete now fails its task, instead of succeeding with the error as its output.

## Why it matters

Before 0.123.2, a task handed to a Codex seat inherited whatever the adapter's default mode allowed, and the boundary written in the workflow did not reach it.

Now the workflow file stays the reference for what the application asks. Nika picks the mode that asks, judges each ask against the file, writes each decision down and stops for a person on any ask the file does not grant. Where it cannot see, `nika check` says so on every such task.

## What it does not do

The guarantee holds "as far as the seat allows", in the notes' own words. What the selected mode lets the application do **without asking** never reaches Nika, so `permits:` does not bound it. The guide lists it per seat:

- Codex reads any file; writes the project, `/tmp`, `$TMPDIR` and its own `~/.codex`; runs any program inside its own sandbox, and its tools through a JavaScript "code mode"; calls its MCP tools marked `readOnlyHint: true`; opens pages with its hosted web tool, "even under `permits: {}`"; starts every configured MCP server; applies your global `~/.codex/AGENTS.md` and your Codex plugins. In the guide's words, "even with no `fs.write` grant, the project stays writable." The 0.123.2 guide already listed the reads, the writes to the project, `/tmp` and `$TMPDIR`, and the sandboxed programs; the rest was added with v0.124.0.
- Claude Code reads files in the project, runs commands it classifies as read-only and fetches documentation hosts it pre-approves.
- Gemini CLI reads files in the project, runs shell commands it judges safe reads and runs Google web searches. It only acknowledges the mode switch, and it reports a mode change only as message text, which Nika does not read.
- On `qwen-code`, `kimi-code`, `opencode`, `copilot` and `grok-build`, no mode is measured, so none is selected, and Nika judges only what they ask.

On every seat, an action Nika allows runs under the application's own sandbox, not Nika's exec sandbox, so `permits.fs` and `permits.net` do not confine it. The application's own permission rules, hooks and MCP servers still act unless they ask. A failed turn is only detected when the application reports it; one without that report still returns its error as text.

The seat's program itself is a separate question. The 0.118.0 changelog section, a tag with no public release, said that "nothing yet hashes, pins or sandboxes the seat's binary, so an executable that impersonates a seat on PATH runs with the user's rights." The 0.124.2 changelog later says that, for seats whose identity is their `initialize` answer, an adapter that "answers as another program or sits outside its version pin" is unavailable. That judges what the adapter says about itself.

The guide's advice follows from all this: "If a task must not write anything, or must not read outside the project, do not rely on `permits:` alone on a harness seat: run it on an API or local model (the native agent loop judges every tool call), or in a container or a throwaway checkout."

Read the [v0.123.2 release](https://github.com/supernovae-st/nika/releases/tag/v0.123.2) and the [v0.124.0 release](https://github.com/supernovae-st/nika/releases/tag/v0.124.0), or continue with [The run that waits for you](/blog/the-run-that-waits).
