← Back to PRs

#17624: Fix memory flush YYYY-MM-DD placeholder resolution

by grunt3714-lgtm open 2026-02-16 01:07 View on GitHub →
cli agents stale size: S
Fixes #17603. Memory flush prompts include a literal `YYYY-MM-DD` placeholder (e.g. `memory/YYYY-MM-DD.md`). Without a reliable date in context, models can guess the wrong year. This PR resolves the placeholder before invoking the embedded agent, using the configured user timezone (falling back to UTC). It also adds a small helper `formatUserDateYmd` and a unit test. Notes: - I did not run the full test suite locally (node_modules not installed in this environment); changes are small and covered by a new unit test file. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR bundles three independent fixes: 1. **Memory flush YYYY-MM-DD placeholder resolution** (`agent-runner-memory.ts`, `date-time.ts`, `date-time.test.ts`): Resolves the literal `YYYY-MM-DD` placeholder in memory flush prompts before invoking the embedded agent, using the user's configured timezone. Adds a well-tested `formatUserDateYmd` helper that uses `Intl.DateTimeFormat` with `en-CA` locale for reliable YYYY-MM-DD output. This is the core fix for #17603. 2. **Systemd user bus early guard** (`lifecycle.ts`): Adds early `isSystemdUserServiceAvailable()` checks in `runDaemonStart`, `runDaemonStop`, and `runDaemonRestart` to prevent `service.isLoaded()` from throwing on Linux systems without a systemd user bus. Returns gracefully with hints instead. 3. **`.venv` in skills watcher ignore list** (`refresh.ts`): Prevents Python virtual environments from triggering unnecessary skill reloads. - The memory flush fix is clean and follows existing codebase patterns for timezone resolution. - The `runDaemonStop` systemd guard computes `hints` but doesn't include them in the JSON emit (unlike `start`/`restart`) — minor inconsistency flagged. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minimal risk; the core date placeholder fix is correct and well-tested. - The memory flush YYYY-MM-DD fix is clean, well-tested, and follows existing codebase patterns. The systemd early guard and .venv ignore are low-risk additions. One minor inconsistency: `runDaemonStop` doesn't pass hints to the JSON emit unlike the other two lifecycle functions. Score is 4 rather than 5 because the PR bundles three unrelated changes (per CLAUDE.md: "Group related changes; avoid bundling unrelated refactors") and the author notes they did not run the full test suite locally. - Pay close attention to `src/cli/daemon-cli/lifecycle.ts` for the `runDaemonStop` hints inconsistency with `runDaemonStart` and `runDaemonRestart`. <sub>Last reviewed commit: 07d661a</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs