Skip to content

fix: compute project name lazily for notification titles (#736) - #740

Merged
will-lamerton merged 2 commits into
Nano-Collective:mainfrom
DeepamJha:fix/stale-notification-project-name
Aug 5, 2026
Merged

will-lamerton merged 2 commits into
Nano-Collective:mainfrom
DeepamJha:fix/stale-notification-project-name

Conversation

@DeepamJha

Copy link
Copy Markdown
Contributor

Closes #736

Description

projectName was previously captured once at module load time via a
top-level const projectName = basename(process.cwd()), and baked
directly into each notification title string in EVENT_MESSAGES. If
the user changed directories mid-session with /cd, notification
titles kept showing the original folder name for the rest of the
session.

Fixed by changing EVENT_MESSAGES[event].title from a static string
to a function (projectName: string) => string, and computing
basename(process.cwd()) fresh inside sendNotification() right
before each notification fires — so titles always reflect the
current working directory, not the one at load time.

Type of Change

  • Bug fix

Changeset

  • Added a changeset (pnpm changeset --empty)

Testing

Automated Tests

  • All existing tests pass (pnpm test:all)

Ran the suite on both main and this branch to isolate any
regressions: main currently has 63 pre-existing failing tests
unrelated to this change; this branch shows 64. Still confirming
whether that 1-test gap is caused by this change or is
flakiness/pre-existing — will update this PR if I find anything
notification-related.

Manual Testing

Reviewed the change against the reported repro steps in #736 — the
fix directly addresses the module-load-time evaluation described
in the issue.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No breaking changes

…module-level projectName constant, which was evaluated once at load time and went stale after /cd. Notification titles now compute the project name at fire time inside sendNotification() instead, so they always reflect the current working directory. Closes Nano-Collective#736
@will-lamerton

Copy link
Copy Markdown
Member

Hey @DeepamJha - this is great but the changeset is empty, can you fill in please? :)

@DeepamJha

Copy link
Copy Markdown
Contributor Author

@will-lamerton Good catch, just added a proper changeset summary.

@DeepamJha

Copy link
Copy Markdown
Contributor Author

The CI failure is unrelated to this change, coverage threshold failing on fetch-models.ts, mcp-templates.ts, and provider-templates.ts, none of which this PR touches. Let me know if anything else is needed.

@akramcodez akramcodez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM great work @DeepamJha

@will-lamerton
will-lamerton merged commit d6904c6 into Nano-Collective:main Aug 5, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Notification Title Shows Stale Project Name After cd in Session

3 participants