Skip to content

Commit f2caf2e

Browse files
authored
Revert "Make oz runs publicly viewable (#276)" (#293)
1 parent d27fd3e commit f2caf2e

2 files changed

Lines changed: 1 addition & 144 deletions

File tree

.github/scripts/oz_workflows/oz_client.py

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import time
44
from pathlib import Path
5-
from typing import Any, Callable, cast
5+
from typing import Callable, cast
66

77
from oz_agent_sdk import OzAPI
88
from oz_agent_sdk.types import AgentRunParams, AmbientAgentConfigParam, McpServerConfigParam
@@ -14,19 +14,6 @@
1414

1515
TERMINAL_STATES = {"SUCCEEDED", "FAILED", "ERROR", "CANCELLED"}
1616

17-
# Default public-access level for the run's shared session.
18-
#
19-
# The oz-for-oss workflows are intended for OSS repositories where community
20-
# members should be able to view agent activity through the session link
21-
# without being invited to the run's team. We therefore opt every run into
22-
# anyone-with-link viewer access by default. Callers that want to opt out or
23-
# pick a different level can override this via the
24-
# WARP_SESSION_SHARING_PUBLIC_ACCESS environment variable; set it to "NONE" or
25-
# "OFF" to disable public sharing for a run.
26-
DEFAULT_SESSION_SHARING_PUBLIC_ACCESS = "VIEWER"
27-
_SESSION_SHARING_DISABLED_VALUES = {"NONE", "OFF", "DISABLED", "FALSE", "0"}
28-
_SESSION_SHARING_SUPPORTED_LEVELS = {"VIEWER", "EDITOR"}
29-
3017

3118
def oz_api_base_url() -> str:
3219
"""Return the configured Oz API base URL.
@@ -50,31 +37,6 @@ def build_oz_client() -> OzAPI:
5037
)
5138

5239

53-
def _resolve_session_sharing_public_access() -> str | None:
54-
"""Resolve the configured public-access level for session sharing.
55-
56-
Returns the level string (``"VIEWER"`` or ``"EDITOR"``) when public session
57-
sharing should be enabled for the run, or ``None`` when the caller has
58-
explicitly disabled public sharing.
59-
"""
60-
raw = optional_env("WARP_SESSION_SHARING_PUBLIC_ACCESS")
61-
if raw == "":
62-
return DEFAULT_SESSION_SHARING_PUBLIC_ACCESS
63-
normalized = raw.upper()
64-
if normalized in _SESSION_SHARING_DISABLED_VALUES:
65-
return None
66-
if normalized not in _SESSION_SHARING_SUPPORTED_LEVELS:
67-
warning(
68-
"WARP_SESSION_SHARING_PUBLIC_ACCESS="
69-
f"{raw!r} is not a supported value; expected one of "
70-
f"{sorted(_SESSION_SHARING_SUPPORTED_LEVELS)} or a disable value "
71-
f"({sorted(_SESSION_SHARING_DISABLED_VALUES - {''})}). "
72-
"Disabling public session sharing for this run."
73-
)
74-
return None
75-
return normalized
76-
77-
7840
def build_agent_config(
7941
*,
8042
config_name: str,
@@ -104,19 +66,6 @@ def build_agent_config(
10466
warning(
10567
"WARP_AGENT_PROFILE is set, but the Oz Python SDK does not expose CLI profile support. Ignoring it."
10668
)
107-
108-
# Opt runs into anyone-with-link viewer access so community members can
109-
# follow along via the session link. This relies on the server-side
110-
# `session_sharing.public_access` field added in APP-3762; the field is
111-
# typed once the Oz SDK is regenerated from the updated OpenAPI spec. In
112-
# the meantime the request body is serialized from this TypedDict
113-
# (total=False) so the extra key passes through at runtime.
114-
public_access = _resolve_session_sharing_public_access()
115-
if public_access is not None:
116-
cast(dict[str, Any], config)["session_sharing"] = {
117-
"public_access": public_access,
118-
}
119-
12069
return config
12170

12271

.github/scripts/tests/test_oz_client.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -228,98 +228,6 @@ def test_requires_warp_environment_id(self) -> None:
228228
workspace=Path("/tmp"),
229229
)
230230

231-
@patch.dict(os.environ, {"WARP_ENVIRONMENT_ID": "default-env"}, clear=True)
232-
def test_defaults_session_sharing_to_viewer(self) -> None:
233-
config = build_agent_config(
234-
config_name="review-pull-request",
235-
workspace=Path("/tmp"),
236-
)
237-
self.assertEqual(
238-
dict(config).get("session_sharing"),
239-
{"public_access": "VIEWER"},
240-
)
241-
242-
@patch.dict(
243-
os.environ,
244-
{
245-
"WARP_ENVIRONMENT_ID": "default-env",
246-
"WARP_SESSION_SHARING_PUBLIC_ACCESS": "EDITOR",
247-
},
248-
clear=True,
249-
)
250-
def test_session_sharing_can_be_set_to_editor(self) -> None:
251-
config = build_agent_config(
252-
config_name="review-pull-request",
253-
workspace=Path("/tmp"),
254-
)
255-
self.assertEqual(
256-
dict(config).get("session_sharing"),
257-
{"public_access": "EDITOR"},
258-
)
259-
260-
@patch.dict(
261-
os.environ,
262-
{
263-
"WARP_ENVIRONMENT_ID": "default-env",
264-
"WARP_SESSION_SHARING_PUBLIC_ACCESS": "viewer",
265-
},
266-
clear=True,
267-
)
268-
def test_session_sharing_is_case_insensitive(self) -> None:
269-
config = build_agent_config(
270-
config_name="review-pull-request",
271-
workspace=Path("/tmp"),
272-
)
273-
self.assertEqual(
274-
dict(config).get("session_sharing"),
275-
{"public_access": "VIEWER"},
276-
)
277-
278-
@patch.dict(
279-
os.environ,
280-
{
281-
"WARP_ENVIRONMENT_ID": "default-env",
282-
"WARP_SESSION_SHARING_PUBLIC_ACCESS": "none",
283-
},
284-
clear=True,
285-
)
286-
def test_session_sharing_can_be_disabled(self) -> None:
287-
config = build_agent_config(
288-
config_name="review-pull-request",
289-
workspace=Path("/tmp"),
290-
)
291-
self.assertNotIn("session_sharing", dict(config))
292-
293-
@patch.dict(
294-
os.environ,
295-
{
296-
"WARP_ENVIRONMENT_ID": "default-env",
297-
"WARP_SESSION_SHARING_PUBLIC_ACCESS": "off",
298-
},
299-
clear=True,
300-
)
301-
def test_session_sharing_off_also_disables(self) -> None:
302-
config = build_agent_config(
303-
config_name="review-pull-request",
304-
workspace=Path("/tmp"),
305-
)
306-
self.assertNotIn("session_sharing", dict(config))
307-
308-
@patch.dict(
309-
os.environ,
310-
{
311-
"WARP_ENVIRONMENT_ID": "default-env",
312-
"WARP_SESSION_SHARING_PUBLIC_ACCESS": "bogus",
313-
},
314-
clear=True,
315-
)
316-
def test_unknown_session_sharing_value_disables_sharing(self) -> None:
317-
config = build_agent_config(
318-
config_name="review-pull-request",
319-
workspace=Path("/tmp"),
320-
)
321-
self.assertNotIn("session_sharing", dict(config))
322-
323231

324232
if __name__ == "__main__":
325233
unittest.main()

0 commit comments

Comments
 (0)