Skip to content

fix(core): align Moirai F1 judgment contracts and Codex roadmap - #15

Merged
thisisjun786 merged 12 commits into
devfrom
codex/moirai-contract-alignment
Sep 13, 2026
Merged

thisisjun786 merged 12 commits into
devfrom
codex/moirai-contract-alignment

Conversation

@thisisjun786

@thisisjun786 thisisjun786 commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Change

#14의 F1 계약에서 긴 판단 설명문이 거부되고, 평가가 불완전한 행동 회차를 예산 소진으로 종료할 수 없던 문제를 수정합니다.

  • 새 판단·대화 설명문을 제한 길이로 자르고 원래 길이와 SHA-256을 기록합니다. 호출자가 넣은 잘림 기록은 거부하며, 저장된 레코드를 읽을 때는 원문과 해시를 변경하지 않습니다.
  • 새 personal 정책 revision 2는 필수 평가가 불가능하면 선택을 보류합니다. 불완전한 회차의 비실행 deferred 저장과 예산 소진 기록의 재생·복원을 지원합니다. 기존 revision 1 기록은 당시 정책으로 재생합니다.
  • mechanismRevision에 내용 해시를 허용하고 기존 숫자 버전과의 호환성을 유지합니다.
  • 정본 D22·D23과 로드맵을 맞춥니다. 인지·대화와 코딩 작업은 Codex, 프로바이더 관리는 OpenCodex로 유지하며 Senpi·OMON 전환 계획을 철회합니다. 현재 실행 코드는 이미 Codex 경로입니다.

Verification

동일 head의 로컬 검증과 독립 코드 재검토가 통과했습니다.

  • bun test packages/lina-core/test/judgment*.test.ts: 628 passed, 0 failed.
  • bun test packages/lina-codex/test/tasks.test.ts packages/lina-runtime/test/task-connection.test.ts packages/lina-runtime/test/task-tools.test.ts packages/lina-runtime/test/codex-fleet.test.ts: 23 passed, 0 failed.
  • bun run typecheck: passed.
  • bun run lint: passed; 기존 경고 27개가 남아 있습니다.
  • bun run ci:build: passed; 런타임 자산 빌드와 상태를 쓰지 않는 CLI smoke.
  • git diff --check: passed.
  • 독립 검토에서 발견한 타입 오류와 잘림 출처 위조 경로를 수정하고 재검토 PASS. 출처 위조 회귀 테스트의 실패 후 통과 확인.

GitHub CI 결과는 이 PR의 checks에서 별도로 확인합니다. 전체 패키지 테스트와 라이브 모델 호출 결과를 위 로컬 검증에 포함하지 않습니다.

Risks and remaining work

  • 생성 요청의 실제 토큰 상한, 같은 요청 예산 안에서의 평가 보완 실행, 세 메커니즘·MaleCNS와 제품 연결은 F2 이후 범위입니다. 저장 후 자르기만으로 생성 시간·비용이 제한되지는 않습니다.
  • 정체성 자료에 해당 개인이 없을 때 페르소나 잠금이 해제되는 기존 문제는 이번 수정에 포함하지 않습니다.
  • Purpose·Understanding·Plan과 구조화된 Claim 등 남은 계약 요구는 로드맵에 유지합니다.
  • 운영 데이터 이전·서비스 배포·외부 모델의 실동작 검증은 수행하지 않았습니다.

Devin Review

Preserve legacy policy replay and mechanism revisions while holding incomplete judgments under policy revision two. Prepare bounded prose before immutable hashing and retain clipping provenance. Restore the Codex and OpenCodex backend decision in the canonical roadmap.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T13:02:39.581457Z 7ded8af New commits
🔒 Security Review Completed 2026-09-13T11:04:30.193308Z 4ed1ff8 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Automated review on 4ed1ff8 found two defects in the new contracts. An
incomplete deferred receipt is terminal but still trusted its order,
recommendations, exclusions and abstentions, so a caller could preserve
arbitration claims that no stored evidence supports. Budget conversion was
also ungated on policy revision, letting a revision-1 replayed hold become a
terminal budget-exhausted receipt that revision 1 never declared.

An incomplete deferred receipt now must restate the declared policy order,
must match the recommendations its stored assessments prove, and must leave
exclusions, abstentions, conflicts, ranking and concessions empty. Budget
conversion requires revision 2 or higher. Held receipts keep their PR14
descriptive latitude so historical action bytes and digests stay readable.

Four regressions failed first, then passed; a positive case keeps proven
recommendations. Judgment suite 631 pass, typecheck, lint and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

