Skip to content

fix(MEMMY-411, MEMMY-413): unify Codex L1 capture across hooks and scans - #391

Merged
syzsunshine219 merged 4 commits into
MemTensor:v1.1.5from
origami-chen:cjq_dev/fix_l1_memory
Sep 10, 2026
Merged

syzsunshine219 merged 4 commits into
MemTensor:v1.1.5from
origami-chen:cjq_dev/fix_l1_memory

Conversation

@origami-chen

Copy link
Copy Markdown

Description

Summary

This PR fixes three problems in Codex L1 memory capture:

  • Hooks and offline scans could create duplicate memories for the same turn.
  • Offline-created memories lacked Session and Episode associations, preventing
    reflection and reward processing and limiting subsequent L2 generation.
  • Hooks missed custom_tool_call and custom_tool_call_output events, leaving
    tool information incomplete.

Root cause: hooks and offline scans used separate parsing and ingestion paths,
with inconsistent identity handling, deduplication and lifecycle associations.

Fix:

  1. Share native turn parsing and normalized content between both channels.
  2. Use a shared submission service with persistent turn identity and atomic
    writes to prevent duplicate L1 creation across channels and retries.
  3. Create or reuse Session, Episode and RawTurn associations consistently,
    preserving the existing Hook session and its user/project scope.
  4. Preserve tool inputs, outputs and status, matching results by call ID
    instead of array position.

Hooks remain the primary capture path; offline scans fill missing turns through
the same L1 lifecycle.

This rollout targets Codex. Other agents retain their existing ingestion paths.

Related CodeUp Issue: MEMMY-411, MEMMY-413

Type of change

  • Bug fix

How Has This Been Tested?

  • Full repository npm test completed successfully.
  • Targeted regression tests covering parsing, Hook execution, scanning,
    HTTP submission, deduplication, lifecycle associations and tool pairing.
  • npm run lint and npm run typecheck.
  • Release workflow tests: 30 passed, 5 skipped.
  • Packaging guard tests: 31 passed.
  • macOS arm64 CN unsigned package built and manually installed:
    App 1.1.3 / Memory 2.1.2-identity.20260909.

Full-suite results:

  • Memory: 860 passed, 1 skipped.
  • Migrations: 117 passed, 1 skipped.
  • AgentSourceCore: 36 passed.
  • Backend: 850 passed.
  • Local API contracts: 8 passed.
  • Frontend: 1,545 passed.
  • Desktop: 249 passed, 106 skipped.
  • TUI cursor: 5 passed.

Memory runs twice in the default npm test command; both runs passed.
Skipped tests are reported separately and are not counted as passing.

Manual verification confirmed that:

  • Hook-created L1 memories retain lifecycle IDs and tool results.
  • Subsequent scans reuse existing memories without creating duplicates.
  • Offline-created L1 memories can enter reflection processing.

Checklist

  • Completed self-review.
  • Added regression coverage for the fixes.
  • Recorded implementation and validation results in the development notes.
  • Link the related CodeUp issue.
  • Assign a reviewer.

Reviewer Checklist

  • Confirm the changes address the reported problems.
  • Verify CI results and test coverage.
  • Confirm the Codex rollout scope and remaining limitations.

Deduplicate native turns through a shared ingestion path and preserve
Session, Episode and RawTurn associations for scanned memories.

Capture custom tool calls and outputs, and pair results by call ID.
…mory

# Conflicts:
#	App/backend/src/services/agent-source-service.ts
#	Memory/src/agent-source/runtime.ts
#	scripts/internal/mac/build-dmg.sh
Align the packaged runtime regression with the workspace-based
AgentSourceCore staging flow and verify the parser package and
Hook bridge are included in the macOS runtime.
@syzsunshine219
syzsunshine219 merged commit da1d6bc into MemTensor:v1.1.5 Sep 10, 2026
5 checks passed
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.

2 participants