Build Agentic Organization package architecture slice#5071
Merged
Conversation
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Resolve PR #4990's DIRTY merge gate by replaying the branch against current origin/main from the claimed off-root worktree. Co-Authored-By: Codex <noreply@openai.com> Codex-Origin: codex-launchd-loop Codex-Surface: codex-background-service Codex-Loop-Run-Id: 20260525T214234Z
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Add command outcome persistence so handlers return typed effects and the pipeline records idempotency, state, audit, and outbox through one generic port. Add Cockroach transaction seams for command and event-ingestion outcomes, including receipt-claim race handling and SQL null normalization. Strengthen governance/docs so vendor-specific adapters stay behind generic Organization interfaces.\n\nCo-Authored-By: Codex <noreply@openai.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…kage-ca-clean # Conflicts: # agentic-organization/packages/messaging/test/outbox-publisher.test.ts
There was a problem hiding this comment.
Pull request overview
This PR expands the Agentic Organization TypeScript “package-first” slice by adding inbound event ingestion (with inbox dedupe + reaction plan persistence), a worker host/app runtime composition layer, and governance/observability contracts to keep adapters behind ports and keep tests out of production source trees.
Changes:
- Adds event ingestion processor + stores (in-memory + Cockroach adapter) to support inbox receipts, payload-conflict detection, and reaction plan persistence behind generic ports.
- Adds
@agentic-org/workersrun-once worker host and anapps/workersruntime shell that composes worker + NATS consumer loops and records telemetry. - Extends governance checks (dependency boundaries + source layout), observability helpers (worker cycle + NATS consumer batch attributes), and updates OpenSpec/docs to match the new slice contracts.
Reviewed changes
Copilot reviewed 67 out of 67 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openspec/specs/agentic-organization/spec.md | Adds scenarios for effect-returning command handlers, vendor boundaries, source layout governance, event ingestion/NATS consumer behavior, and worker/runtime expectations. |
| agentic-organization/tsconfig.json | Includes apps/**/*.ts in typechecking. |
| agentic-organization/packages/workers/test/worker-host.test.ts | Adds worker-host tests covering bounded cycles, idle, degraded lanes, and per-event failure handling. |
| agentic-organization/packages/workers/src/worker-host.ts | Introduces run-once worker host composing outbox publishing + inbound ingestion via ports. |
| agentic-organization/packages/workers/src/index.ts | Exports worker host types/constructors. |
| agentic-organization/packages/state/src/index.ts | Re-exports event-ingestion store types and in-memory store factory. |
| agentic-organization/packages/state/src/in-memory-organization-store.ts | Switches to single recordCommandOutcome persistence port (idempotency + effects). |
| agentic-organization/packages/state/src/event-ingestion-store.ts | Adds generic event-ingestion store port + in-memory implementation for receipts/reaction plans. |
| agentic-organization/packages/state-cockroach/test/cockroach-schema.test.ts | Updates schema test to include inbox receipts + reaction plan tables. |
| agentic-organization/packages/state-cockroach/test/cockroach-outbox-event-source.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/state-cockroach/test/cockroach-event-ingestion-store.test.ts | Adds Cockroach event-ingestion store tests for claim/transaction batching + null normalization. |
| agentic-organization/packages/state-cockroach/test/cockroach-command-state-store.test.ts | Adds Cockroach command outcome transaction batching + replay/conflict behavior tests. |
| agentic-organization/packages/state-cockroach/src/index.ts | Exports Cockroach event-ingestion store adapter. |
| agentic-organization/packages/state-cockroach/src/cockroach-schema.ts | Adds inbox receipts and reaction plans tables to Cockroach schema generation. |
| agentic-organization/packages/state-cockroach/src/cockroach-event-ingestion-store.ts | Implements Cockroach-backed inbox receipt + reaction plan persistence behind SQL executor seam. |
| agentic-organization/packages/state-cockroach/src/cockroach-command-state-store.ts | Refactors command persistence to recordCommandOutcome with transaction boundary + claim semantics. |
| agentic-organization/packages/state-cockroach/src/cockroach-command-state-store.test.ts | Removes old in-src test (migrated to test/). |
| agentic-organization/packages/state-cockroach/migrations/0001_agentic_org_core_state.sql | Extends migration with inbox receipts + reaction plans tables. |
| agentic-organization/packages/runtime/test/event-ingestion.test.ts | Adds tests for inbox dedupe, payload conflicts, and pending-receipt retry behavior. |
| agentic-organization/packages/runtime/test/event-automation.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/runtime/src/reaction-plan.ts | Re-exports reaction plan types from domain instead of defining duplicates. |
| agentic-organization/packages/runtime/src/index.ts | Exports event-ingestion processor public API. |
| agentic-organization/packages/runtime/src/event-ingestion.ts | Adds runtime event ingestion processor: inbox check → rule eval → record outcome via store port. |
| agentic-organization/packages/README.md | Updates package list, slice flow, and validation commands to include workers + inbound ingestion. |
| agentic-organization/packages/observability/test/workflow-visibility.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/observability/test/span-attributes.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/observability/test/nats-consumer-attributes.test.ts | Adds tests for NATS consumer batch attribute projection. |
| agentic-organization/packages/observability/src/worker-cycle-attributes.ts | Adds worker-cycle attribute projection helper. |
| agentic-organization/packages/observability/src/nats-consumer-attributes.ts | Adds NATS consumer batch attribute projection helper. |
| agentic-organization/packages/observability/src/index.ts | Exports new observability helpers. |
| agentic-organization/packages/messaging/test/subject-builder.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/messaging/test/outbox-publisher.test.ts | Updates expected messaging domain + subject shape; fixes import path. |
| agentic-organization/packages/messaging/src/outbox-publisher.ts | Splits messaging domains (supervisor signal vs work item) and updates resolver. |
| agentic-organization/packages/messaging-nats/test/nats-jetstream-event-publisher.test.ts | Fixes test import path; updates subject expectation. |
| agentic-organization/packages/messaging-nats/test/nats-jetstream-event-consumer.test.ts | Adds tests for NATS consumer ack/terminate/DLQ/nack behavior and counters. |
| agentic-organization/packages/messaging-nats/src/nats-jetstream-event-consumer.ts | Adds NATS JetStream consumer adapter: decode → ingest → ack/nack/terminate + DLQ policy. |
| agentic-organization/packages/messaging-nats/src/index.ts | Exports new consumer adapter API. |
| agentic-organization/packages/governance/test/package-dependency-boundaries.test.ts | Adds governance tests for dependency boundaries + source layout + app boundary. |
| agentic-organization/packages/governance/src/package-dependency-boundaries.ts | Adds source layout validation and expands boundary rule taxonomy. |
| agentic-organization/packages/governance/src/package-dependency-boundaries.test.ts | Removes old in-src test (migrated to test/). |
| agentic-organization/packages/governance/src/index.ts | Exports new governance APIs/types. |
| agentic-organization/packages/domain/test/work-item-state-machine.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/domain/test/hat-communication-brief.test.ts | Fixes test import paths to use ../src/.... |
| agentic-organization/packages/domain/test/event-envelope.test.ts | Fixes test import path to use ../src/.... |
| agentic-organization/packages/domain/src/reaction-plan.ts | Introduces domain-owned reaction plan types/enums. |
| agentic-organization/packages/domain/src/index.ts | Exports reaction plan types/enums. |
| agentic-organization/packages/application/test/send-supervisor-signal.test.ts | Updates test to assert effect-returning handler outcome (no direct state writes). |
| agentic-organization/packages/application/test/command-pipeline.test.ts | Adds pipeline tests for outcome-port persistence, replay/conflict outcomes, and failure behavior. |
| agentic-organization/packages/application/src/ports.ts | Introduces recordCommandOutcome port and CommandEffects contract. |
| agentic-organization/packages/application/src/index.ts | Exports new handler outcome/ports/types. |
| agentic-organization/packages/application/src/handlers/send-supervisor-signal.ts | Refactors handler to return { result, effects } instead of writing state. |
| agentic-organization/packages/application/src/command-pipeline.ts | Refactors pipeline to persist via recordCommandOutcome and handle replay/conflict outcomes. |
| agentic-organization/packages/application/src/command-pipeline.test.ts | Removes old in-src test (migrated to test/). |
| agentic-organization/packages/application/src/command-handler-registry.ts | Updates handler contract to return typed outcome (result + effects). |
| agentic-organization/package.json | Updates test script glob to new test/ layout and includes app tests. |
| agentic-organization/docs/V0_EXECUTABLE_CONTRACT.md | Refines V0 contract language to route capability inputs through supervisor signals/triage. |
| agentic-organization/docs/TECHNICAL_CA_PACKAGE_ARCHITECTURE.md | Documents new vendor-port boundaries, ingestion/worker runtime behavior, and env contract. |
| agentic-organization/docs/README.md | Adds North Star alignment checkpoint doc to docs index. |
| agentic-organization/docs/NORTH_STAR_ALIGNMENT_CHECKPOINT.md | Adds alignment checkpoint doc capturing drift list and priorities. |
| agentic-organization/docs/FIRST_IMPLEMENTATION_SLICE.md | Updates slice description to include outcome persistence, ingestion, workers app shell, and telemetry. |
| agentic-organization/apps/workers/test/worker-runtime.test.ts | Adds tests for worker runtime loop orchestration + telemetry + degraded conditions. |
| agentic-organization/apps/workers/test/worker-config.test.ts | Adds tests for typed env parsing + validation errors. |
| agentic-organization/apps/workers/test/worker-composition.test.ts | Adds tests for composition root factory wiring. |
| agentic-organization/apps/workers/src/worker-runtime.ts | Adds workers runtime host: runs loops, records telemetry, returns healthy/degraded with failures. |
| agentic-organization/apps/workers/src/index.ts | Exports app runtime/config/composition APIs. |
| agentic-organization/apps/workers/src/config.ts | Implements typed env parsing for worker runtime config. |
| agentic-organization/apps/workers/src/composition.ts | Adds composition root that binds config + ports to runtime. |
| agentic-organization/apps/workers/README.md | Documents responsibilities/boundaries/config contract for apps/workers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@agentic-org/policypackage and gates command execution through genericCommandAuthorizationPort/HatAuthorityPortchecks before idempotency lookup, handler dispatch, or persistence.Validation