Repository navigation
Conversation
This was referenced Nov 29, 2026
cmungall
force-pushed
the
cmungall/clauz3-restricted-worker
branch
3 times, most recently
from
November 29, 2026 08:22
64a01b4 to
2e23c9d
Compare
cmungall
pushed a commit
that referenced
this pull request
Nov 30, 2026
…e share a name (stablyai#52701) Check runs were keyed by suite and name, so two same-named runs in one suite shared one saved row. Every poll one of them carried a different run id than the saved row and read as a rerun, posting a new "CI green" line for the same head. Sort observed runs by run id and suffix repeated names (#2, #3) so each run keeps its own row and an unchanged read compares equal. Fixes stablyai#52700 Co-authored-by: Neil <[email protected]>
Add an optional per-agent `agentSessionModes` setting (default native). When claude is set to `clauz3-restricted`, the pty spawn choke points rewrite the launch, after `agent.launch.before`, from `claude … -- <prompt>` to `clauz3 start claude [--model M] --prompt <prompt>`. It fails closed for resumes, compound lines, unsupported agents and Windows. docs/clauz3-restricted-worker/FINDINGS.md records the end-to-end dev-build run (worker-start → proved programs approved in clauz3's web page → worker_done) and what breaks: the approver key leaking into terminal output, lost transcripts and status hooks, and the worker protocol needing a trusted orca library (spike copy included). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restricted workers now start as `clauz3 start claude --policy .clauz3/cz3tools/orca/worker-approval-policy.json …`, so routine mail to the worker's own coordinator (worker_done, status, questions) is auto-approved and everything else still goes to a person. A new optional `clauz3Command` setting pins the clauz3 build that workers run (here clauz3 PR stablyai#61's branch, until it merges) without touching the global install. Drop the spike's own cz3tools/orca copy in favour of stdlib:orca (normalform-ai/clauz3#61). Update FINDINGS with the re-run: one approval, 68 s, one worker_done, ORCA_TERMINAL_HANDLE kept through to the runner, and ORCA_AGENT_SESSION_ID unset for terminal-mode workers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With agentDefaultSurface=chat, worker-start (and new tabs, bots, automations) created a structured native-chat Claude session that never went through the clauz3-restricted PTY wrapper. A restricted agent now fails closed on every structured path: - routing: nativeChatPreferenceFor never prefers chat for a restricted agent, so chat defaults fall back to the wrapped terminal agent (also when a paired client sends its own chat default); - create: prepareStructuredAgentSessionCreateForWorktree, which every structured create goes through (tabs, agent launch, orchestration structured workers, bot chats, background chats), refuses with structured_agent_session_unsupported and a clear message, before any effect; - spawn: composeStructuredLaunch, which resolves every structured start (resume, restore, queued start of an existing chat), refuses with a pre-spawn error; - PTY: a spawn that names no agent but runs `claude` is wrapped too. clauz3-launch-paths.test.ts enumerates the launch paths, one row each. Co-Authored-By: Claude Opus 5.5 <[email protected]>
stdlib:orca moved out of clauz3 into normalform-ai/clauz3-tools-agents (PR #1, cmungall/orca-library) as cz3tools.agents.orca, with shared delegation contracts in cz3tools.agents.core. Restricted workers now start with --policy .clauz3/cz3tools/agents/orca/worker-approval-policy.json. clauz3 core is pinned to stablyai#61's (now core-only) branch through clauz3Command. FINDINGS: new setup (gh: install, then stdlib git/filesystem), item 2, and the 2026-11-29 dev-build re-run (85 s, one approval, worker_done auto-approved, default chat surface). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…blyai#61, stablyai#62 and tools-agents #1/#2 merged Co-Authored-By: Claude Opus 5.5 <[email protected]>
cmungall
force-pushed
the
cmungall/clauz3-restricted-worker
branch
from
November 30, 2026 07:31
2e23c9d to
8a00c03
Compare
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.
Phase 0 spike. Off by default, and the patch is small.
This adds two optional settings:
agentSessionModes, per agent;clauz3Command, which pins the clauz3 build that workers run.With
{claude: 'clauz3-restricted'}, every Claude launch that reaches the pty spawn choke points (runtime/spawn.ts,ipc/spawn-run.ts) is rewritten afteragent.launch.before:claude … -- <prompt>→clauz3 start claude --policy .clauz3/cz3tools/agents/orca/worker-approval-policy.json [--model M] --prompt <prompt>It fails closed. Resumes, compound command lines, other agents, Windows, and repos without the policy file all refuse rather than launching natively.
Structured (native chat) sessions fail closed too. orca#3's demo found that with the default chat surface,
worker-startstarted Claude as a structured chat, which skipped the wrapper. A restricted agent now:clauz3-launch-paths.test.tshas one test row per launch path. Restricted agents are terminal-only until clauz3 can drive native chat.Dependencies, all from main (nothing pinned to a PR branch): clauz3
main(8468da1or later: stablyai#61's Delegate event and domain-policy notices, stablyai#62's--approver-key-fd), and the agents/orca and agents/core libraries from normalform-ai/clauz3-tools-agentsmain(#1 and #2 merged), installed in the repo withclauz3 install gh:normalform-ai/clauz3-tools-agents. When the global clauz3 is older than main, pointclauz3Commandat a venv built from main:Worker protocol: the worker reports with agents/orca's
worker_done(task_id, dispatch_id, outcome, subject, summary)underonly_to_coordinator(),only_task(T, D)andprotocol_messages_at_most(n). agents/orca's worker approval policy auto-approves that routine mail.Re-tested end to end in an isolated dev build (
pnpm dev:fresh, scratch profile; the installed Orca app and the global clauz3 were not touched):worker-startstarted a restricted clauz3 worker.worker_doneprogram was auto-approved by the policy.succeeded68 s after the start, with exactly oneworker_done.Re-run on 2026-11-29 with everything from main and
agentDefaultSurface: chat(with orca#3's panel on top):worker-startfell back to a restricted terminal worker; write-and-commit was approved once,worker_donewas auto-approved, and the coordinator sawsucceeded. Details in orca#3 and FINDINGS.ORCA_TERMINAL_HANDLEreaches the program runner.ORCA_AGENT_SESSION_IDis not set for terminal-mode workers.Findings, the exact launch path and the minimal upstream hook set are in
docs/clauz3-restricted-worker/FINDINGS.md. Open issues:--approver-key-fd, and orca#3 uses it so the key never reaches the pty.clauz3 resumemapping.no_*clauses.Rebased onto upstream
stablyai/orcamainbe4d21c0c94. Tests:pnpm test src/shared/agent-launch/restricted/clauz3-restricted-launch.test.ts src/main/runtime/agent-session/launch/clauz3-launch-paths.test.ts,pnpm typecheck, andpnpm check:changed(run on the stacked orca#3 branch, which contains this one).🤖 Generated with Claude Code