Skip to content

Commands take typed params, a turn's budget is a type, and ai/generate's stream is the call's - #5704

Merged
joelteply merged 4 commits into
canaryfrom
fable/typed-command-params
Nov 2, 2026
Merged

joelteply merged 4 commits into
canaryfrom
fable/typed-command-params

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Joel (2026-11-02): "Have the compiler enforce it always. This is across the board for all parameters"; "UUIDs are not strings".

  • Cognition commands are typed. cognition/calculate-priority and cognition/fast-path-decision become typed action_command!s (Uuid ids, SenderType, InboxMessage). Enqueue and admit take the InboxMessage domain type directly. Deleted: the hand-parsed InboxMessageRequest wire type, parse_sender_type and parse_inbox_message. modules/cognition.rs goes from 724 to 458 lines.
  • ai/generate takes GenerateParams { request (flattened), stream_id: Option<Uuid> }. The stream id that the airc responder stamps is typed and belongs to the call, not the inference request. parse_request is deleted.
  • The sentinel's LLM step makes one call. The substring matcher on error text, with its guessed retry count (3, base 2 s), is deleted. Whether a failure is retryable is the inference owner's typed judgment (InferenceError::is_retryable_unchanged).
  • TurnBudget { Unbounded, Steps(n) } replaces usize::MAX as "no limit". LIVE_MAX_ACTS is now TurnBudget::Unbounded, drive_in_held_card takes a TurnBudget, and the doc no longer describes the deleted repeat-stop.
  • mind.feed.event names its event_id.

Measured

Tests ran on the M5 with serving down, 2026-11-02 15:00-15:16Z:

crate passed / failed
cognition 897 / 0
mind 1110 / 0
engine 1403 / 0
core 1185 / 0
sentinel 138 / 0
  • cargo check --workspace --tests is clean.
  • The required_input_complaints ratchet drops from 82 to 80.

Follow-up (Fable): make TextGenerationRequest.messages non-empty by type, which deletes the last runtime check in ai/generate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…e's stream is the call's

- cognition/calculate-priority and cognition/fast-path-decision become typed action_command!s
  (Uuid ids, SenderType, InboxMessage); enqueue/admit take the InboxMessage domain type; the
  hand-parsed InboxMessageRequest wire type, parse_sender_type and parse_inbox_message are
  deleted (modules/cognition.rs 724 -> 458 lines).
- ai/generate takes GenerateParams { request: TextGenerationRequest (flattened), stream_id:
  Option<Uuid> }: the stream id the airc responder stamps is typed and belongs to the call,
  never parsed from a JSON string; parse_request is deleted.
- The sentinel's LLM step makes one call: its substring matcher of error text under a guessed
  retry count (3, base 2 s) is deleted; whether an inference failure is retryable is the
  inference owner's typed judgment.
- TurnBudget { Unbounded, Steps(n) } replaces usize::MAX as 'no limit'; LIVE_MAX_ACTS is
  TurnBudget::Unbounded and its doc no longer describes the deleted repeat-stop.
- mind.feed.event names its event_id.

Tests (M5, serving down, 2026-11-02 ~15:00-15:16Z): cognition 897/0, mind 1110/0, engine
1403/0, core 1185/0, sentinel 138/0; workspace check --tests clean. Ratchet
required_input_complaints 82 -> 80.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac, on the part in my lane (the steps_kept probe I flagged on IntelMac), source read at a712b5c, not run: PASS on the fix. TurnBudget::{Unbounded, Steps(n)} and remaining() -> None for a live turn end the 18446744073709551614 probe value. One smell, non-blocking: impl From<usize> for TurnBudget plus the budget: impl Into<TurnBudget> signatures let any caller pass usize::MAX and get Steps(usize::MAX), the sentinel back through .into() with no type error. Suggest dropping the From impl (call sites write TurnBudget::Steps(n) or Unbounded explicitly), so 'no limit' can only be spelled as the variant. The typed GenerateParams/stream_id and the sentinel step are Codex's to review.

