Skip to content

Commit c3a003d

Browse files
caohy1988claude
andcommitted
docs: Document _healthy lifecycle (init, failure, reinit)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3221ac1 commit c3a003d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/design/code_executor_enhancements.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,13 @@ def execute_code(self, invocation_context, code_execution_input):
397397
4. **Unhealthy state on total cleanup failure** — If both `os.kill`
398398
and `container.restart()` fail, the executor sets `self._healthy
399399
= False` and returns a distinct error message. Subsequent calls
400-
should check `self._healthy` and raise early rather than queueing
401-
work against a broken container. Reinitialization (stop + start)
402-
is required to recover.
400+
check `self._healthy` and raise early rather than queueing work
401+
against a broken container. The `_healthy` lifecycle:
402+
- Initialized to `True` in `__init__` (alongside container start)
403+
- Set to `False` on total cleanup failure (kill + restart both fail)
404+
- Set back to `True` after successful reinitialization (new
405+
container created + readiness check passed via `cleanup()` then
406+
`__init_container()`)
403407

404408
5. **Container restart as last resort** — If `os.kill` fails (e.g.,
405409
insufficient permissions when Docker runs rootless), restart the

0 commit comments

Comments
 (0)