Skip to content

fix(app): open projects to new session#407

Merged
Astro-Han merged 1 commit into
devfrom
codex/fix-startup-new-session
May 3, 2026
Merged

fix(app): open projects to new session#407
Astro-Han merged 1 commit into
devfrom
codex/fix-startup-new-session

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

Open PawWork projects to the project new-session route instead of automatically restoring a remembered or latest session. Remove the persisted lastProjectSession state and its route-writing paths.

Why

Opening the app or a project should feel like a clean workspace. Automatically jumping into an old session can put users in stale context and make new prompts easy to send to the wrong conversation.

Related Issue

No linked issue. This follows the maintainer discussion in Codex.

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

Please focus on the project-open routing behavior in packages/app/src/pages/layout.tsx: explicit session entry points should still work, while project open/startup paths should land on /{project}/session.

Risk Notes

Behavior change: users who previously relied on automatic restoration of a project-specific old session will now land on the project new-session route. Existing persisted lastProjectSession data is left unused rather than migrated.

How To Verify

Focused layout helper test: 26 passed, 0 failed (`bun test --preload ./happydom.ts src/pages/layout/helpers.test.ts` from packages/app)
App typecheck: passed (`bun run typecheck` from packages/app)
Diff check: no whitespace errors (`git diff --check`)
Source search: no `lastProjectSession`, `rememberSessionRoute`, or `clearLastProjectSession` references remain under packages/app/src

Screenshots or Recordings

Not included. This changes startup/project routing behavior without changing visual styling or copy.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, scope, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for desktop, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • Refactor

    • Streamlined project switching navigation with simplified session route handling
    • Reduced stored session metadata for improved efficiency
  • Tests

    • Added test coverage for project session route targeting

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fc3ebafa-4e2e-4fdf-9072-d94619faeb24

📥 Commits

Reviewing files that changed from the base of the PR and between cd8d47f and 22473af.

📒 Files selected for processing (3)
  • packages/app/src/pages/layout.tsx
  • packages/app/src/pages/layout/helpers.test.ts
  • packages/app/src/pages/layout/helpers.ts

📝 Walkthrough

Walkthrough

The PR simplifies project session routing by removing persisted "last project session" state and session-resolution logic. Navigation to projects now uses a new projectSessionRouteTarget helper that returns a target directory directly, eliminating multi-step API calls and prior session lookups.

Changes

Session Routing Simplification

Layer / File(s) Summary
Routing Helper
packages/app/src/pages/layout/helpers.ts
New exported projectSessionRouteTarget(root: string) function returns { directory: root } for route targeting.
Core Navigation Logic
packages/app/src/pages/layout.tsx (lines 1431–1433)
navigateToProject(directory) refactored to derive a single target via projectSessionRouteTarget(root) and navigate directly, removing prior multi-step session resolution and API calls.
Session Synchronization
packages/app/src/pages/layout.tsx (lines 1417–1420, 1888–1892)
syncSessionRoute simplified to perform viewing/expansion/scroll updates; active-route sync now sets activeRoute.sessionProject to root instead of calling removed rememberSessionRoute.
Persisted State
packages/app/src/pages/layout.tsx (lines 99–104, 1602–1605)
lastProjectSession map removed from layout store initialization; workspace-deletion cleanup that cleared per-project session entries is also removed.
Tests
packages/app/src/pages/layout/helpers.test.ts
New test case verifies projectSessionRouteTarget("/Users/demo/PawWork") returns expected { directory } object.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

bug, P2, app

Poem

🐰 A hop through history, no more to store—
Last sessions forgotten, routes lean and pure,
One helper now guides where three once would pour,
Navigate swift, persist less, explore!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(app): open projects to new session' clearly summarizes the main behavioral change: projects now open to a new session route instead of restoring remembered sessions.
Description check ✅ Passed The PR description includes all required template sections with substantial detail: summary, why, related issue, human review status, review focus, risk notes, verification steps, and a completed checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-startup-new-session

Review rate limit: 8/10 reviews remaining, refill in 8 minutes and 48 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added bug Something isn't working app Application behavior and product flows P2 Medium priority labels May 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the project navigation logic by removing the functionality that tracks and restores the last active session for a project. It removes the lastProjectSession state from the persisted store, deletes the helper functions rememberSessionRoute and clearLastProjectSession, and refactors the navigation logic to use a new projectSessionRouteTarget helper that defaults to the project's root session route. I have no feedback to provide.

@Astro-Han Astro-Han merged commit 22e6d5f into dev May 3, 2026
27 of 28 checks passed
@Astro-Han Astro-Han deleted the codex/fix-startup-new-session branch May 3, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P2 Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant