···153153154154155155def test_undeclared_timeout_runs_unbounded():
156156- # A capability without a declared timeout runs with no ceiling: the jail
157157- # receives None, which the process wait loop treats as "wait forever".
156156+ # A capability without a declared timeout has capability.timeout = None.
157157+ # The broker passes this explicitly to the jail, which overrides the jail's
158158+ # own default (30s). asyncio.timeout(None) waits indefinitely, so the
159159+ # command runs with no ceiling until the process exits.
158160 jail = FakeJail(result=ExecResult(0, "hi", ""))
159161 broker = _broker(jail)
160162···518520519521 # The payload is quoted into a single argument; the injected command can't run.
520522 assert jail.exec_commands == ["echo 'hi; echo pwned'"]
523523+524524+525525+def test_validate_args_enforces_boolean_and_array_types():
526526+ params = {
527527+ "verbose": Param(type="boolean", description=""),
528528+ "items": Param(type="array", description=""),
529529+ }
530530+531531+ assert validate_args({"verbose": True, "items": [1, 2]}, params) is None
532532+533533+ error = validate_args({"verbose": "yes", "items": [1]}, params)
534534+ assert error is not None
535535+ assert "must be a boolean" in error
536536+537537+ error = validate_args({"verbose": True, "items": "not-a-list"}, params)
538538+ assert error is not None
539539+ assert "must be a array" in error
540540+541541+ error = validate_args({"verbose": True, "items": True}, params)
542542+ assert error is not None
543543+ assert "must be a array" in error
544544+545545+546546+def test_background_jail_error_is_reported():
547547+ jail = FakeJail(error=JailError("popen failed"))
548548+ broker = Broker(
549549+ _background_manifest(),
550550+ jail,
551551+ PolicyEngine(prompt=lambda *_: True),
552552+ registry=FakeRegistry(),
553553+ )
554554+555555+ result = _handle(broker, _call("run_bg", {"command": "sleep 1"}))
556556+557557+ assert result.is_error
558558+ assert "jail error" in result.output
559559+ # The command was interpolated and attempted; the jail error surface proves
560560+ # the broker catches and reports failures from exec_background properly.