Scope: all 10 workspace projects
Already up to date
Done in 64ms using pnpm v11.5.2
FFFFFFFF.F.FFFFFFFFFF........F........                                   [100%]
=================================== FAILURES ===================================
__ test_build_authority_launch_uses_gateway_only_home_and_strips_native_auth ___

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_build_authority_launch_us0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_build_authority_launch_us0/fixture.grant'), quiesced=False), 'http://127.0.0.1:37197')

    def test_build_authority_launch_uses_gateway_only_home_and_strips_native_auth(
        authority,
    ) -> None:
        base_dir, account, _binding, origin = authority
    
>       launch = build_authority_launch(
            base_dir,
            account,
            "codex",
            ["exec", "task"],
            inherited_environment={
                "OPENAI_API_KEY": "must-not-survive",
                "OPENAI_BASE_URL": "https://wrong.invalid",
                "ANTHROPIC_AUTH_TOKEN": "must-not-survive",
                "ANTHROPIC_BASE_URL": "https://wrong.invalid",
                "CLAUDE_CONFIG_DIR": "/native",
                "CODEX_HOME": "/native",
                "SUBROUTER_PROXY_KEY": "wrong-grant",
                "HTTPS_PROXY": "http://wrong.invalid",
                "SAFE": "preserved",
            },
        )

modules/systray/tests/test_authority_client.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:884: in build_authority_launch
    endpoint, key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_build_authority_launch_us0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
