# NousResearch/hermes-agent · File locking for concurrent trajectory JSONL writes

## Open now

- Nothing open on GitHub.

A bug report and multiple fix attempts addressing the lack of file locking in save_trajectory(), which can cause JSONL output corruption when multiple processes write concurrently. Members propose using fcntl.flock or similar mechanisms as a remedy.

## TL;DR

- 5 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #109192. Verify it addresses your case.
- **Recommended:** read PR #109192 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-109192`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.40`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #12684: \[Bug\]: save_trajectory() has no file locking — concurrent processes corrupt JSONL output

## Prior & competing PRs

- **#109192: fix(agent): concurrent save_trajectory() appends no longer corrupt the JSONL (#12684, salvage #12685)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/trajectory.py`, `contributors/emails/[redacted:email]`, `tests/agent/test_trajectory_file_locking.py`
- **#12685: fix(agent): add fcntl.flock to save_trajectory to prevent JSONL corru…**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `330004e597`, `#109192`
- **#12713: fix(trajectory): add file locking to prevent JSONL corruption under concurrent writes**. closed without merge
  - maintainer direction: category `stale_abandoned`; implication `active`
- **#13218: fix(trajectory): add file locking to save_trajectory() to prevent concurrent JSONL corruption**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `330004e597`, `#109192`

## Fix status

- Merged to main in PR #109192 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-09-12`.
- Subsystem: `agent`
