Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def _on_session_start(self, event: SessionStartEvent) -> None:
started_at=event.timestamp,
model=event.model,
working_directory=event.working_directory,
tags=event.tags,
metadata=self._metadata(event),
)
)
Expand Down
135 changes: 50 additions & 85 deletions context-graph/actions-graph/src/actions_graph/core.py

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions context-graph/actions-graph/src/actions_graph/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class Session:
total_output_tokens: Total output tokens generated
working_directory: Working directory for the session
git_branch: Git branch at start of session
tags: Optional tags for categorization
metadata: Additional session metadata
parent_session_id: ID of parent session if forked
"""
Expand All @@ -125,7 +124,6 @@ class Session:
total_output_tokens: int = 0
working_directory: str | None = None
git_branch: str | None = None
tags: list[str] = field(default_factory=list)
metadata: dict[str, Any] = field(default_factory=dict)
parent_session_id: str | None = None

Expand Down
2 changes: 0 additions & 2 deletions context-graph/actions-graph/tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ def test_records_session_start():
timestamp="2026-01-01T00:00:00+00:00",
model="gpt-5",
working_directory="/repo",
tags=["local"],
source_sdk="codex",
)
)

session = graph.sessions["session-1"]
assert session.model == "gpt-5"
assert session.working_directory == "/repo"
assert session.tags == ["local"]
assert session.metadata["source_sdk"] == "codex"


Expand Down
5 changes: 1 addition & 4 deletions context-graph/actions-graph/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ def test_create_and_get_session(self, graph: ActionsGraph):
session_id="test-session-001",
model="claude-sonnet-4-20250514",
working_directory="/test/project",
tags=["test", "e2e"],
)
graph.create_session(session)

retrieved = graph.get_session("test-session-001")
assert retrieved is not None
assert retrieved.session_id == "test-session-001"
assert retrieved.model == "claude-sonnet-4-20250514"
assert "test" in retrieved.tags

def test_end_session(self, graph: ActionsGraph):
"""Test ending a session."""
Expand All @@ -83,11 +81,10 @@ def test_list_sessions(self, graph: ActionsGraph):
for i in range(3):
session = Session(
session_id=f"list-test-{i}",
tags=["list-test"],
)
graph.create_session(session)

sessions = graph.list_sessions(tag="list-test")
sessions = graph.list_sessions()
assert len(sessions) == 3

def test_forked_session(self, graph: ActionsGraph):
Expand Down
3 changes: 1 addition & 2 deletions context-graph/actions-graph/tests/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ async def test_message_subagent_permission_notification_and_stop_hooks():
def test_create_tracking_hooks_creates_session_and_hook_map():
graph = FakeActionsGraph()

hooks = create_tracking_hooks(graph, "session-1", session_kwargs={"tags": ["test"]})
hooks = create_tracking_hooks(graph, "session-1", session_kwargs={})

assert graph.sessions[0].session_id == "session-1"
assert graph.sessions[0].tags == ["test"]
assert set(hooks) == {
"PreToolUse",
"PostToolUse",
Expand Down
2 changes: 0 additions & 2 deletions context-graph/actions-graph/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ def test_create_session_with_all_fields(self):
model="claude-sonnet-4-20250514",
working_directory="/path/to/project",
git_branch="main",
tags=["test", "demo"],
metadata={"key": "value"},
)
assert session.model == "claude-sonnet-4-20250514"
assert session.working_directory == "/path/to/project"
assert session.git_branch == "main"
assert session.tags == ["test", "demo"]
assert session.metadata == {"key": "value"}

def test_invalid_session_id(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def __init__(
source_sdk=_SOURCE,
model=kw.get("model"),
working_directory=kw.get("working_directory"),
tags=kw.get("tags", []),
metadata=kw.get("metadata", {}),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def __init__(
source_sdk=_SOURCE,
model=kw.get("model"),
working_directory=kw.get("working_directory"),
tags=kw.get("tags", []),
metadata=kw.get("metadata", {}),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class SessionStartEvent(Event):
event_type: EventType = field(default=EventType.SESSION_START, init=False)
model: str | None = None
working_directory: str | None = None
tags: list[str] = field(default_factory=list)


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion context-graph/agent-context-graph/tests/test_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_auto_session_emits_session_start(self):
ClaudeAdapter(
link,
"s-test",
session_kwargs={"model": "claude-sonnet-4-20250514", "tags": ["test"]},
session_kwargs={"model": "claude-sonnet-4-20250514"},
)

assert len(rec.events) == 1
Expand Down
14 changes: 8 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading