#22074: Fix/windows fstat dev mismatch
docs
agents
size: XS
Cluster:
Windows Compatibility Fixes
## Summary
Describe the problem and fix in 2–5 bullets:
- Problem:
- Why it matters:
- What changed:
- What did NOT change (scope boundary):
## Change Type (select all)
- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #
- Related #
## User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write `None`.
## Security Impact (required)
- New permissions/capabilities? (`Yes/No`)
- Secrets/tokens handling changed? (`Yes/No`)
- New/changed network calls? (`Yes/No`)
- Command/tool execution surface changed? (`Yes/No`)
- Data access scope changed? (`Yes/No`)
- If any `Yes`, explain risk + mitigation:
## Repro + Verification
### Environment
- OS:
- Runtime/container:
- Model/provider:
- Integration/channel (if any):
- Relevant config (redacted):
### Steps
1.
2.
3.
### Expected
-
### Actual
-
## Evidence
Attach at least one:
- [ ] Failing test/log before + passing after
- [ ] Trace/log snippets
- [ ] Screenshot/recording
- [ ] Perf numbers (if relevant)
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios:
- Edge cases checked:
- What you did **not** verify:
## Compatibility / Migration
- Backward compatible? (`Yes/No`)
- Config/env changes? (`Yes/No`)
- Migration needed? (`Yes/No`)
- If yes, exact upgrade steps:
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly:
- Files/config to restore:
- Known bad symptoms reviewers should watch for:
## Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write `None`.
- Risk:
- Mitigation:
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed Windows-specific filesystem verification bug and two agent lifecycle issues
This PR bundles four independent bug fixes:
**Changes:**
- `src/infra/fs-safe.ts:75,81` - Skipped `stat.dev` comparison on Windows where path-based stat returns `dev: 0` while handle-based fstat returns the volume serial number, causing false TOCTOU (time-of-check-time-of-use) path mismatch errors that broke local media reads
- `src/agents/pi-embedded-subscribe.handlers.lifecycle.ts:85-108` - Added `agent_end` hook firing in streaming mode (previously only fired in non-streaming path)
- `src/agents/pi-embedded-subscribe.handlers.types.ts:80` - Added `agentStartedAt` timestamp tracking for duration calculation in the `agent_end` hook
- `src/agents/subagent-announce.ts:472-486` - Changed from `send` to `agent` gateway method for subagent completion announcements to fix Telegram channel resolution failures during plugin initialization
- `docs/style.css:24-27` - Formatting-only change (multi-line CSS transition property)
**Potential Concerns:**
- The `extensions/bluebubbles/src/media-send.ts:153` file still uses the unconditional `stat.dev` comparison and may experience the same Windows issue, though it appears to gracefully continue to the next root on mismatch
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk
- Score reflects three well-isolated bug fixes with clear issue references and commit messages. The Windows filesystem fix addresses a real platform-specific behavior difference (path-based vs handle-based stat returning different dev values on NTFS). The agent lifecycle fixes restore missing hook calls and use the correct gateway method. All changes are defensive (adding platform checks or restoring dropped functionality). Minor concern: similar pattern in bluebubbles extension may need the same Windows fix
- Check `extensions/bluebubbles/src/media-send.ts` for the same Windows `stat.dev` comparison issue
<sub>Last reviewed commit: 5586e21</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
77.2%
#22178: test(web): allow fixture roots in media local file tests
by Kansodata · 2026-02-20
76.1%
#21463: fix(discord): prevent WebSocket death spiral + fix numeric channel ID…
by akropp · 2026-02-20
75.8%
#18924: fix(security): tighten permissions on cron/, browser/, settings/ dirs…
by rexlunae · 2026-02-17
75.7%
#21679: fix: Mission Control dashboard issues for agent status, stale sessi...
by thejawdoc · 2026-02-20
75.2%
#21215: Windows PowerShell reliability fixes (exec shim + Discord numeric p...
by musosoft · 2026-02-19
74.8%
#17007: fixed stacy voice
by tashen247 · 2026-02-15
74.2%
#19399: telegram: fix MEDIA false positives and partial final drop
by HOYALIM · 2026-02-17
73.6%
#19500: Custom rust ultimate rewrite
by adybag14-cyber · 2026-02-17
73.3%
#18493: making pnpm build:ui and pnpm build to work on windows
by darkpowerxo · 2026-02-16
73.3%