Skip to content

feat(wrap): openadapt wrap -- COMMAND wraps any agent process - #2407

Open
abrichr wants to merge 25 commits into
mainfrom
claude/wrap-command
Open

abrichr wants to merge 25 commits into
mainfrom
claude/wrap-command

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What this does

openadapt wrap --task TASK --param NAME=VALUE -- COMMAND ... runs your own agent, any program, for the first run instead of OpenAdapt's built-in agent. Stacked on #2406 (openadapt wrap --example); retarget to main after #2406 merges.

  1. OpenAdapt opens the task's app in its own headless browser and starts COMMAND with three variables: OPENADAPT_MCP_URL (a streamable-HTTP MCP endpoint on 127.0.0.1), OPENADAPT_MCP_TOKEN (a random per-run bearer token, compared in constant time) and OPENADAPT_TASK (the task with its inputs).
  2. The endpoint's tools are the skill cache's browser tools (observe, click, type_text, press_key, scroll, finish), behind compile-agent's harness: the save gate, a read-back of every save, the origin check, and recording. The command gets no handle to the browser itself.
  3. When the command exits, the run goes through the same record check, proposed checks, canary and admission as openadapt wrap --task. A nonzero exit is a failed capture: no program, and openadapt wrap exits with the command's status.
  4. openadapt wrap run --task TASK --param ... runs the admitted program only, with no command and no model calls. With no admitted program it exits 2 with [NO_ADMITTED_PROGRAM], or [DRAFT_NOT_ADMITTED] naming a draft that run 1 left.

Safety

  • Environment. The command gets the caller's environment without any OPENADAPT_* variable (the admission-key passphrase, OPENADAPT_FLOW_SECRET_<NAME> sign-in values, Cloud keys) and without any variable the task's verify.yaml reads: each ${NAME} reference and each *_env value, including every value of a secret_env: {slot: VAR} map, such as a database password or an API token. An unreadable verify.yaml stops the run before the command starts.
  • Process group. The command runs in its own session. --command-timeout (default 600 s) ends the whole group, and so do Ctrl-C and SIGTERM sent to openadapt wrap. The signal handlers stop the group themselves, so a signal that arrives during a browser tool call still ends the command, and every exit stops what is still running.
  • Request IDs. Without --request-id, the ID is derived from the task path, the command and its inputs (wrap-<sha256 prefix>), never generated at random, so asking for the same run again dedupes. A deduped run prints its earlier result and one stderr line saying nothing ran again and that a new --request-id runs it again (for example after a failure). A run with no command and no run still requires --request-id.
  • If the task already has an admitted program, it runs instead of the command, and a line on stderr says so.

Files

  • openadapt_flow/wrap/process.py: ProcessAgent, the token-checked MCP endpoint, the child environment, the process-group runner.
  • openadapt_flow/wrap/cli.py: -- COMMAND, wrap run, --command-timeout, the signal handling.
  • openadapt launcher: passes -- and the command through unchanged.
  • examples/wrap_command/agent.py: a small listing-driven agent with no model, used by the e2e.
  • docs/WRAP.md ("Wrap your own agent"), a CAPABILITIES.md row, and the refreshed llms-full.txt.

Tests

  • tests/e2e/test_wrap_command_e2e.py: an outside command is compiled, admitted and replayed with no model calls; a failing command makes no program and keeps its exit status; the endpoint refuses a request without the token. packages.yml runs it in the critical-e2e step.
  • tests/test_wrap_command_cli.py: argument routing, exit status passthrough, run never starting an agent, no OpenAdapt settings or verifier credentials in a real child's environment, a deterministic request ID that a retry repeats, the timeout ending the whole group, and SIGTERM and SIGINT to OpenAdapt ending the command's group, grandchild included, both directly and while the main thread is inside a browser tool call with the command on serve_while's worker thread, and the deduped-run notice.
  • tests/test_wrap_command.py: the launcher keeps the -- separator and the command's own flags.

… task

Run 1 by the built-in agent on the bundled synthetic clinic app, read back,
compiled, canaried and admitted with throwaway keys; run 2 with a new note
through the emitted MCP tool with no model calls. Emitted MCP tools now run
the program off the server's event loop, where Playwright's sync API refused
to start.
@abrichr
abrichr force-pushed the claude/wrap-command branch from 3e2ca63 to 8125f31 Compare November 21, 2026 05:58
@abrichr
abrichr force-pushed the claude/wrap-command branch from 8125f31 to 3e6eb48 Compare November 21, 2026 06:24
@abrichr
abrichr marked this pull request as ready for review November 21, 2026 06:28
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 3e6eb48

First review of this PR, stacked on #2406. Author is GitHub abrichr, not Grok. I will not merge.

What I checked in wrap/process.py and the launcher

  • The MCP endpoint binds 127.0.0.1 only. Every HTTP request to /mcp must send Authorization: Bearer <token>; the comparison uses hmac.compare_digest. Other paths return 404. The token is 32 bytes of token_urlsafe, created per endpoint, and is given to the child only as OPENADAPT_MCP_TOKEN after the environment is stripped.
  • child_environment drops every OPENADAPT_* key (case-insensitive) from the caller's environment, then adds back only the three wrap variables. I did not find another path that forwards OpenAdapt settings or credentials into the command.
  • On timeout or unexpected exception the process group is signaled (SIGTERM, then SIGKILL after 5s) when start_new_session was used on POSIX. A nonzero exit becomes CommandFailed with that status; exit 0 without finish is recorded as finished, not as a silent success of a half-run's tools.
  • The endpoint is stopped in finally. The server thread is joined and the listen socket is closed.
  • _wrap_arguments restores the -- Click consumed, but only when sys.argv after wrap matches the parsed args apart from -- separators. Otherwise it keeps the parsed list and does not invent a command from a mismatched argv.

Secondary

On Windows the child is started without a new process group, so _stop_group can kill only the direct process. That is a platform limit, not a localhost-token bypass.

Review only; I am not merging.

…openadapt[wrap]

- The qualify default-form rewrite moves to cli_forms.py and the wrap
  dispatch comment shrinks, so __main__.py stays at its 14331-line budget.
- The wrap subparser rejects abbreviated options, has a handler, and is
  routed as compile --wrap in the task view.
- anthropic leaves the launcher's base dependencies for a wrap extra; a
  missing SDK prints the one-line uvx command. Docs use that command.
- wrap/examples/ may name the bundled demo app, like the other demo paths.
- Register the example and its recorded run in the public inventory, and
  fix the CAPABILITIES link to the recorded run.
# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	tests/test_wrap_command.py
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Claude (independent reviewer)
Reviewed-Head: e49e747

Blockers

  1. Ctrl-C leaves the wrapped command running, with no timeout. ProcessAgent._run_command starts the command with start_new_session=True, so the terminal's SIGINT never reaches it. The process is waited on in serve_while's worker thread, which is a daemon thread. A KeyboardInterrupt is raised on the main thread, in the serve_while loop. That means the except BaseException: _stop_group(process) in the worker never runs, and nothing else stops the process group. I checked this at this head with BrowserTools(object()), the real ProcessAgent, and ToolEndpoint replaced by a stub. After a SIGINT to the parent, the parent exited in about 3 s and the child kept writing its marker file (4, then 10 three seconds later). After that, --command-timeout no longer applies, so an agent that retries on connection errors keeps spending its own model budget with no limit. SIGTERM to openadapt wrap does the same. Fix: stop the group from the thread that receives the interrupt, for example with a try/finally around serve_while in ProcessAgent, or a SIGINT/SIGTERM handler that calls _stop_group. Add a test that interrupts the parent and checks that the child is gone.

  2. wrap run and -- COMMAND now make up a request ID, which removes the retry guard. main used to refuse a run without --request-id ("a run requires --request-id"). Now a replay or a wrapped command gets "wrap-" + uuid4().hex. WrappedTask.call and RunStore.begin dedupe only by request ID. That rule is what makes "an interrupted owner leaves a reservation for reconciliation, never another write" hold. With a fresh ID on every call, running the same command line again after an interrupted or RECONCILIATION_REQUIRED run starts a new write on the system of record, and no reconciliation is asked for. Fix: keep requiring --request-id for wrap run, or derive a stable ID from the task and its inputs. If an ID is still generated, print it on stderr before the run starts, so the user can retry with it.

  3. The command gets read-back credentials, against the documented guarantee. child_environment removes only OPENADAPT_*. The task's verify.yaml can take its system-of-record credentials from other variable names: ${NAME} references, which verify_run expands, and sql_password_env. Those variables pass through to the agent being admitted. WRAP.md says "OpenAdapt's own keys and settings never reach it", and the process.py docstring says the same. For a REST or SQL read-back that uses a token, that statement is false: the agent gets the credential that is used to check its own work. Fix: also remove the variables the task's verifier config references. If that is out of scope, narrow WRAP.md and the docstring to "no OPENADAPT_* variable" and say that read-back credentials named in verify.yaml do pass through.

  4. The PR body describes a different change. It describes counterparty confirmations on record/run/v1, says it is stacked on Receipts: one signed record per run (replaces Seals) #2394, and says "Draft, not for merge". The title, the diff and isDraft: false are openadapt wrap -- COMMAND. Only the last paragraph is about this PR. The body is the squash message and the reviewer brief, so it has to describe what this PR does: the -- COMMAND process agent, the token-guarded loopback MCP endpoint, wrap run, the environment stripping, and the launcher's -- restoration.

  5. CI is red, inherited from feat(wrap): openadapt wrap --example, and compiled browser tools that run over MCP #2406. launcher / run-ci fails test_launcher_route_table_matches_the_engine_source, and flow core unit (shard 3/4) fails test_alias_notice_uses_registered_labels_and_never_argument_rendering[True-launcher]. Both come from the "wrap": "compile --wrap" entry in cli_tasks.FLOW_NAMES (see the feat(wrap): openadapt wrap --example, and compiled browser tools that run over MCP #2406 review). protected-safety-review fails only because the base is claude/wrap-example-cmd and not main, which is expected for a stacked PR until it is retargeted. Critical-e2e ran 70 tests with 0 skipped, so test_wrap_command_e2e.py ran.

Checked and fine

  • The endpoint binds 127.0.0.1, requires the per-run bearer token (compared with hmac.compare_digest), and returns 404 on other paths.
  • The admission passphrase (OPENADAPT_JIT_KEY_PASSPHRASE) and OPENADAPT_FLOW_SECRET_* are removed from the child's environment.
  • A nonzero exit or a timeout ends as capture_failed with no draft, and the command's status is returned.
  • If an admitted program exists, it runs instead of the command, with a notice.
  • _wrap_arguments restores -- only when the process argv matches the parsed arguments.
  • The one-line missing-SDK hint and the openadapt[wrap] spelling match feat(wrap): openadapt wrap --example, and compiled browser tools that run over MCP #2406.

Out of scope

  • Secret parameter values reach OPENADAPT_TASK exactly as they reach the built-in agent's model: placeholders with the privacy extra, raw without it. That is not new exposure, but the docs could say so.
  • --command-timeout accepts inf, which turns the timeout off.
  • The wording "so it can't act around these checks": the command runs with the user's permissions and can call the app directly. The canary still blocks admission in that case, and the doc's last paragraph mostly covers this.
  • On Windows, _stop_group kills only the direct child (already noted in the Grok review).
  • CodeQL alerts 106 to 109 (clear-text logging) point at prints of variable names, the output path and the example summary. I found no secret value in them, so I read them as false positives, but they should be dismissed with a reason.
  • No Gemini or Codex review is on this PR. The only earlier review is Grok's APPROVE at 3e6eb482. Its points still hold at this head, except where the blockers above go further.
  • windows replay (Patient Notes, WindowsBackend) fails in tests/test_windows_attempt_ledger.py, the junction tests. This PR doesn't touch that code.

tests/test_cli_documented_tasks.py holds that discovery must not invent an
engine wrap verb, and the parser entry imported the wrap package (and its
POSIX-only ledger locks) while building the parser, which broke Windows.
Drop the openadapt-flow wrap entry, its task route, its command file and
the cli_forms module that only made room for it; __main__.py is main's again.
The benchmark README no longer promises a .txt output file.
# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	packages/flow/docs/commands/01-record-and-build/wrap.md
#	packages/flow/openadapt_flow/wrap/cli.py
…ithhold verifier credentials

- Ctrl-C and SIGTERM to openadapt wrap end the wrapped command's whole
  process group (it runs in its own session, so neither reached it), and
  --command-timeout still ends the group. Tests cover both, grandchild
  included.
- A run without --request-id gets an ID derived from the task, the command
  and its inputs, never a random one, so a retry dedupes.
- Every variable the task's verify.yaml reads (${NAME} references and
  *_env values) is left out of the command's environment, as WRAP.md says.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Claude (independent reviewer)
Reviewed-Head: 33f71b9

Delta from 33cc89e73 to this head, against the last review's blockers.

Blockers

  1. A signal that lands during a browser action is still lost, and the command keeps running. _commands_stopped_on_signal depends on the KeyboardInterrupt leaving task.call. The main thread, though, spends each tool call inside BrowserTools.serve_while, running reply.set_result(job()) under except BaseException as exc: reply.set_exception(exc). An interrupt raised there, whether a real Ctrl-C or the SIGTERM handler's raise KeyboardInterrupt, goes to the MCP tool caller as that call's error. It never leaves serve_while, so stop_running_commands() never runs.

    I reproduced this at this head with the real BrowserTools.serve_while, _run_group on the worker thread (as ProcessAgent does), _commands_stopped_on_signal(True) around it, a stub harness, and a command that starts a grandchild:

    • Signal while the main thread is idle: SIGINT and SIGTERM both end the parent, and the grandchild is gone. The fix works on this path.
    • Signal during one in-flight tool call that takes 2.5 s: for both SIGINT and SIGTERM, the tool caller gets KeyboardInterrupt. Three seconds later, openadapt wrap is still running and so is the command's group.

    --command-timeout still applies in this case, so this is narrower than the original bug. But one SIGTERM from a supervisor is ignored, and the SIGKILL that follows leaves the group running with no timeout, which is the original failure. Suggested fix: stop the group in the signal handler itself. Install a handler for SIGINT and SIGTERM that calls stop_running_commands() and then raises. Alternatively, make serve_while re-raise KeyboardInterrupt and SystemExit on the main thread instead of handing them to the reply.

    Test gap: test_a_signal_to_openadapt_ends_the_wrapped_command_group runs _run_group on the main thread, so _run_group's own except BaseException: _stop_group does the kill. The test would pass if stop_running_commands did nothing. It needs _run_group on a worker thread under serve_while, with a signal sent both while idle and during a tool job. The grandchild assertion itself is right.

  2. secret_env credentials are not withheld. verify_env_names collects only str and list values under *_env keys. EffectsConfig.secret_env is a dict[str, str] from slot to variable name. It is the documented credential field for plugin verifiers, and deployment.py tells authors to put credentials there. For a dict value nothing is collected, and the recursive walk then sees slot keys that don't end in _env. I checked: a verify.yaml with secret_env: {api_token: SOR_API_TOKEN} and auth: {bearer_env: SOR_BEARER} gives ['SOR_BEARER'], and SOR_API_TOKEN reaches the child. Fix: under a *_env key, also collect the string values of a mapping. Add secret_env to the test.

  3. A failed first run can't be retried with the same command line, and nothing says why. This is new with deterministic IDs. WrappedTask.call replays any finished record, and a command that exits nonzero or times out is stored as a finished capture_failed. Say a user's agent crashes (for example, its own model key is missing), the user fixes it and runs the same openadapt wrap --task ... -- COMMAND again. They get the old capture_failed JSON with replayed: true and exit status 1 (not the command's status, because exit_code is None), and the command never starts. After a Ctrl-C, the same line returns RECONCILIATION_REQUIRED. Both outcomes may be the safe choice, since a failed command may have written. But the CLI prints nothing about it, and WRAP.md only says a retry "dedupes". Fix: print a line on stderr when a result is a replay or RECONCILIATION_REQUIRED, naming the derived request ID and saying that a new attempt needs a new --request-id. Say the same in WRAP.md.

Checked and fine

  • Timeout: _run_group still waits with timeout=timeout_s and calls _stop_group on TimeoutExpired. test_the_command_timeout_ends_the_whole_process_group checks that the grandchild is gone.
  • Request ID: request_id_for hashes the resolved task path, the command and the sorted --param values (wrap- plus a 32-hex sha256 prefix), with no randomness. An explicit --request-id is used as given, and the test covers it. A run with no command and no run still requires --request-id.
  • Withholding otherwise: the ${NAME} and ${NAME:-default} regex matches qualify.config._ENV. The generated read file keeps references unexpanded (observer_from_config returns the raw declaration), so the names are visible. Matching is case-insensitive, and an unreadable verify.yaml fails before the command starts (exit 2). bearer_env, basic_env, value_env and sql_password_env are all caught.
  • PR body: rewritten. It describes this PR: the process agent, the token-checked loopback endpoint, wrap run, environment withholding, process groups and request IDs.
  • CI:
    • Passing: launcher / run-ci, the CodeQL Analyze jobs, gitleaks, smoke and windows replay.
    • Expected failures: protected-safety-review and Evaluate protected-path evidence, because the base is claude/wrap-example-cmd until this is retargeted.
    • Still pending when this was posted: the flow unit shards, flow core critical (with test_wrap_command_e2e.py) and the other packages / jobs.

Out of scope

  • A verifier.session hook (module:function) can read any variable, and no name scan can see that.
  • request_id_for hashes only --param values. Inputs supplied through OPENADAPT_FLOW_SECRET_* don't change the ID, so a different secret value with the same params replays the earlier result.
  • SIGTERM exits 130, not 143.

…v maps; say when a run is deduped

- The SIGINT and SIGTERM handlers stop the command's group themselves, so a
  signal during a browser tool call (whose error handling keeps the
  interrupt) still ends it. Test: the command on serve_while's worker
  thread, the main thread inside a tool call, both signals.
- verify_env_names withholds every value of a *_env map such as
  secret_env: {slot: VAR}.
- A run whose derived request ID already ran prints one stderr line saying
  nothing ran again and that a new --request-id runs it again.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Claude (independent reviewer)
Reviewed-Head: eba83fe

Delta from 33f71b9d8. My three earlier blockers are fixed. One new problem, which needs a one-line wording fix, comes from the new dedupe notice.

Blocker

The dedupe notice tells the user to bypass reconciliation. RunStore.begin returns kind="replay" both for a finished record and for an unfinished one, such as an interrupted attempt that may already have saved. For an unfinished record, WrappedTask.call returns RECONCILIATION_REQUIRED with replayed: True. The new notice is keyed only on replayed. So after an interrupted run, it prints "this is its earlier result and nothing ran again. To run it again, pass a new --request-id". The first half is wrong, because there is no earlier result. The second half steers the user past the guard that the derived ID was added to keep, and a new ID can then save the record a second time.

Fix: when result["status"] == "RECONCILIATION_REQUIRED", print a different line, for example: "the earlier attempt with request X did not finish and may have saved; check the app's record before running it again with a new --request-id". Keep the current line for a finished replay. Also add the reconciliation case to test_a_deduped_rerun_says_how_to_run_again.

Earlier blockers: fixed

  1. Signal during a tool call. on_signal now calls stop_running_commands() before it raises, for both SIGINT and SIGTERM. I reran my repro at this head: the real serve_while, _run_group on the worker thread, and a grandchild.

    • Idle main thread: SIGINT and SIGTERM end the parent and the grandchild.
    • Main thread inside a 2.5 s tool call: the tool caller still gets the KeyboardInterrupt, but the grandchild is gone and the parent exits. Before this fix, both were still alive.

    The new test_a_signal_during_a_browser_tool_call_still_ends_the_command blocks the main thread in a queued job(), which is the faithful path.

  2. secret_env maps. The values of a *_env mapping are now collected, and the test covers secret_env: {token: ..., key: ...}.

  3. Silent replay. A derived-ID replay now prints a line on stderr. An explicit --request-id gets no notice. The one problem is the reconciliation case above.

RLock and running the handler from a signal

  • Reentrancy is needed and safe. Python runs the handler on the main thread between bytecodes. The main thread holds _RUNNING_LOCK only inside stop_running_commands. A second signal during the finally block's call would deadlock on a plain Lock. With the RLock it re-enters, copies the set (one list() call), stops the groups and raises, and the outer with releases on unwind.
  • No deadlock with the worker. The worker holds the lock only for add and discard and never waits on the main thread, so a handler that blocks on it waits only briefly.
  • Waiting inside the handler. _stop_group can block for up to twice _TERM_GRACE_S (process.wait) inside the handler. That only stalls the main thread, which is shutting down anyway. A concurrent Popen.wait on the worker is safe because a timed wait takes _waitpid_lock without blocking.
  • Nit: if a second signal lands during the finally block, its KeyboardInterrupt skips restoring the previous handlers. The process is exiting, so this is harmless.
  • Nit: installing a SIGINT handler replaces an inherited SIG_IGN, for example in a background job of a non-interactive shell. The previous handler is restored on exit.

Behavior worth knowing (not blocking)

  • Interrupt during a tool call. When the interrupt is swallowed by serve_while, the run does not exit 130. The killed command becomes a finished capture_failed, the run exits 1, and a rerun with the same ID replays it, with the notice.
  • Grandchildren that outlive the command. This predates the PR. _stop_group returns early when process.poll() shows that the direct child has exited. A grandchild that ignores SIGTERM therefore survives if the direct child exits within the grace period, because no SIGKILL reaches the group.

CI

CI had just started on this head: 12 checks pending, none failed yet. Judge the result by CI. The shared venv has no pytest, so I did not run the unit tests locally.

…, not rerun

RECONCILIATION_REQUIRED means the earlier attempt may have saved, so the
deduped-run notice (pass a new --request-id) could lead to a second save.
That case now prints its own line telling the user to check the record in
the app before rerunning; the rerun line stays for finished replays only.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude (independent reviewer)
Reviewed-Head: f5e314a

Delta from eba83fe97: one commit, f5e314a02. It fixes the last blocker.

What I checked

  • The fix. With a derived ID and status == "RECONCILIATION_REQUIRED", the run now prints only the line "the earlier attempt may have saved; check the record in the app before rerunning with a new --request-id". The "already ran ... To run it again" line is now an elif, so the two lines never appear together. A finished replay keeps the earlier line. An explicit --request-id gets neither line.
  • The new test. test_an_interrupted_earlier_attempt_never_suggests_a_new_request_id_first returns replayed: True with RECONCILIATION_REQUIRED. It asserts that the new line is printed and that neither "already ran" nor "To run it again" is.
  • The docs. WRAP.md states the same rule: check the record first, because a new ID could save twice.
  • New bugs. I found none. The change only touches output on stderr. The JSON on stdout and the exit status are unchanged.

Nit (non-blocking)

The check is on the status, not on replayed. A fresh run can also end as RECONCILIATION_REQUIRED: WrappedTask.call returns it when its own attempt raises after it may have written. In that case the line says "an unfinished earlier attempt" when it means this attempt. The advice is still the safe one; only the wording is off.

CI

CI had just started on this head: 12 checks pending and none failed yet. Merge once they are green. protected-safety-review will keep failing until this PR is retargeted to main after #2406 merges.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude (independent reviewer)
Reviewed-Head: 6797fe8

Delta review against the previous approval at f5e314a.

What I checked:

  • git diff f5e314a0 6797fe8d touches one file, packages/flow/openadapt_flow/wrap/cli.py, 5 lines added and 5 removed, all inside _commands_stopped_on_signal. There is one commit in the range (fix(wrap): type the saved signal handlers by signal, for mypy).
  • The dict annotation changes from dict[int, Any] to dict[signal.Signals, Any]. The keys come only from the tuple (signal.SIGINT, signal.SIGTERM), which are signal.Signals members, so the new annotation is accurate. It is annotation only and has no runtime effect.
  • The loop variable signum is renamed to caught in both the install loop and the restore loop. It no longer shares a name with the signum: int parameter of the nested on_signal handler, which is unchanged. Nothing else refers to the old loop variable.
  • Signal handling is unchanged. The same two signals are trapped, the same handler is installed only on the main thread, stop_running_commands() still runs in finally, and the saved handlers are restored from the same dict in the same order. signal.signal accepts signal.Signals values, so the calls behave exactly as before.
  • The signal module import at module level is still in place and is not shadowed.

The delta is the typing fix the author described. Strictly it is 5 changed lines, not 1, but they are all the same rename plus the annotation. I found no behaviour change and no new risk.

# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	packages/flow/public-artifacts.json
#	uv.lock
# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
Base automatically changed from claude/wrap-example-cmd to main November 23, 2026 07:34

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