Skip to content

feat: align LCM with Codex continuity and whitepaper control flow - #527

Open
codejeet wants to merge 2 commits into
stephenschoettler:mainfrom
codejeet:feat/codex-whitepaper-reliability
Open

codejeet wants to merge 2 commits into
stephenschoettler:mainfrom
codejeet:feat/codex-whitepaper-reliability

Conversation

@codejeet

@codejeet codejeet commented Aug 14, 2026 •

Copy link
Copy Markdown

Summary

  • add lossless opaque Codex reasoning and native-compaction continuity without exposing capsules through FTS, summaries, inspection, or expansion
  • add explicit soft/hard compaction, deterministic convergence, file lineage, and persistent llm_map / agentic_map operators
  • make concurrent SQLite ownership and lock recovery durable, and bound restart reconciliation over large externalized-output archives

Why

Long-running concurrent gateway sessions exposed two production failures: restart reconciliation repeatedly scanned a 12,799-file, roughly 540 MB archive, and cloned engines could contend over independently owned SQLite helpers. The first failure pushed a 590K-token resume beyond the 30-second host timeout. The bounded lookup and per-pass identity cache reduce that reconciliation to roughly 2 seconds while preserving every source row and externalized payload.

Validation

  • Focused validation: 483 passed
  • Default validation:
    • pytest tests/test_lcm_core.py tests/test_lcm_engine.py tests/test_packaging_install.py -q
    • pytest -q: 2,846 passed, 1 skipped
    • low-FD pytest at ulimit -n 1024: 2,846 passed, 1 skipped
    • scripts/validate_release.sh --full --keep-going: all gates passed
    • benchmark smoke, stress smoke, and release stress tier: zero failures
    • git diff checks for origin/main...HEAD, working tree, and staged tree
    • Python compileall, script py_compile, and shell syntax checks
  • Workflow validation not applicable: workflow files are unchanged

Notes

  • Scope is broad because the storage, compaction, provider-state, and operator invariants share one schema and lifecycle boundary; the commit keeps the existing plugin name, engine name, and database path compatible.
  • Background compaction remains opt-in.
  • The separate Hermes gateway-core teardown patch is intentionally excluded from this plugin PR.
  • Validation started and ended with a clean git status.

Add provider-native Codex continuity, deterministic map operators, shared storage ownership, durable lock recovery, large-file lineage, bounded restart reconciliation, and explicit soft/hard compaction behavior while preserving existing Hermes plugin and storage compatibility.

Constraint: Preserve plugin name, context engine name, and database compatibility

Rejected: Raise compression timeouts | leaves archive scanning unbounded and masks the restart defect

Confidence: high

Scope-risk: broad

Reversibility: clean

Directive: Keep opaque provider capsules out of FTS, summaries, inspection, and public expansion

Tested: 2,846 tests passed with one expected skip; Ruff; compileall; shell syntax; live 590K-token gateway auto-resume

Not-tested: GitHub Actions Python 3.13/3.14 runners before PR publication
@codejeet
codejeet marked this pull request as ready for review August 14, 2026 07:59
Restarted gateway sessions can contain thousands of replay rows, transient host placeholders, and rewritten Discord messages. Reconcile them with linear-time prefix/suffix matching, a conservative durable-tail anchor for very large histories, and an indexed tool-result archive lookup.

Constraint: Preserve ambiguous short deltas and immutable stored payloads
Rejected: Raise the 30-second timeout | masks quadratic work and continued duplicate ingestion
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep the 4096/1024 large-replay anchor conservative unless production evidence and replay-safety tests justify changes
Tested: 1071 core and engine tests; exact 8964-message production replay in 2.136 seconds; 9000-message mismatch in 0.14 seconds
Not-tested: Destructive cleanup of pre-existing duplicate LCM rows
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