File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,6 +245,11 @@ def function_call_id(self, value: str | None) -> None:
245245 """Sets the function call id of the current tool call."""
246246 self ._function_call_id = value
247247
248+ @property
249+ def branch (self ) -> str | None :
250+ """The branch path of the current invocation context."""
251+ return self ._invocation_context .branch
252+
248253 @property
249254 def isolation_scope (self ) -> str | None :
250255 """Scope tag inherited from parent or set explicitly via override.
Original file line number Diff line number Diff line change @@ -40,12 +40,21 @@ def mock_invocation_context():
4040 mock_context .session .id = "test-session-id"
4141 mock_context .app_name = "test-app"
4242 mock_context .user_id = "test-user"
43+ mock_context .branch = "test-branch"
4344 mock_context .artifact_service = None
4445 mock_context .credential_service = None
4546 mock_context .memory_service = None
4647 return mock_context
4748
4849
50+ def test_context_branch_returns_invocation_branch (mock_invocation_context ):
51+ """Context.branch returns the branch from the underlying invocation context."""
52+ mock_invocation_context .branch = "test-branch"
53+ context = Context (invocation_context = mock_invocation_context )
54+
55+ assert context .branch == "test-branch"
56+
57+
4958@pytest .fixture
5059def mock_artifact_service ():
5160 """Create a mock artifact service for testing."""
You can’t perform that action at this time.
0 commit comments