## TL;DR
A file that never arrives is information, and the agent should report it, not crash on it. Poll the SFTP location on a sane interval with a deadline tied to the bank's delivery SLA, check for partial or differently named files, and at the deadline stop cleanly: mark the period's statement as missing, alert the team with the expected file details, and leave the job resumable for when the file lands. Distinguish late, renamed, and truly absent, because each has a different human fix.

```text
agent crashed when the SFTP statement file never arrived and the wait loop timed out
```

## Use this when
- The agent's log shows repeated file checks ending in a timeout crash with no statement processed.
- The expected file is absent from the SFTP directory for the period.
- Other periods' files from the same bank arrived normally.

## Not for this skill when
- The file is present but the agent cannot see it due to permissions or path. Fix access; the wait design is not the issue.
- The file arrives but is corrupt or empty. That is a bank file quality issue with its own escalation.

## Steps
1. List the SFTP directory for the expected window including partial, temporary, and differently dated names. Verify: the file is truly absent, renamed, or partially uploaded, stated from the listing
2. Confirm the bank's delivery schedule and any bank-side delay notices for the period. Verify: you know whether the bank considers the file sent
3. Replace the crash-prone wait with bounded polling: interval, deadline from the delivery SLA, and a clean exit state at the deadline. Verify: a simulated absence ends in a reported missing state, not a crash
4. Alert with specifics: bank, account, expected file name pattern, expected date, and where it was expected. Verify: the alert contains everything a human needs to chase the bank
5. When the file arrives, resume processing from the waiting state and reconcile the period normally. Verify: the late file processes end to end without manual surgery

## Variant phrasings
### SFTP statement file never arrived agent wait timeout
The missing-file phrasing.
### agent crashed waiting bank file missing delivery alert
When adding the absence alert.

Compatibility: SFTP statement delivery from banks to agent and integration polling jobs.

## Why it happens
File-based integration has no push notification; absence is ambiguous between not-yet, misnamed, misrouted, and never-sent. A wait loop with a hard crash treats all four as the same catastrophe and destroys the run's context. Bounded waiting with an informative exit respects the ambiguity: the agent contributes the evidence, timestamps, expected names, observed directory state, and humans contribute the bank relationship to resolve which absence it was.

## Edge cases / pitfalls
- Banks occasionally deliver to a dated subfolder or with the period-end date rather than the delivery date. Search patterns should cover both.
- A zero-byte or partial file usually means an interrupted upload; waiting a short grace period before processing prevents parsing a half file.
- Keep a delivery calendar per bank: expected day and time learned from history turns absence detection from a timeout into a schedule check.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_HvO2hP2-rggdnhwKyJsmLg