_________ test_launch_uses_one_grant_snapshot_for_status_and_execution _________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_launch_uses_one_grant_sna0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_launch_uses_one_grant_sna0/fixture.grant'), quiesced=False), 'http://127.0.0.1:39353')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a18c7820>

    def test_launch_uses_one_grant_snapshot_for_status_and_execution(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, account, _binding, _origin = authority
        reads: list[str] = []
        status_keys: list[str] = []
    
        def read_once(_path: Path) -> str:
            value = "first-key" if not reads else "second-key"
            reads.append(value)
            return value
    
        def status_with_key(
            _endpoint: object,
            _binding: object,
            key: str,
            *,
            timeout_secs: float,
        ) -> GatewayStatus:
            del timeout_secs
            status_keys.append(key)
            return GatewayStatus("ready", "Gateway: ready", 1.0)
    
        monkeypatch.setattr(authority_client, "_read_proxy_key", read_once)
        monkeypatch.setattr(authority_client, "_fetch_gateway_status", status_with_key)
    
>       launch = build_authority_launch(base_dir, account, "codex", ["exec", "task"])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:231: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:884: in build_authority_launch
    endpoint, key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_launch_uses_one_grant_sna0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
__________ test_claude_launch_uses_gateway_only_home_and_exact_route ___________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_claude_launch_uses_gatewa0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_claude_launch_uses_gatewa0/fixture.grant'), quiesced=False), 'http://127.0.0.1:38587')

    def test_claude_launch_uses_gateway_only_home_and_exact_route(authority) -> None:
        base_dir, _account, binding, origin = authority
        claude_binding = AuthorityBinding(
            mode=binding.mode,
            authority_name=binding.authority_name,
            route_id=binding.route_id,
            provider="claude",
            proxy_grant_ref=binding.proxy_grant_ref,
        )
        account = Account(
            ref=AccountRef("claude", "fixture"),
            alias="Fixture",
            account_home=base_dir / "native" / "CLAUDE_CONFIG_DIR",
            email=None,
            plan=None,
            account_id=None,
            authority_binding=claude_binding,
        )
    
        _StatusHandler.body = {**_READY_STATUS, "provider": "claude"}
>       launch = build_authority_launch(
            base_dir,
            account,
            "claude",
            ["--print", "task"],
            inherited_environment={
                "CLAUDE_CONFIG_DIR": "/native",
                "CLAUDE_CODE_OAUTH_TOKEN": "remove",
                "SUBROUTER_PROXY_KEY": "wrong-grant",
                "OPENAI_BASE_URL": "https://wrong.invalid",
            },
        )

modules/systray/tests/test_authority_client.py:258: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:884: in build_authority_launch
    endpoint, key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_claude_launch_uses_gatewa0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
________________ test_gateway_home_refuses_provider_auth_files _________________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_home_refuses_prov0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_home_refuses_prov0/fixture.grant'), quiesced=False), 'http://127.0.0.1:37211')

    def test_gateway_home_refuses_provider_auth_files(authority) -> None:
        base_dir, account, binding, _origin = authority
>       endpoint = resolve_authority_endpoint(base_dir, binding)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_home_refuses_prov0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
_______ test_gateway_home_interrupted_materialization_publishes_nothing ________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_home_interrupted_0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_home_interrupted_0/fixture.grant'), quiesced=False), 'http://127.0.0.1:38151')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a17e6030>

    def test_gateway_home_interrupted_materialization_publishes_nothing(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, account, binding, _origin = authority
        rebound = Account(
            ref=account.ref,
            alias=account.alias,
            account_home=account.account_home,
            email=account.email,
            plan=account.plan,
            account_id=account.account_id,
            authority_binding=AuthorityBinding(
                mode=binding.mode,
                authority_name=binding.authority_name,
                route_id="route-interrupted",
                provider=binding.provider,
                proxy_grant_ref=binding.proxy_grant_ref,
            ),
        )
>       endpoint = resolve_authority_endpoint(base_dir, rebound.authority_binding)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:316: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_home_interrupted_0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
_____________ test_gateway_status_renews_rejected_local_grant_once _____________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_renews_rej0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_renews_rej0/fixture.grant'), quiesced=False), 'http://127.0.0.1:39817')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a20bf150>

    def test_gateway_status_renews_rejected_local_grant_once(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, _account, binding, _origin = authority
        calls: list[str] = []
        renewed: list[tuple[str, str]] = []
        future_ms = int((time.time() + 7200) * 1000)
    
        def fetch(_endpoint, _binding, key: str, *, timeout_secs: float) -> GatewayStatus:
            del timeout_secs
            calls.append(key)
            if len(calls) == 1:
                raise authority_client._GatewayGrantRejected("Gateway: unavailable")
            return GatewayStatus("ready", "Gateway: ready", time.time(), future_ms)
    
        def renew(endpoint, candidate, key: str, *, timeout_secs: float) -> int:
            del timeout_secs
            renewed.append((candidate.route_id, key))
            assert endpoint.name == binding.authority_name
            return future_ms
    
        monkeypatch.setattr(authority_client, "_can_renew_gateway_grant", lambda *_args: True)
        monkeypatch.setattr(authority_client, "_fetch_gateway_status", fetch)
        monkeypatch.setattr(authority_client, "_renew_gateway_grant", renew)
    
>       status = fetch_gateway_status(base_dir, binding)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:362: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:714: in fetch_gateway_status
    _endpoint, _key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_renews_rej0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
_____ test_gateway_status_rejected_nonlocal_grant_never_uses_admin_renewal _____

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejected_n0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejected_n0/fixture.grant'), quiesced=False), 'http://127.0.0.1:40967')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a17f1850>

    def test_gateway_status_rejected_nonlocal_grant_never_uses_admin_renewal(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, _account, binding, _origin = authority
        renewals: list[str] = []
    
        monkeypatch.setattr(
            authority_client,
            "_fetch_gateway_status",
            lambda *_args, **_kwargs: (_ for _ in ()).throw(
                authority_client._GatewayGrantRejected("Gateway: unavailable")
            ),
        )
        monkeypatch.setattr(
            authority_client,
            "_renew_gateway_grant",
            lambda _endpoint, candidate, _key, *, timeout_secs: renewals.append(
                candidate.route_id
            ),
        )
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:390: AssertionError
______________ test_gateway_status_proactively_renews_near_expiry ______________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_proactivel0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_proactivel0/fixture.grant'), quiesced=False), 'http://127.0.0.1:38407')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a14894f0>

    def test_gateway_status_proactively_renews_near_expiry(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, _account, binding, _origin = authority
        now = time.time()
        statuses = [
            GatewayStatus("ready", "Gateway: ready", now, int((now + 30 * 60) * 1000)),
            GatewayStatus("ready", "Gateway: ready", now, int((now + 24 * 60 * 60) * 1000)),
        ]
        renewals: list[str] = []
    
        monkeypatch.setattr(authority_client, "_can_renew_gateway_grant", lambda *_args: True)
        monkeypatch.setattr(
            authority_client,
            "_fetch_gateway_status",
            lambda *_args, **_kwargs: statuses.pop(0),
        )
        monkeypatch.setattr(
            authority_client,
            "_renew_gateway_grant",
            lambda _endpoint, candidate, _key, *, timeout_secs: renewals.append(candidate.route_id) or int((now + 24 * 60 * 60) * 1000),
        )
    
>       status = fetch_gateway_status(base_dir, binding)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:419: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:714: in fetch_gateway_status
    _endpoint, _key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_proactivel0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
____________ test_gateway_usage_reads_sanitized_local_admin_windows ____________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_usage_reads_sanit0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_usage_reads_sanit0/fixture.grant'), quiesced=False), 'http://127.0.0.1:45475')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f42a17af3f0>

    def test_gateway_usage_reads_sanitized_local_admin_windows(
        authority, monkeypatch: pytest.MonkeyPatch
    ) -> None:
        base_dir, account, binding, origin = authority
        active = Account(
            ref=account.ref,
            alias=account.alias,
            account_home=account.account_home,
            email=account.email,
            plan=account.plan,
            account_id=account.account_id,
            authority_binding=AuthorityBinding(
                mode=AuthorityMode.SUBROUTER,
                authority_name=binding.authority_name,
                route_id=binding.route_id,
                provider=binding.provider,
                proxy_grant_ref=binding.proxy_grant_ref,
            ),
        )
        monkeypatch.setattr(authority_client, "LOCAL_AUTHORITY_NAME", binding.authority_name)
        monkeypatch.setattr(authority_client, "LOCAL_AUTHORITY_ORIGIN", origin)
        monkeypatch.setattr(authority_client, "_read_authority_admin_token", lambda: "a" * 64)
        _StatusHandler.requests = []
    
>       usage = fetch_gateway_usage(base_dir, active)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:498: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:729: in fetch_gateway_usage
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_usage_reads_sanit0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
_______ test_gateway_status_is_sanitized_and_missing_grant_fails_closed ________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_is_sanitiz0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_is_sanitiz0/fixture.grant'), quiesced=False), 'http://127.0.0.1:41301')

    def test_gateway_status_is_sanitized_and_missing_grant_fails_closed(authority) -> None:
        base_dir, account, binding, _origin = authority
    
        snapshot = gateway_health_snapshot(base_dir, account)
    
>       assert snapshot.status == HealthStatus.OK
E       AssertionError: assert <HealthStatus.UNKNOWN: 'unknown'> == <HealthStatus.OK: 'ok'>
E        +  where <HealthStatus.UNKNOWN: 'unknown'> = AccountSnapshot(status=<HealthStatus.UNKNOWN: 'unknown'>, primary_used_pct=None, secondary_used_pct=None, primary_rese...ne, checked_at=1787494222.2342865, detail='Gateway: migration required', named_limits=(), extra_usage=None, spend=None).status
E        +  and   <HealthStatus.OK: 'ok'> = HealthStatus.OK

modules/systray/tests/test_authority_client.py:579: AssertionError
________________ test_gateway_status_maps_exact_exhausted_state ________________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_maps_exact0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_maps_exact0/fixture.grant'), quiesced=False), 'http://127.0.0.1:44423')

    def test_gateway_status_maps_exact_exhausted_state(authority) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {
            **_READY_STATUS,
            "state": "exhausted",
            "account_availability": "exhausted",
        }
    
>       status = fetch_gateway_status(base_dir, binding)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:598: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:714: in fetch_gateway_status
    _endpoint, _key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_maps_exact0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
____ test_gateway_status_rejects_wrong_or_unbounded_schema[provider-claude] ____

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr0/fixture.grant'), quiesced=False), 'http://127.0.0.1:35469')
field = 'provider', value = 'claude'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
_ test_gateway_status_rejects_wrong_or_unbounded_schema[route_fingerprint-ffffffffffff] _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr1/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr1/fixture.grant'), quiesced=False), 'http://127.0.0.1:34003')
field = 'route_fingerprint', value = 'ffffffffffff'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
_ test_gateway_status_rejects_wrong_or_unbounded_schema[grant_fingerprint-not-bounded] _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr2/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr2/fixture.grant'), quiesced=False), 'http://127.0.0.1:37703')
field = 'grant_fingerprint', value = 'not-bounded'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
_ test_gateway_status_rejects_wrong_or_unbounded_schema[grant_expires_at-2000-01-01T00:00:00Z] _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr3/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr3/fixture.grant'), quiesced=False), 'http://127.0.0.1:33473')
field = 'grant_expires_at', value = '2000-01-01T00:00:00Z'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
__ test_gateway_status_rejects_wrong_or_unbounded_schema[grant_revoked-True] ___

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr4/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr4/fixture.grant'), quiesced=False), 'http://127.0.0.1:33531')
field = 'grant_revoked', value = True

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
_ test_gateway_status_rejects_wrong_or_unbounded_schema[account_availability-unavailable] _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr5/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr5/fixture.grant'), quiesced=False), 'http://127.0.0.1:34577')
field = 'account_availability', value = 'unavailable'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
_ test_gateway_status_rejects_wrong_or_unbounded_schema[credential-must-be-rejected] _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr6/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_rejects_wr6/fixture.grant'), quiesced=False), 'http://127.0.0.1:45489')
field = 'credential', value = 'must-be-rejected'

    @pytest.mark.parametrize(
        ("field", "value"),
        [
            ("provider", "claude"),
            ("route_fingerprint", "ffffffffffff"),
            ("grant_fingerprint", "not-bounded"),
            ("grant_expires_at", "2000-01-01T00:00:00Z"),
            ("grant_revoked", True),
            ("account_availability", "unavailable"),
            ("credential", "must-be-rejected"),
        ],
    )
    def test_gateway_status_rejects_wrong_or_unbounded_schema(
        authority,
        field: str,
        value: object,
    ) -> None:
        base_dir, _account, binding, _origin = authority
        _StatusHandler.body = {**_READY_STATUS, field: value}
    
>       with pytest.raises(AuthorityConfigurationError, match="unavailable"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'unavailable'
E         Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:624: AssertionError
________ test_gateway_status_refuses_redirect_without_forwarding_grant _________

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_gateway_status_refuses_re0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_gateway_status_refuses_re0/fixture.grant'), quiesced=False), 'http://127.0.0.1:35345')

    def test_gateway_status_refuses_redirect_without_forwarding_grant(authority) -> None:
        base_dir, _account, binding, _origin = authority
        captured: list[str | None] = []
    
        class _Sink(BaseHTTPRequestHandler):
            def do_GET(self) -> None:
                captured.append(self.headers.get("Authorization"))
                self.send_response(200)
                self.end_headers()
    
            def log_message(self, _format: str, *_args: object) -> None:
                return
    
        sink = ThreadingHTTPServer(("127.0.0.1", 0), _Sink)
    
        class _Redirect(BaseHTTPRequestHandler):
            def do_GET(self) -> None:
                self.send_response(302)
                self.send_header(
                    "Location", f"http://127.0.0.1:{sink.server_port}/capture"
                )
                self.end_headers()
    
            def log_message(self, _format: str, *_args: object) -> None:
                return
    
        redirect = ThreadingHTTPServer(("127.0.0.1", 0), _Redirect)
        threads = [
            threading.Thread(target=sink.serve_forever),
            threading.Thread(target=redirect.serve_forever),
        ]
        for thread in threads:
            thread.start()
        try:
            endpoints = base_dir / "authority_endpoints.json"
            endpoints.write_text(
                json.dumps(
                    {
                        "authorities": {
                            "workstation": {
                                "origin": f"http://127.0.0.1:{redirect.server_port}"
                            }
                        }
                    }
                ),
                encoding="utf-8",
            )
    
>           with pytest.raises(AuthorityConfigurationError, match="unavailable"):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           AssertionError: Regex pattern did not match.
E             Expected regex: 'unavailable'
E             Actual message: 'Gateway: migration required'

modules/systray/tests/test_authority_client.py:676: AssertionError
_ test_resolve_authority_data_plane_returns_exact_responses_route_and_verified_expiry _

authority = (PosixPath('/tmp/pytest-of-user/pytest-99/test_resolve_authority_data_pl0/runtime'), Account(ref=AccountRef(tool='code...mp/pytest-of-user/pytest-99/test_resolve_authority_data_pl0/fixture.grant'), quiesced=False), 'http://127.0.0.1:43161')

    def test_resolve_authority_data_plane_returns_exact_responses_route_and_verified_expiry(
        authority,
    ) -> None:
        base_dir, _account, binding, origin = authority
        active = AuthorityBinding(
            mode=AuthorityMode.SUBROUTER,
            authority_name=binding.authority_name,
            route_id=binding.route_id,
            provider=binding.provider,
            proxy_grant_ref=binding.proxy_grant_ref,
        )
    
>       data_plane = authority_client.resolve_authority_data_plane(base_dir, active)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

modules/systray/tests/test_authority_client.py:944: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modules/systray/authority_client.py:857: in resolve_authority_data_plane
    endpoint, key, status = _resolve_gateway_status(
modules/systray/authority_client.py:676: in _resolve_gateway_status
    endpoint = resolve_authority_endpoint(base_dir, binding)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:279: in resolve_authority_endpoint
    payload = json.loads(_read_protected_text(path, max_bytes=65_536, private=False))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modules/systray/authority_client.py:196: in _read_protected_text
    parent_fd = _open_protected_parent(path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = PosixPath('/tmp/pytest-of-user/pytest-99/test_resolve_authority_data_pl0/runtime/authority_endpoints.json')

    def _open_protected_parent(path: Path) -> int:
        descriptor = os.open(
            "/",
            os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
        )
        try:
            for component in path.parent.parts[1:]:
                next_descriptor = os.open(
                    component,
                    os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC | os.O_NOFOLLOW,
                    dir_fd=descriptor,
                )
                os.close(descriptor)
                descriptor = next_descriptor
                info = os.fstat(descriptor)
                if stat.S_IMODE(info.st_mode) & 0o022:
>                   raise AuthorityConfigurationError("Gateway: migration required")
E                   authority_client.AuthorityConfigurationError: Gateway: migration required

modules/systray/authority_client.py:181: AuthorityConfigurationError
=========================== short test summary info ============================
FAILED modules/systray/tests/test_authority_client.py::test_build_authority_launch_uses_gateway_only_home_and_strips_native_auth
FAILED modules/systray/tests/test_authority_client.py::test_launch_uses_one_grant_snapshot_for_status_and_execution
FAILED modules/systray/tests/test_authority_client.py::test_claude_launch_uses_gateway_only_home_and_exact_route
FAILED modules/systray/tests/test_authority_client.py::test_gateway_home_refuses_provider_auth_files
FAILED modules/systray/tests/test_authority_client.py::test_gateway_home_interrupted_materialization_publishes_nothing
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_renews_rejected_local_grant_once
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejected_nonlocal_grant_never_uses_admin_renewal
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_proactively_renews_near_expiry
FAILED modules/systray/tests/test_authority_client.py::test_gateway_usage_reads_sanitized_local_admin_windows
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_is_sanitized_and_missing_grant_fails_closed
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_maps_exact_exhausted_state
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[provider-claude]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[route_fingerprint-ffffffffffff]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[grant_fingerprint-not-bounded]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[grant_expires_at-2000-01-01T00:00:00Z]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[grant_revoked-True]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[account_availability-unavailable]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_rejects_wrong_or_unbounded_schema[credential-must-be-rejected]
FAILED modules/systray/tests/test_authority_client.py::test_gateway_status_refuses_redirect_without_forwarding_grant
FAILED modules/systray/tests/test_authority_client.py::test_resolve_authority_data_plane_returns_exact_responses_route_and_verified_expiry
20 failed, 18 passed in 16.65s
command-supervisor classification=opaque-exit
command-supervisor last-event=none
command-supervisor process-tree=empty
