This document turns the current code review findings into an execution plan. It focuses on fixing correctness issues first, then closing the most important product gaps, then cleaning up quality and maintainability.
These items should be done first because they can leave users in the wrong repo state or make core commands fail in common repositories.
Problem
sess resume can mark a session as active even if switching back to the saved branch failed.
Files
internal/sess/resume.gointernal/git/git.go
Implementation
- Attempt branch checkout before resuming the session timer.
- If checkout fails, return an error and leave the session paused.
- Only skip checkout when the current branch already matches the saved branch.
- Consider surfacing git stderr directly in the command output.
Acceptance criteria
- Resuming from a different branch succeeds only after checkout succeeds.
- If checkout fails, the session remains paused in the database.
- User output clearly states what failed and what state the session is in.
Problem
The start workflow always checks out and pulls dev, even though base_branch exists in the database model.
Files
internal/tui/start.gointernal/session/session.gointernal/db/db.go
Implementation
- Load the tracked project's
BaseBranchand use it for checkout and pull. - Replace the hardcoded
"dev"in the git workflow orchestration. - Keep
"dev"only as a default for first-time initialization until config exists. - Audit command output so it prints the real base branch.
Acceptance criteria
sess startworks in repos whose default branch ismain.- The branch used for checkout/pull matches
project.BaseBranch. - Existing tracked projects still work after the change.
Problem
Running sess start in a non-repo directory can create a tracked project entry before git validation fails.
Files
internal/tui/start.gointernal/git/git.go
Implementation
- Check
git rev-parse --git-direarly inRunStartTUI. - Fail before creating or updating the project record when the current directory is not a git repo.
- Return a clear error message with the expected next step.
Acceptance criteria
sess startoutside a git repo does not create a project row.- The command exits with a direct, actionable error.
Problem
Dirty detection includes untracked files, but the current discard action only runs git reset --hard.
Files
internal/tui/start.gointernal/git/git.go
Implementation
- Decide on intended semantics:
- Option A: discard everything, including untracked files.
- Option B: rename the option to clarify it only resets tracked changes.
- If choosing full discard, add
git clean -fd. - Warn clearly before destructive cleanup.
Acceptance criteria
- The chosen discard behavior matches what the prompt says.
- The repo is actually clean after selecting discard.
These items improve the quality of the core start workflow and reduce user confusion.
Problem
Issue selection currently stores and displays GitHub id, which is likely the GraphQL node ID rather than the issue number users expect.
Files
internal/git/gh.gointernal/tui/issue_select.gointernal/tui/start.gointernal/db/db.go
Implementation
- Change
gh issue list --json ...to request the issue number field. - Update the
Issuestruct and all UI formatting to use the human issue number. - Decide whether existing session rows need migration or can remain as legacy values.
Acceptance criteria
- The issue picker shows values like
#123. - Saved sessions display human-readable issue identifiers.
Problem
The streaming helper emits stderr lines, but the start model ignores them.
Files
internal/tui/common.gointernal/tui/start.go
Implementation
- Handle
gitErrLineMsgin the start model and render it in the visible log stream. - Consider prefixing stderr lines so they are distinguishable.
Acceptance criteria
- Informational git stderr output is visible during
sess start. - Failure output is easier to diagnose without rerunning commands manually.
Problem
last_used_at is updated on session start but not consistently on other meaningful interactions.
Files
internal/session/session.gointernal/db/db.go
Implementation
- Decide which actions count as project activity: start, pause, resume, end, maybe status.
- Update
last_used_atconsistently through the session manager. - Keep the update logic centralized to avoid drift.
Acceptance criteria
sess projectsordering reflects recent real usage.- Timestamp updates are consistent across the lifecycle.
This is the main product gap after the safety fixes.
Problem
The session manager supports ending a session, but the CLI does not complete the end-to-PR workflow.
Files
internal/sess/internal/session/session.gointernal/git/git.gointernal/git/gh.gointernal/tui/
Implementation
- Add a
sess endcommand. - Define the desired flow explicitly:
- validate repo state
- commit or prompt for uncommitted changes
- update from base branch
- push branch
- open PR via
gh - switch back to base branch
- mark session ended
- Decide failure semantics for each step so the DB state always matches the actual repo state.
Acceptance criteria
- A normal session can be started, paused/resumed, and ended fully through the CLI.
- The resulting PR targets the configured base branch.
- Session state is correct even if a later step fails.
Follow-up
- Investigate PTY-specific text-input truncation seen during automated
sess endvalidation. The current command flow and prompt submission behavior are working, but a harness-driven repro still dropped the literal substringendinside one PR summary input chunk. Treat this as a lower-priority TUI/input-path bug and verify it against real terminal usage before changing prompt behavior further.
Problem
Rebase, push, or PR creation failures during end need explicit handling instead of partial silent failure.
Files
internal/sess/internal/tui/internal/session/session.go
Implementation
- Define recoverable workflow states.
- Preserve enough state to let the user resolve conflicts and continue.
- Add clear user-facing guidance for recovery paths.
Acceptance criteria
- Conflict scenarios do not leave the session state ambiguous.
- The user can recover without manually editing the database.
These items reduce long-term risk and clean up obvious rough edges.
Problem
The repo currently has no Go test files.
Files
internal/session/internal/db/internal/git/as needed
Implementation
- Start with unit tests for:
- start
- pause
- resume
- end
- elapsed time calculation
- Add DB-backed tests for migrations and active-session queries.
- Mock or isolate shelling to git/gh where practical.
Acceptance criteria
- Critical session transitions are covered by automated tests.
- Regressions in timing and state updates are caught by CI.
Problem
There are still template remnants and output inconsistencies.
Files
internal/sess/root.gointernal/sess/internal/tui/
Implementation
- Change the root command
Usestring tosess. - Remove the unused
--toggleflag. - Align output with the design direction in
docs/cli_design_guide.md. - Remove emoji and keep phrasing compact and git-like.
Acceptance criteria
- Help output matches the actual binary name.
- No obvious scaffolding remains in user-facing commands.
Problem
Version formatting logic only recognizes pseudo-versions containing -2024 or -2025.
Files
internal/sess/root.go
Implementation
- Replace the year-specific string checks with a general pseudo-version detection approach.
- Keep tagged release output unchanged.
Acceptance criteria
- Dev builds continue to render a clean version string in future years.
- Resume safety
- Base branch support
- Non-repo validation
- Dirty discard semantics
- GitHub issue number fix
- Git stderr visibility
- Project activity timestamps
sess end- Conflict recovery
- Tests
- CLI polish
- Version formatting cleanup
- Phases 1 and 2 are the highest leverage because they harden the existing command set.
sess endshould be built only after the repo-state and branch-state correctness issues are fixed.- The absence of tests means each phase should add coverage before moving further down the lifecycle.