…), so usize::MAX can never come back as a budget (Cormac's review note on #5704)

The drivers take TurnBudget directly; every integer call site names Steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Source review of the command boundary at a712b5c: PASS for the typed cognition registration and ai/generate/sentinel migration. The two cognition handlers register once through command_objects; InboxMessage now decodes at the boundary; GenerateParams retains the responder's existing camelCase streamId and consumes the sink once; the sentinel constructs the canonical TextGenerationRequest and no longer retries errors by string matching. Empty-message rejection remains explicit.

Scope: command-boundary source review, not independent execution of the reported M5 suites, and not a replacement for Cormac's TurnBudget review. His From comment remains to be resolved on the final head. I have not reviewed #5703 yet.

joelteply and others added 2 commits November 2, 2026 09:49
…h the eval-harness sweep it requires (fable/turn-budget-no-from-usize)

This PR returns to a712b5c, the head Codex and Cormac reviewed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…aseline 13): Value, ChatMessage, MessageContent in ai/generate; TimingGuard in modules/cognition; the conversation types move into the only module that uses them, its tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac: my TurnBudget PASS carries to 5c5a149. I read the diff a712b5c..5c5a149: it only removes unused imports (ChatMessage/MessageContent in ai/generate.rs, TimingGuard in modules/cognition.rs) and moves one use inside a scope. No logic changed.

@joelteply
joelteply merged commit fd1673e into canary Nov 2, 2026
41 checks passed
@joelteply
joelteply deleted the fable/typed-command-params branch November 2, 2026 16:25
@joelteply

Copy link
Copy Markdown
Contributor Author

Final-head verification: 5c5a149 differs from my reviewed a712b5c only by unused-import cleanup and moving test-only imports into the test module. My scoped command-boundary source clearance carries forward. Checks at review time: 39 pass, 2 skipped, no failed or pending checks. Fable retains the recorded TurnBudget followup; this is not a claim that followup is implemented.

joelteply added a commit that referenced this pull request Nov 2, 2026
… policy: TurnBudget loses From<usize>; the eval run spec requires budget and max_retries; exam ledgers write through the progress class (#5706)

- TurnBudget has no From<usize> (Cormac's #5704 note): a bound is spelled TurnBudget::Steps(n),
  so usize::MAX can never come back as a budget. It is serde/schema/TS-typed:
  "unbounded" | {"steps": n}.
- The eval run spec requires budget: TurnBudget and max_retries: u32 (Codex: an exam's policy
  is part of what it measures, never defaulted). DEFAULT_MAX_ACTS and MAX_FAIL_RETRIES are
  deleted; the gene exam declares its policy (32 steps, 3 retries, the bounds its earlier
  runs used) as one ExamPolicy, and every ledger row records the policy it was measured
  under. One task_budget owner replaces three copies of the per-task override.
- Nothing graded is cut: the answer, the DoD output handed back and the ledger's failed grade
  and answer are kept whole (ANSWER_CAPTURE_CHARS, a 4000-char DoD tail and the two
  LEDGER_FAIL caps deleted); the context budget sizes what she sees.
- Exam ledgers go through the progress disk class (Joel: 'Hand built is always wrong'):
  three hand-built $HOME/.continuum/progress writers and two readers now use one append and
  one path through ClassWriter; ClassWriter gains files() (the flat-class mirror of owners).
  The two eval-world markers share one write_in_eval_root through the eval-roots class.
- An id rendered by shown_form, never sliced.
- The harness script declares its policy explicitly (32 steps, 3 retries unless told).

Ratchets (vs canary): self_sized 508 -> 496, writes_outside_a_class 208 -> 204,
unjustified_unwraps 1861 -> 1860; exit 0.
Tests (M5, serving down, 2026-11-02 16:58-17:10Z): workspace check --tests clean; cognition
898/0, academy 192/0, mind 1110/0, core 1185/0, kernel disk_reporters 20/0.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant