Commit Graph

3 Commits

Author SHA1 Message Date
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00
teknium1
1f1fa9a87e fix(tools): execute_code shares the interpreter-kill rejection text; collapse redundant supervisor branch
- HOST_INTERPRETER_KILL_REJECTION is one constant in cron/lifecycle_guard;
  terminal_tool_guards and the execute_code lifecycle guard both use it,
  so an image-name kill inside a cell now names the proc_* / explicit-PID
  route instead of the generic "cannot restart or stop the gateway" text.
  One invariant test with the generic path as control.
- gateway/restart.is_supervised_gateway_launch: the callee already maps
  None to os.environ; pass environ straight through.
2026-09-18 12:49:13 -07:00
teknium1
30b22b54ae fix(tools): bound execute_code's lifecycle probe and keep the terminal guard answerable to /stop
execute_code ran the same unbounded _is_supervised_gateway_process() probe
ahead of every cell, so the wedge #111922 bounds in terminal_tool still hung
an execute_code call (and its cron slot) forever: share the cell's deadline
and fail closed with a retryable error when the probe renders no verdict.

Moving the terminal pre-exec guard onto a deadline worker made it blind to
/stop, which keys on the tool thread's ident: record the acting-for tid in a
contextvar (copied into the worker by run_bounded_sync) so is_interrupted()
on the worker honours the tool thread's bit too.

Floor the guard's share of the deadline at 30s so a short command timeout
does not turn the guard's own cold-start cost (imports, git probes under
load) into a refusal — tests/tools/test_terminal_error_redaction.py was red
on the branch for exactly that.
2026-09-15 19:09:29 -07:00