Skip to content

Fix/operational recovery journal hardening - #1216

Open
gonos2k wants to merge 29 commits into
PrimeIntellect-ai:mainfrom
gonos2k:fix/operational-recovery-journal-hardening
Open

Fix/operational recovery journal hardening#1216
gonos2k wants to merge 29 commits into
PrimeIntellect-ai:mainfrom
gonos2k:fix/operational-recovery-journal-hardening

Conversation

@gonos2k

@gonos2k gonos2k commented Aug 11, 2026

Copy link
Copy Markdown

Harden operational recovery journals with tail repair, strict validation, and atomic writes

  • Adds tail-repair logic to orphan process, worker recovery, and command recovery journals: on startup, any incomplete final append is either truncated or newline-terminated before new records are written.
  • Strict JSON schema validation now rejects malformed or logically inconsistent complete records with a descriptive error (line number + reason) instead of silently skipping them.
  • Introduces writeAllSync to guarantee full buffer writes by looping on short-write OS reports, used by all journal append and compact paths.
  • Append paths now open with 'a+', capture original file size, fsync after write, and truncate back to the prior size on failure; compact paths use atomic temp-file rename with fsync.
  • Adds automatic continuation of token-truncated assistant responses (up to 3 hidden prompts) in AgentSession, with a user-visible exhaustion notice when the cap is reached.
  • Post-compaction maintenance is now time-bounded; failures surface as a warning message rather than stalling compaction. Scheduler suspension ownership is tracked through manual compaction and abort flows to prevent unintended turn starts.
  • Risk: token estimation for non-ASCII and punctuation-heavy content is now higher than the previous chars/4 heuristic, which shifts compaction thresholds and cut-point selection.

Macroscope summarized fc9b6e4.

gonos2k and others added 29 commits August 9, 2026 13:28
ci: run prime-agent-runtime Python tests across supported versions
fix(coding-agent): harden daemon command recovery journal invariants
…tract

fix(coding-agent): complete command journal tail and acknowledgement recovery
fix(coding-agent): complete daemon journal writes before fsync
Keep MCP transport tests independent of optional SDK installation while asserting strict call shapes, lazy imports, header precedence, and async cleanup.
…gration-v2

fix(coding-agent): integrate compaction reliability hardening
…ening

fix(coding-agent): complete compaction lifecycle hardening
…g-followup

fix(coding-agent): complete compaction lifecycle hardening
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant