Repository navigation
[codex] add Go session lineage backend - #68
Conversation
Zero automated PR reviewVerdict: No blockers found Blockers
Validation
ScopeHead: This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughImplements session lineage: expands session model with lineage fields, adds Store methods CreateChild/ListChildren/Lineage/Tree, exposes them via a new ChangesSession Lineage and CLI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/cli/sessions_test.go (1)
83-99: ⚡ Quick winAdd regression cases for invalid
sessionsinvocations.Please add CLI tests for
sessions fooandsessions list extraexpectingexitUsage; these are important guardrails for parser behavior and prevent silent fallback regressions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/cli/sessions_test.go` around lines 83 - 99, Add two regression test cases in TestRunSessionsValidatesArgs (or a new test in internal/cli/sessions_test.go) that exercise invalid CLI invocations: one calling runWithDeps with args []string{"sessions","foo"} and another with []string{"sessions","list","extra"}; both should use the same appDeps.newSessionStore returning the prepared store, assert the returned exitCode equals exitUsage, and assert stderr contains the usage/malformed-invocation message similar to the existing "Zero session not found: missing" check (i.e., verify the CLI reports a usage error for these invalid argument patterns).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/sessions/lineage.go`:
- Around line 47-53: CreateChild can persist the child linkage event and then
fail appending the parent event, leaving asymmetric lineage; to fix, make the
two appends atomic: either call a transactional/batch API (e.g., use a
hypothetical store.AppendEvents or store.Transaction that appends both payloads
for child.SessionID and parent.SessionID in one operation), or if no transaction
exists, append the parent event first (store.AppendEvent with Payload from
childLinkPayload) then append the child event, or implement compensation by
removing the child event on parent-append failure (use the store's delete/revert
API). Update the code around childLinkPayload, store.AppendEvent,
EventSessionChild, child.SessionID and parent.SessionID accordingly so both
session events are persisted together or cleaned up on error.
---
Nitpick comments:
In `@internal/cli/sessions_test.go`:
- Around line 83-99: Add two regression test cases in
TestRunSessionsValidatesArgs (or a new test in internal/cli/sessions_test.go)
that exercise invalid CLI invocations: one calling runWithDeps with args
[]string{"sessions","foo"} and another with []string{"sessions","list","extra"};
both should use the same appDeps.newSessionStore returning the prepared store,
assert the returned exitCode equals exitUsage, and assert stderr contains the
usage/malformed-invocation message similar to the existing "Zero session not
found: missing" check (i.e., verify the CLI reports a usage error for these
invalid argument patterns).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7e3f1de0-9a3b-492a-b74c-56f7452f09e1
📒 Files selected for processing (7)
internal/cli/app.gointernal/cli/app_test.gointernal/cli/sessions.gointernal/cli/sessions_test.gointernal/sessions/lineage.gointernal/sessions/store.gointernal/sessions/store_test.go
|
Review feedback addressed in commit 0e0a9e0. Fixed:
Validation:
|
|
Looks Good I reviewed the Go session lineage backend and the new Blockers
Non-Blocking
Looks Good
|
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Looks Good
I reviewed the Go session lineage backend and the new zero sessions inspector surface against current origin/main at head 0e0a9e05585e6accfc356e61ac881f3683fe33fa.
Blockers
- None.
Non-Blocking
- The PR intentionally keeps this to the durable backend + inspector CLI contract. There is no user-facing child-session creation/orchestration flow yet, so future subagent work still needs to wire creation through the agent/runtime surfaces and preserve the same lineage invariants.
Looks Good
CreateChild,ListChildren,Lineage, andTreeare anchored on validated session ids, preserve root/parent linkage, and keep cycle checks in the traversal paths.- Parent/child link events are written to both sides, while child metadata inherits cwd/model/provider context from the parent unless explicitly overridden.
- The
zero sessionsCLI keeps list/children/lineage/tree as read-only inspection commands, supports text and JSON output, redacts rendered metadata before output, and does not launch the TUI for these commands. - Local validation passed:
go test -run 'TestStoreCreatesChildSessionsAndRecordsLineageEvents|TestStoreListsChildrenLineageAndTree' -count=1 ./internal/sessionsgo test -run 'TestRunSessionsListsLineageAndTree|TestRunSessionsValidatesArgs|TestRunCommandsDoNotLaunchTUI|TestRunPrintsHelp' -count=1 ./internal/cligo test -count=1 ./internal/sessions ./internal/cligo test -count=1 -p 1 ./...go build ./cmd/zerobun install --frozen-lockfilebun run typecheckbun test ./tests --timeout 15000— 291 pass / 0 failbun run buildbun run smoke:buildbun run smoke:go./zero.exe --help./zero.exe sessions --help./zero.exe sessions list --jsongit diff --check origin/main..HEAD
- GitHub checks are green: Smoke on Ubuntu/macOS/Windows, Performance Smoke, Zero Review, and CodeRabbit.
Summary
zero sessionsinspector command with text and JSON output for list, children, lineage, and tree views.PRD Alignment
/agentsUI work can consume.Validation
go test -run 'TestStoreCreatesChildSessionsAndRecordsLineageEvents|TestStoreListsChildrenLineageAndTree' -count=1 ./internal/sessionsgo test -run 'TestRunSessionsListsLineageAndTree|TestRunSessionsValidatesArgs|TestRunCommandsDoNotLaunchTUI|TestRunPrintsHelp' -count=1 ./internal/cligo test -count=1 ./internal/sessions ./internal/cligo test -count=1 -p 1 ./...npx --yes bun run typechecknpx --yes bun test ./tests --timeout 15000(291 pass / 0 fail)npx --yes bun run buildnpx --yes bun run smoke:buildnpx --yes bun run smoke:go./zero --help./zero sessions --help./zero sessions list --jsongit diff --checkSummary by CodeRabbit
New Features
sessionscommand group (list, children, lineage, tree) with optional--jsonoutput to inspect local session lineage and relationships.Bug Fixes
Tests