Skip to content

arch(ws-11): add loop input port - #3646

Merged
henrypark133 merged 6 commits into
reborn-integrationfrom
arch/ws-11
May 15, 2026
Merged

henrypark133 merged 6 commits into
reborn-integrationfrom
arch/ws-11

Conversation

@henrypark133

@henrypark133 henrypark133 commented May 14, 2026 •

Copy link
Copy Markdown
Collaborator

Context

Input-drain host port branch. It gives the executor a durable/caller-visible way to drain steering and follow-up inputs without giving strategies direct queue access.

Master spec: docs/reborn/agent-loop-skeleton.md
Workstream brief: docs/reborn/agent-loop-briefs/loop-input-port.md
Stack base: arch/ws-8

Latest stack maintenance on 2026-05-14:

  • Rebased this branch onto its current stack base after the WS0 prompt-authority fix and the follow-up WS8/WS14-parent/WS16/WS17 conflict resolutions.
  • Pushed the updated branch with force-with-lease where the remote already existed, or published it as a new branch where it did not.
  • Verified the final ancestry chain from origin/reborn-integration through WS17 before publishing the PR descriptions.

What landed

  • Loop input cursor and drain request/response types in the host contract.
  • Host-managed input port implementation for steering/follow-up queues.
  • Executor support for applying InputDrainStrategy decisions through the host port.
  • Test-support adapters that capture the exact input-drain arguments passed by production callers.
  • Caller-level tests around planned driver input drain behavior.

Reviewer focus

  • Strategies should decide when to drain; the host port owns how inputs are loaded and marked observed.
  • Input cursors should advance explicitly and survive checkpoint/resume boundaries.
  • Mocks must capture every argument production code passes through the host API.

Non-goals / deferred work

  • Cancellation observation is WS13.
  • Progress events are WS12.
  • Product inbound message cutover is WS17.

Validation

  • cargo check -p ironclaw_reborn
  • cargo test -p ironclaw_loop_support --lib input_port
  • git diff --check
  • Included in arch/ws-14-parent validation: multi-crate cargo check with ironclaw_agent_loop/test-support.

Stack position

