DaletGuard supports civilians affected by armed conflict through Families Beyond War. All sides, no political affiliation. About our humanitarian work

Document Run Retention Settings Explained

Run retention settings decide how long DaletParse keeps the result of each service job before it deletes the run folder. The code sets a default window of 168 hours, and an operator can pick any number from one to 720. Shorter windows leave less stored data on disk, while longer windows give callers extra time to fetch each finished result. One setting, one cleanup pass and a clear rule for uploaded files keep storage under control. Your own policy then decides which number you choose.

The wider workflow sits in the document intake workflow guide.

Illustration of lock, scale, shield for run retention settings
Key takeaway

Tenant jobs expire after 168 hours by default, and an operator can set any whole number from 1 to 720. The uploaded file is deleted when the job ends, and the results are removed at expiry. The rule does not cover web workspace runs.

What the run retention settings control in one service job

A service job enters through the tenant token routes. First, the job index writes a row with a status and a created time. Next, it adds an expiry time, which is the created time plus the window. Therefore, tenant run expiry starts the moment a job is accepted.

The default window is 168 hours, which is seven days. An environment variable named DALETPARSE_RUN_RETENTION_HOURS sets it. The value must be a whole number from 1 to 720, and the top value equals thirty days. These run retention settings apply to every tenant run on the service.

A bad value is not ignored. Instead, the check raises an error, and protected routes answer 503. Likewise, the web app fails at boot. As a result, a typo cannot silently keep data for years.

The public job record shows the expires_at value. Consequently, a caller can read the end date from the job list and plan its fetch before then. The batch queue article shows how that list is read.

How the cleanup pass finds and deletes expired run folders

The cleanup pass behind run retention settings runs at boot. It also runs when a protected route is called, but at most once every five minutes. Tenant run expiry therefore depends on traffic, not on a clock. A quiet service can keep an expired run until the next request or restart.

Only runs in a terminal state are removed, which means completed or failed. A queued or running job is never deleted, even when its expiry time has passed. Likewise, the pass skips any row that lacks a valid owner digest or a valid expiry.

The pass is also careful with paths. First, it skips symbolic links, and second, it skips any folder whose parent is not the runs root. When a folder goes, its index row goes with it. Therefore, good run retention settings depend on this narrow, safe deletion.

How an operator can check that the pass has run

The boot line in the queue log reports two counts. First, it counts the stalled jobs it marked as failed. Second, it counts the expired runs it removed. Therefore, a restart leaves a visible trace.

For routine checks, compare the expires_at values in the job list with the folders on disk. First, find a folder past its expiry. If it is still there, no protected route has been called since.

DaletParse Activity: Tenant run expiry screen

Why uploaded input files are deleted before the window ends

A finished tenant job loses its upload at once. This input file deletion happens after success, after failure and after a timeout. Moreover, the step sits in a final block, so a crash in the pipeline does not skip it. Input file deletion is thus reliable.

Under these run retention settings, only the result files wait for the end date. The input file often holds the most sensitive page images, and it is gone much sooner. If a delete fails, the code logs the error type name, but it does not log the file name.

Also, upload folders use owner-only permissions. The run folder is created with mode 0700, and the saved files use mode 0600. Meanwhile, the analyze route goes further, because it removes its whole working folder before it replies.

  • Input file deletion removes the upload when the job ends.
  • The result files stay until the expiry time.
  • The analyze route keeps nothing after its reply.

Which runs the retention window does not cover at all

The cleanup handles tenant run expiry only. Several other runs fall outside it. A team should know each one before it relies on the setting.

  1. Web workspace runs follow the retention period your administrators set for them.
  2. Jobs from the multi-file statement route follow the same administrator setting.
  3. Debug conversations, which hold prompts and responses, are written under a debug folder that the pass does not touch.

An internal assessment of the code adds a warning for web workspace runs. It places run folders on encrypted storage with access limited to named staff. Administrators set their retention period with the same care. Therefore, the host operator needs a manual cleanup rule for web workspace runs and for debug files.

In addition, backups, log shipping and disk snapshots sit outside the code, as do web workspace runs. Likewise, any copy that your own callers make is outside the setting. Add each of them to your retention note, as the security controls page advises.

How to choose a retention window for your own team

Tune run retention settings to caller behavior. A caller that polls and fetches within minutes needs a short window. In contrast, a caller that may be offline over a weekend needs a longer one.

Next, check what reviewers need from run retention settings. If a reviewer may need to reopen a result, the window must cover that period. However, a reviewer should not depend on the service as a filing cabinet.

Finally, think about data minimization. Tenant run expiry should match how long reviewers reopen results. The shorter the window, the less personal data waits on disk. Your counsel confirms which duties apply to your files.

Illustration for Document Run Retention Settings Explained

How a caller can keep each result on its own side

The safest pattern for run retention settings is simple. First, the caller polls until the job is complete. Then it stores the result in its own system. After that, the copy in the service is a convenience, not the record.

  • Fetch the result as soon as the status shows completed.
  • Store it under your own access rules and your own retention rule.
  • Keep the run identifier next to it, so that you can trace the source.

What a written retention note should say before launch day

Overall, a short note beats a good intention. It should name the window and the person who may change it. It should also say how a change to run retention settings is tested. The value is an environment variable, so a restart applies it.

Next, the note should list each place where data waits. Those places are tenant runs, web workspace runs, debug files, backups and caller copies. For each place, name the owner and the rule for input file deletion and expiry. In addition, record the run retention settings in force when each batch was processed.

The job recovery rules explain why failed runs also wait for their expiry.

Set the window on purpose and write the choice down

These settings are small but they shape results. The default of 168 hours is a starting point for run retention settings, not a recommendation. Therefore, pick a number for the run retention settings from your callers and reviewers, then record it. Input file deletion is early, but result files wait.

Remember the edges. Tenant run expiry does not reach web workspace runs, the multi-file route or debug files. For the full list of controls, read the security controls page.

For general guidance, the NIST Privacy Framework (opens in new tab) describes data minimization. The FTC business guidance (opens in new tab) covers duties of care for consumer data.

A diagram of 3 connected steps, each with a small drawing: Input file deletion, Tenant run expiry, Web.

Questions and answers on this topic from the product team

What is the default for run retention settings?

The default window is 168 hours, which equals seven days. An operator sets it with an environment variable, and the value must be a whole number from 1 to 720. Any other value is rejected, so a typo cannot quietly keep stored data.

When is the uploaded file deleted?

For tenant jobs, the uploaded file is deleted when the job ends, whether it succeeded, failed or timed out, and the results stay until the expiry. The analyze route goes further and removes its whole working folder before it replies.

Do web workspace runs expire too?

Yes. Web workspace runs follow the retention period your administrators set for them, alongside the 168-hour default for service jobs.

How often does the cleanup pass run?

It runs at boot, and it runs again when a protected route is called, at most once every five minutes. A quiet service can therefore keep an expired run until the next request or restart. The boot log reports how many expired runs it removed.

Can the cleanup delete a running job?

Only runs in a terminal state, completed or failed, are removed. A queued or running job stays, even after its expiry has passed. The pass also skips symbolic links and any folder outside the runs root.

See how DaletParse fits the providers your team uses today

Book a short meeting for a walkthrough with your own providers in mind, or join an in-person class to learn the method first.