Follow-up review found the incomplete-evidence branch admitted a terminal
deferred receipt under any policy revision. Revision 1 is kept only for
historical replay and ended such rounds as held, so closing one as deferred
permanently stopped work that revision 1 left retryable.

Incomplete evidence now yields a terminal receipt only under revision 2,
matching the budget-conversion gate, while held stays available for every
revision. The incomplete-evidence cases moved onto revision-2 rounds, a new
test covers the revision-1 rejection, and the candidate suite returns to its
revision-1 contract with the closed-round and null-selection checks kept.

Judgment suite 630 pass; typecheck, lint and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

Follow-up review found two more defects. An incomplete revision-2 round
accepted any deferred reason, so a caller could end a round that still had
evaluation budget, and recording a resolution then blocks the missing
assessment. The policy lookup also ran for held rows, and because the ledger
audit runs inside every transaction, one historical hold recorded under a
catalog or revision this binary does not declare would fail unrelated reads.

A terminal receipt for incomplete evidence now requires the shared
EVALUATION_BUDGET_EXHAUSTED reason, so any other interruption stays held and
the round keeps its remaining work. The held path resolves no policy; the
lookup runs only for that terminal receipt and for complete replay.

Three regressions failed first, then passed, including a revision-3 hold that
reopens and still serves unrelated reads. Judgment suite 632 pass; typecheck,
lint and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

A readout whose first 4,000 units are whitespace passed whole-value
validation and then failed the same non-empty rule on its clipped prefix, so
long prose failed the judgment instead of clipping. Storing the whitespace
prefix instead would have produced a record the parser cannot read back, so
such a bound is now reported for repair or hold.

The contract also records two boundaries the code cannot verify: store writes
keep the permissive historical parsers, so fresh output must go through the
builders, and an incomplete held receipt carries unreplayed diagnostics that
are not execution, learning or ranking evidence.

Regression failed first, then passed. lina-core 2065 pass; typecheck, lint
and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

The emptiness test used trim(), which strips ECMAScript whitespace but leaves
invisible format characters, so a bound holding 4,000 zero-width spaces passed
and produced a record that renders empty while real text sat just past the
bound. Content is now judged with a Unicode test that also excludes control
and format characters.

Regression covers space, newline, U+200B and U+FEFF, and a positive case keeps
clipping when a zero-width character precedes real text inside the bound.
lina-core 2065 pass; typecheck, lint and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

The content test ran only after clipping, so the early return for prose within
the bound still accepted a readout made only of control or format characters:
a single zero-width space produced an assessment whose text renders empty,
while the same content past the bound was rejected. The bounded text is now
determined first and the rule applies to both return paths.

Regressions cover short and long invisible prose for assessments and for both
dialogue readouts. lina-core 2065 pass; typecheck, lint and build pass.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The incomplete-deferred path resolved a policy before its field checks, so a
receipt written by a later build under an undeclared revision would fail the
ledger audit that runs inside every transaction, leaving unrelated rounds and
intentions unreadable after a downgrade. Validation now takes an explicit
stored flag: auditing persisted bytes keeps such a receipt as history, while a
fresh write still requires a policy it can check. The complete-evidence replay
path keeps its existing behavior, tracked separately.

The readable-text class also accepted standalone combining marks, which render
as nothing without a base character, so it now excludes Mn and Me.

Both regressions failed first, then passed. lina-core 2066 pass; typecheck,
lint and build pass.
devin-ai-integration[bot]

This comment was marked as resolved.

The provenance digest hashed the readout as UTF-8, which folds every unpaired
surrogate onto the same replacement character, so two originals differing only
in a trailing lone surrogate could share one sourceDigest and the metadata
could no longer identify which prose was clipped. The digest now hashes
UTF-16LE bytes, which is injective over code units.

No stored digest changes meaning, since F1 has no product writer yet and this
branch is unmerged. Regression failed first, then passed. lina-core 2067 pass;
typecheck, lint and build pass.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Hangul fillers such as U+3164 and U+115F are category Lo, so the readable-text
class still accepted a readout made only of them, which renders blank. The
class now excludes Default_Ignorable_Code_Point, the Unicode property the
earlier category-by-category fixes were approximating.

Regression adds both fillers to the existing blank cases. lina-core 2067 pass;
typecheck, lint and build pass.

@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: 7ded8af6c4

ℹ️ 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".

Comment thread packages/lina-core/src/agents/judgment-validation.ts
@thisisjun786
thisisjun786 merged commit c5e9810 into dev Sep 13, 2026
8 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.

1 participant