Skip to content

[Split of #672] Implement scoped Codex ingestion, exactly-once journalling, and bounded continuity #685

Description

@ssdavidai

Split child of #672

This issue was created by an explicit operator action because the parent plan was estimated at 21 points. It is not approved work. It starts in Inbox and will be independently specified from the latest source only after it is prioritized into a sprint.

Source plan: c5d4dd96f4cf838a26d96f942aebeffbddd4dfb02a8b197e5d770a1e739fecf1
Source base SHA: 4c79ab47bc12287aaae7a785bb25a12424547d2b
Proposed lane: I
Proposed job identity: api-672

Parent planning context

Freeze the Codex Desktop channel contract, add installation-scoped exactly-once ctrl-api ingestion and bounded revisioned continuity, ship a supported-hook macOS adapter with a durable outbox and visible health, and admit Codex source events into existing curation without creating a parallel LCM or memory authority.

Proposed paths

  • packages/ctrl/src/api/auth.ts
  • packages/ctrl/src/api/routes/alfredJournal.ts
  • packages/ctrl/src/api/routes/codexDesktop.ts
  • packages/ctrl/src/db/alfredJournal.ts
  • packages/ctrl/src/db/channelTokens.ts
  • packages/ctrl/src/db/codexDesktop.ts
  • packages/ctrl/tests/auth-codex-desktop.test.ts
  • packages/ctrl/tests/codex-desktop.test.ts

Contracts read

  • docs/CODEX-DESKTOP-CHANNEL-CONTRACT.md
  • packages/ctrl/CONTRACT.md

Contracts changed

  • None

Proposed dependencies

  • contract-672

Acceptance evidence

  • Operator-authenticated installation provisioning returns a cdx-prefixed credential once, stores only its hash, binds it to one principal and installation, supports rotation/revocation/expiry, and never grants access outside the frozen Codex endpoints.
  • Chunk ingestion validates installation, opaque session identity, monotonic sequence range, timestamps, role/direction, workspace metadata, and payload hash before transactionally creating one source event and one channel=codex journal row per turn.
  • Replaying an identical idempotency key returns the original acknowledgement without duplicate source, journal, or ingest records; changed payload reuse, overlapping sequence ranges, expired credentials, and cross-principal requests are rejected and audited without recording credential bytes.
  • A simulated failure between canonical state persistence and ingest.db mirroring is repaired by retry, making Codex material eligible for the existing learning feed without weakening canonical exactly-once journal/source semantics.
  • Captured event timestamps and Codex session/turn/workspace provenance survive in source and journal metadata, while One Alfred recent-journal reads can return the Codex exchange to permitted Hermes channels.
  • Continuity requests enforce principal isolation, revision-based no-change responses, six-item and 384-token contract limits, unseen-delta behavior, active task/matter/decision selection, and explicit non-blocking LCM/ctrl degradation.
  • Tests cover at least 25 turns over multiple chunks, duplicate replay, conflicting replay, restart-equivalent partial delivery, identity isolation, bounded context, redaction/deletion policy, and least-privilege route rejection.

Proposed verification

cd packages/ctrl && npm run build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions