Repository navigation
Let Cursor and Codex lanes run their shell and kb without stalling - #165
Merged
Merged
Conversation
Cursor Tester lanes stopped on "Run this command? Not in allowlist" even with Shell(*). Cursor's allowlist never approves a redirect it cannot resolve (e.g. `> "$d/x"`), on 2026.11.22 and 2026.12.02 alike. Where the CLI has --sandbox, a default lane now passes `--sandbox enabled`: such a command runs in Cursor's sandbox instead of asking, allowlisted commands still run outside it, and deny rules and hooks still apply. Codex Coder lanes could not run `kb`: Kinbase opens its SQLite stores and sign-in lock for writing, which the workspace sandbox denies. The Codex profile now also allows the cache and personal folders Kinbase's own config names, and its oidc.lock file, only when they exist and are Kinbase folders below HOME. Without Kinbase the profile is unchanged. The Antigravity Orchestrator seat also allows the read-only kindex/status.
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Gates Cursor lanes into --sandbox enabled when the CLI has the flag and extends the Codex lane profile with Kinbase's config-named paths. Small, tested, profile unchanged without Kinbase; remaining issues are edge cases and a token-refresh gap.
Important Files Changed
| File | Overview |
|---|---|
| harness/codex_profile.py | New Codex profile builder adding Kinbase cache/data dirs and oidc.lock |
| harness/tmux_lane.sh | Cursor default lane adds --sandbox enabled when agent --help lists it |
| harness/tmux_lane_message.sh | Resume recomputes the profile from current env instead of launch |
| harness/agents.py | start_requires text explains the sandbox flag |
| harness/run_record.py | Antigravity seat allows read-only kindex/status |
| tests/test_codex_profile.py | Covers unchanged, Kinbase-named, and HOME-refusing configs |
| tests/test_cursor_ended_native_recovery.py | Fake agent toggles --sandbox in help; flag asserted both ways |
Findings
- kb without a user config (or data_root) writes ${XDG_STATE_HOME:-~/.local/state}/kinbase, which the profile never opens; state that limit or add it.
- harness/codex_profile.py is missing from the Makefile lint and typecheck lists (ruff and mypy both pass on it today).
- docs/HARNESS.md Cursor permissions bullets (217-236) and the CursorAgent docstring still omit
--sandbox enabledon default lanes.
Reviewed 2488390...85ea3d8 · ↻ Re-run review · View in Adapt
Read Kinbase's config from HOME, as kb in the lane does; refuse a path that is or contains the token folder; ignore a non-table config section; keep astral characters valid TOML. The launch saves the slot's profile and a resume reuses it, so the recorded digest describes the resumed turn.
kb refreshes its id token by writing a .tmp-* file in its config folder and renaming it over oidc.json under oidc.lock, so with only the lock writable it failed once the token neared expiry. The config folder is now writable, and every other entry in it (keys, secrets, config.toml) plus the names kb trusts there are pinned read-only, so a lane can refresh but cannot change, delete, replace or plant kb's keys. Verified in codex sandbox on 0.172.0 and 0.167.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Factory lanes stalled on startup in the D07 run (
d07-kit, 2026-12-02). This fixes both and adds one small read-only allowance.Cursor Tester asked before running commands
Even with
Shell(*)in the lane's.cursor/cli.json, Cursor asked "Run this command? Not in allowlist" for many commands. The cause is narrower than the allowlist format. Cursor never lets its allowlist approve a redirect whose target it can't resolve, such ascat > "$d/greet.sh", even inside the workspace. That's the shape a Tester uses to write stand-ins intomktemp -dfolders. Behaviour is the same on cursor-agent 2026.11.22 and 2026.12.02, so this isn't a new Cursor regression. Older runs just never wrote files that way.Fix: where
agent --helplists--sandbox, a default lane (FACTORY_LANE_SANDBOX=on) now passes--sandbox enabled. Such a command then runs in Cursor's sandbox (writes to the workspace and temp folders, like a Codex lane) instead of asking. Commands the allowlist approves still run outside it, so ordinary commands behave as before. Deny rules and hooks still apply.FACTORY_LANE_SANDBOX=offstill passes--sandbox disabled. The flag is kept with the turn, so resumes keep it.--forcewas ruled out because it also auto-approves every MCP tool.Codex Coder could not run
kbKinbase opens its SQLite stores and its sign-in lock for writing on every call, and the Codex workspace sandbox denied that. Kinbase's own chmod fix (kinbase#70) isn't enough on its own. The Codex lane profile (
harness/codex_profile.py, used by both launch and resume) now also allows writes to the folders Kinbase's config names for its cache and personal data, plus its config folder, because a token refresh writes a.tmp-*file there and renames it overoidc.jsonunderoidc.lock. Every other entry in that folder (keys, secrets,config.toml) and the names kb trusts there (client.key,maintainer.key,steward-*) are pinned read-only, so a lane can refresh its sign-in but can't change, delete, replace or plant kb's keys or config. Paths count only if they exist and are Kinbase-named folders below HOME. Without a Kinbase config the profile is byte-for-byte the old one.Also
The Antigravity Orchestrator seat now allows the read-only
kindex/statuscall it asked about in d07-kit.Evidence
Token refresh (Adapt finding): kb's exact refresh file operations (lock,
.tmp-*create, fsync, rename overoidc.json, fsync dir) replayed incodex sandboxon a real Kinbase folder: the previous profile fails with "Operation not permitted"; this one succeeds withoidc.jsonunchanged and mode 0600. Overwrite, delete, rename-over and planting of kb's keys and config are blocked. Same results on Codex 0.172.0 and 0.167.0.Baseline throwaway run on the installed b04c32a: the Cursor Tester asked "Not in allowlist: cat, chmod, echo, grep, mktemp, printf, rm", and the Codex Coder's
kbfailed.Same run on b04c32a plus this change: the Tester wrote 7 stand-ins with
cat > "$var/greet.sh"and got 0 prompts, and the Coder'skbreturned Kinbase results.Kinbase under this profile answers on Codex 0.167.0, 0.171.0 and 0.172.0. Cursor's
--sandboxexists in 2026.11.22 and later, and the gate skips it on a CLI without the flag.New tests: Cursor gets
--sandbox enabledonly when its CLI has the flag (fails without the change). The Codex profile is unchanged without Kinbase, adds Kinbase's paths, and refuses a config naming HOME.Full
make testgives the same result as onmain: the same 2 Codex resume tests time out on this machine in both. purity, wiring, typecheck and glossary pass.ruffreports 2 pre-existing issues onmainin files this PR doesn't touch.Not verified: Cursor versions before 2026.11.22 (none installed). Those are gated by the
--helpcheck.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.