[#3550 ws-0] state/checkpoint foundation -> reborn-integration
   |-- #3551 ws-1 strategy alpha -> ws-0
   |-- #3552 ws-2 strategy beta -> ws-0
   |-- #3553 ws-3 strategy gamma -> ws-0
   |-- #3643 ws-3.5 loop family registry -> ws-0
   '-- #3554 level1-merged -> ws-0
         |-- #3555 ws-4 planner facade -> level1
         |-- #3556 ws-5 default strategies -> level1
         '-- #3557 level2-merged -> level1
               '-- #3596 ws-6a canonical executor -> level2
                     '-- #3597 ws-7 PlannedDriver adapter -> ws-6a
                           '-- #3598 ws-8 integration/test support -> ws-7
                                 |-- #3644 ws-9 capability host wiring -> ws-8
                                 |-- #3645 ws-10 checkpoint load/resume -> ws-8
                                 |-- #3646 ws-11 input port -> ws-8
                                 |-- #3647 ws-12 progress port -> ws-8
                                 |-- #3648 ws-13 cancellation accessor -> ws-8
                                 |-- #3649 ws-15 prompt/identity context -> ws-8
                                 '-- #3650 ws-14-parent integrated host ports -> ws-8
                                       '-- #3651 ws-14 planned default registration -> ws-14-parent
                                             '-- #3652 ws-16 live runtime wiring -> ws-14
                                                   '-- #3653 ws-17 product live cutover -> ws-16

@github-actions github-actions Bot added size: L 200-499 changed lines risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels May 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a host-owned input queue system for the Reborn loop, including the HostInputQueue trait and the HostQueueLoopInputPort adapter. It also updates the RebornLoopDriverHostFactory to integrate this new input mechanism and adds comprehensive tests for steering and follow-up message handling. Feedback suggests implementing a maximum batch size limit in poll_inputs to ensure consistency and prevent performance issues from excessively large batches.

Comment thread crates/ironclaw_loop_support/src/input_port.rs
@serrrfirat

Copy link
Copy Markdown
Collaborator

Summary

Reviewed WS11 PR #3646 only.
Base cbdd70890afb200cdfe47076b23a885f0c70cd8c → head 4bb9af1b4c16524cf8fe3854574b4b0be2979d21.

Loop input port run-binding looks good, but ack identity is cursor-through rather than per-input token, breaking mixed-batch replay/idempotency invariant.

Validation:

  • cargo check -p ironclaw_reborn ✅

Findings

# Sev Category File:Line Issue Fix suggestion
1 High Correctness / Replay / Idempotency crates/ironclaw_loop_support/src/input_queue.rs:32-42, crates/ironclaw_loop_support/src/input_port.rs:53-58 ack_inputs acks through a cursor, so host can only acknowledge a contiguous prefix. Mixed batches with control input before/among user-facing inputs force unsafe choice: over-ack unseen control input, or leave already-consumed message redeliverable. WS11 brief calls for per-input ack tokens for this hazard. Replace cursor-through ack with exact per-input ack tokens/ids. Add mixed-batch caller-boundary tests like [Cancel, UserMessage] and [GateResolved, FollowUp].

Security/data-flow notes

  • Poll/ack run cursor validation is present.
  • Input payloads are refs/control enums; no raw-content leak found in changed path.

Correctness/invariant notes

  • Replay/idempotency boundary needs exact consumed-input identity, not cursor only.

Missing tests

  • Mixed batch with early control input and later consumable input proves no over-ack/no redelivery.
  • Driver/executor caller-boundary replay test, not adapter-only homogeneous batches.

Comment thread crates/ironclaw_loop_support/src/input_port.rs
@henrypark133

Copy link
Copy Markdown
Collaborator Author

Follow-up from the ws-6a review pass on #3596:

#3596 now defers user-facing input ack until after the checkpoint containing the advanced cursor is durable. This WS11 input-port PR still owns the more precise production input contract.

Please make sure this branch preserves the same ordering with the real input implementation: durable cursor/checkpoint first, physical ack second. If the real port supports mixed batches, exact per-input ack tokens should avoid acknowledging an entire batch just because one user-facing item was consumed; advance only the contiguous durable prefix that the checkpoint can recover from.

@henrypark133
henrypark133 force-pushed the arch/ws-8 branch 2 times, most recently from 109d2a3 to 0615a4e Compare May 15, 2026 04:28
Base automatically changed from arch/ws-8 to reborn-integration May 15, 2026 04:34
@github-actions github-actions Bot added scope: dependencies Dependency updates size: XL 500+ changed lines and removed size: L 200-499 changed lines labels May 15, 2026
henrypark133 and others added 2 commits May 14, 2026 22:52
…factory composition test

- Add TODO on issued_cursors unbounded growth
- Document intentional deviation from brief spec (input_queue on factory not config)
- Add input_queue_wired_through_factory_drains_steering_message integration test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ct factory pattern

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the scope: docs Documentation label May 15, 2026
@henrypark133
henrypark133 marked this pull request as ready for review May 15, 2026 06:18
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@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: 00f8dfad20

ℹ️ 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 crates/ironclaw_loop_support/src/input_port.rs Outdated
@henrypark133
henrypark133 merged commit 14d98f9 into reborn-integration May 15, 2026
14 checks passed
@henrypark133
henrypark133 deleted the arch/ws-11 branch May 15, 2026 15:32
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
* arch: ws-11-loop-input-port (iter 1, approved)

* fix(ws-11): document cursor growth + PlannedDriverConfig deviation + factory composition test

- Add TODO on issued_cursors unbounded growth
- Document intentional deviation from brief spec (input_queue on factory not config)
- Add input_queue_wired_through_factory_drains_steering_message integration test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ws-11): capture ack_inputs tokens in mock + update brief to reflect factory pattern

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ws-11): handle queued loop input controls

* fix(ws-11): reject unissued input cursors

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: serrrfirat <f@nuff.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules scope: dependencies Dependency updates scope: docs Documentation size: XL 500+ changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants