Skip to content

Add evidence-backed terminal outcome learning#21

Merged
OgeonX-Ai merged 4 commits into
masterfrom
codex/loop-learning-pr
Jul 1, 2026
Merged

Add evidence-backed terminal outcome learning#21
OgeonX-Ai merged 4 commits into
masterfrom
codex/loop-learning-pr

Conversation

@OgeonX-Ai

Copy link
Copy Markdown
Contributor

Summary\nAdds idempotent terminal goal outcomes and review-gated lesson candidates, exposed through a dedicated MCP tool.\n\n## Changes\n- Persist one terminal outcome per goal\n- Require evidence and a bounded summary\n- Keep lesson candidates pending until explicit approval\n- Add record_terminal_outcome to the MCP surface\n- Isolate test blackboard and global history writes\n\n## Why\nLearning must consume terminal evidence exactly once and must never inject unapproved lessons into future work.\n\n## Validation\n- TypeScript build passed\n- 53 test files passed\n- 394 tests passed\n- MCP all-tool acceptance passed\n\n## Risks\n- Existing databases receive an additive schema migration\n- The new MCP tool writes terminal metadata but does not auto-approve lessons\n\n## Related\nCAS Loop Engineering milestone v1.\n\n## Reviewer notes\nStart with universal-refiner/src/history/event-store.ts and the new MCP dispatcher case.

@OgeonX-Ai OgeonX-Ai marked this pull request as ready for review July 1, 2026 20:10
@OgeonX-Ai OgeonX-Ai merged commit 0d957cb into master Jul 1, 2026
7 checks passed
@OgeonX-Ai OgeonX-Ai deleted the codex/loop-learning-pr branch July 1, 2026 20:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7327e9f476

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

);

CREATE TABLE IF NOT EXISTS terminal_outcomes (
goal_id TEXT PRIMARY KEY,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope terminal outcomes by repository

When the shared event store is used for multiple repositories, this primary key makes goal_id globally unique even though the table also stores repo_id and the MCP server writes the current repository ID. If two repos report the same goal ID (for example a common run/goal name), the second insert is ignored by INSERT OR IGNORE, so that repo silently loses its terminal outcome and any associated learning candidate. Make idempotency apply per repo, e.g. with a composite key including repo_id.

Useful? React with 👍 / 👎.

Comment on lines +570 to +575
const outcome = z.object({
goal_id: z.string().min(1),
status: z.enum(["completed", "failed", "cancelled", "blocked", "budget_exhausted"]),
evidence: z.array(z.string().min(1)).min(1),
summary: z.string().min(1),
}).parse(request.params.arguments);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept lesson candidates in the MCP outcome tool

The new tool description says it can record an optional review-gated lesson candidate, and recordTerminalOutcome only creates that pending lesson when outcome.candidate is present, but this dispatcher schema parses only goal/status/evidence/summary. As a result, clients using the advertised MCP surface have no way to submit the candidate, so list_learning_candidates remains empty after terminal-outcome recording; include and validate the candidate fields here and in the advertised input schema if this tool is meant to seed review-gated lessons.

Useful? React with 👍 / 👎.

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