Skip to content

feat: run commands in place and delete the sandbox, task workspaces, reviewer and grants - #487

Merged
lg2m merged 24 commits into
mainfrom
feat/plan-b-run-in-place
Oct 28, 2026
Merged

lg2m merged 24 commits into
mainfrom
feat/plan-b-run-in-place

Conversation

@lg2m

@lg2m lg2m commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Change

Closes section B of the v0.1.10 plan: QQ runs commands in place, as the user, and the sandbox is gone.

  • shell and exec run in the session's working directory (the real checkout), as you, with QQ's inherited environment, the host network and your real HOME. Each command still gets its own process group (a job on Windows), timeout and cancellation kill the group, and output is captured and spilled as before. A command no longer survives a daemon restart; unfinished runs are reported as interrupted.
  • Deleted:
    • the Linux, macOS and Windows owners, plus the landlock, seccompiler, goblin, rappct, winsafe, firehazard, libproc, sysctl, nix and command-fds dependencies;
    • the command worker, with its grants, native scopes, recovery and durable job state;
    • task workspaces and publication;
    • task Git: the task_git* helpers, the helper image, the hosting brokers and the task_commit/task_push/task_pr tools;
    • the approval reviewer, approval_delegate and supervision routing;
    • every approval grant: session and workspace grants, policy.allow_tools/allow_shell_prefixes/allow_hosts/shell_env/task_hosting, --allow-tool/--allow-shell/--allow-host, and the TUI a/w keys;
    • xtask action-bias and its runbook.
  • Approval now works like this. Ask asks you about each non-read call (y/n). Auto runs everything except the fixed stops and managed denies. Full also runs the fixed stops. Read-only denies non-reads.
  • A removed config key, environment variable or CLI flag now fails with a message that names its replacement. Nothing is silently ignored.
  • Protocol 40 → 41, with regenerated v41 fixtures. Removed events still decode, as retired. Removed resolutions decode as approved_once/denied.
  • Store schema 64 → 65: drops the grant, promotion, native-owner and delegate storage, and strips the removed fields from stored summaries.
  • CHANGELOG.md has an ### Upgrading block that lists every removed key, env var, flag, tool and wire item, each with its replacement.
  • Docs, the guide and docs/plans/README.md are updated. B.3 (worktrees for parallel goals) moves to "out of scope for v0.1.10", as the plan said it waits for the fleet plan.

Lines deleted against the plan's Evidence table:

Code Plan estimate Deleted (impl + tests)
Linux owner 3.5k 3.5k
macOS owner 1.9k 1.9k
Windows owner and job fleet 2.4k 2.9k (a minimal per-command job stays, about 0.3k)
Command owner (core, binary, host worker, server) 5.9k 7.4k
Task workspaces and publication 1.9k 4.7k
Task Git, helper image and hosting brokers 6.1k 6.4k
Approval reviewer, delegate and grants part of 6.5k most of the remaining deletions

The whole diff is 326 files, about +4.3k / −56.7k.

Verification

  • cargo xtask check: passed (fmt, lint, clippy -D warnings, the workspace nextest run, doctests, minimal profile).
  • cargo xtask smoke: all 13 scenarios pass. The new run-in-place scenario shows that:
    • git status reports the workspace's own repository;
    • an ignored file under target/ survives between runs;
    • an edit is visible to a command before the run ends;
    • a loopback HTTP server is reachable through exec curl;
    • git push to a local bare remote succeeds in Auto.
  • CI runs the same four scenarios (run-in-place, run-then-undo, run-command-deadlines, permission-dispatch) on macOS and Windows in the native-run-in-place job, which runs on the merge queue, on main or with the ci:full label. Linux runs them in the main job.
  • Migration test a_schema_64_store_with_reviewer_delegate_and_grant_state_opens_and_replays: a v64 store with grants, a delegated hold, reviewer resolutions and removed events opens and replays.
  • ab1_verified_image_is_bound_and_unverified_effects_count_as_work now also checks that a verified read runs with only the base environment while unverified work inherits everything. It fails if the env rule is reverted (checked).
  • The removed-key, env-var and flag tests in qq-config and src/cli.rs assert the exact advice text.

Known impact

  • Breaking for users and clients. Commands are no longer contained in any mode. Configs that set the removed keys fail to load until those keys are deleted. Clients on protocol 40 are refused. The store migrates forward, and v0.1.9 cannot open it.
  • Goal checks now run in the checkout with the inherited environment, the same as other commands. On Windows they run through the shell runner, where before this PR they went through the deleted worker. That path is compiled and tested only by CI's Windows job; it could not be built locally.
  • macOS and Windows code was not compiled locally (Linux host, no cross targets). It is covered by the native-run-in-place CI job.
  • A managed deny_tools no longer filters grants, because no grants are left. It still filters side questions and refuses goal checks when it lists shell. To hide a tool, use policy.exposed_tools.
  • The AGENT_PROMPT_VERSION 25 → 26 bump changes recorded prompt hashes.

lg2m added 16 commits October 27, 2026 18:10
…ting and approval grants from protocol and core
… code

These files lose code that the durable worker, task workspaces, task Git
and the Linux/macOS command owners added; plan section B deletes them.
CI drops two macOS tests of the deleted owner's group check.

QQ-Allow-Revert: crates/qq-core/src/cancellation.rs
QQ-Allow-Revert: crates/qq-core/src/catalog.rs
QQ-Allow-Revert: crates/qq-core/src/sessions/claim.rs
QQ-Allow-Revert: crates/qq-core/src/sessions/tests/runs.rs
QQ-Allow-Revert: crates/qq-core/src/tools/shell/child_exit.rs
QQ-Allow-Revert: crates/qq-server/Cargo.toml
…verified reads keep a base environment; doc and dead-table cleanups
@lg2m lg2m added the ci:full label Oct 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T08:11:08.440324Z 6a68702 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75a8fa4a81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/tools.rs Resolved
lg2m added 7 commits October 27, 2026 23:21
…nts as stopped, and hold Windows goal checks to their deadline

- A command that completed but whose result overflows the run's context
  budget is committed with its real outcome; the run then stops for
  context exhaustion instead of rolling the result back to an interrupted
  placeholder.
- Linux shell teardown reuses the goal check's pidfd group confirmation,
  so a killed background child left as a zombie by a non-reaping PID 1 no
  longer fences the runtime.
- Windows goal checks stop at the check's absolute deadline instead of a
  relative timeout rounded down to whole seconds.
- Smoke: Windows scenarios get their own QQ_HOME (Windows ignores XDG_*,
  so concurrent scenarios shared one session store) and portable commands.
…arted it dies

Without the command worker, a SIGKILLed or crashed server left Unix
commands running in the checkout while restart reported their run as
interrupted and admitted new work. Each Unix command's process group now
holds a /bin/sh watcher blocked reading a pipe only the QQ process keeps
open; when QQ exits, the read ends and the watcher kills its group. It
ignores the catchable signals a script may send its own group, is killed
with the group on timeout, cancel and normal exit, and is reaped before
termination is confirmed (Darwin reports a zombie-only group as EPERM).
Windows commands already die with their kill-on-close job.

The goal-driver soak test asserted the old orphaning; it now asserts a
check killed with QQ never completes afterwards.
`LaunchNotStarted` was only raised by the deleted macOS owner, so
`confirmed_launch_failure` could never be true.

QQ-Allow-Revert: crates/qq-core/src/tools/native_exit.rs
…un-limit kills as timeouts; quote cmd text raw

Audit of guarantees the deleted worker provided:

- A cancelled run, or one stopped by its time limit, drops the event
  stream that would have carried a finished command's result, so the call
  settled as "interrupted before a durable result was recorded". Finished
  results are now kept on the run's tool tasks and persisted before
  settlement, as the worker's results were.
- The run's time limit expires the cancellation token instead of
  cancelling it, so a command it kills reports exit=timeout.
- Windows runs `cmd /D /S /C "<text>"` with the text passed raw: the C
  runtime's `\"` escaping no longer mangles quoted paths, and registry
  AutoRun no longer runs first.
- Live output holds back an incomplete trailing UTF-8 sequence until the
  next read instead of showing two replacement characters.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f359c333f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/tools/shell.rs Resolved
Comment thread crates/qq-core/src/tools/shell.rs Resolved
…aped group's id; undo ignores autocrlf

- An incomplete trailing UTF-8 sequence now waits outside the flush
  buffer. Left in it, the buffer never emptied, so an expired flush timer
  won the biased select forever and the command never read EOF.
- Linux group confirmation waits for the members it found and pins, and no
  longer sends SIGKILL to the numeric group id after the leader may have
  been reaped and the id reused. The caller already killed the group while
  the leader pinned it.
- Undo runs Git with core.autocrlf=false. Git for Windows sets it true
  system-wide, so restores turned LF into CRLF.
- Windows-only dead code that failed clippy there: an unused test helper
  and a test-only `try_wait`.
@lg2m
lg2m merged commit 4f11599 into main Oct 28, 2026
10 checks passed
@lg2m
lg2m deleted the feat/plan-b-run-in-place branch October 28, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant