Simplify dispatch: agent-bound bus writer, plain JudgeDecision, no stray exports - #19
Merged
Merged
Conversation
…named well-known strings
- WriteAheadAgentBus.agent(actor) returns a writer bound to one actor, so
the write-ahead convention no longer restates { actor, kind, payload }
at every append.
- JudgeDecision is now a plain union type on dispatch.ts; the judgeDecision
zod enum and its .parse calls are gone — gates and judges are typed
against the union, so their outputs are used as returned.
- The judge actor and agent.decision kind are module-private constants
behind a recordDecision helper; decisionKind is no longer part of the
public API. Harness actor/kind strings are likewise named once. They
stay strings (not symbols) because bus entries are serialized to storage.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqYWeURqZQYQUKs7tqvEfA
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe harness adds actor-bound bus writers, centralizes judge decision recording, removes the schema-based judge decision export, and updates run-loop dispatches to use standardized actor and kind identifiers. ChangesAgent bus and judge flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Harness
participant dispatchAction
participant WriteAheadAgentBus
participant Judge
Harness->>Judge: provide bus context
Judge-->>Harness: return pass or fail
Harness->>dispatchAction: dispatch action with actor and kind
dispatchAction->>WriteAheadAgentBus: record decision and action entries
WriteAheadAgentBus-->>Harness: return recorded entries
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Cleans up the weirdness in
packages/harness/src/dispatch.tsand the call sites around it.What changed
Verbose
bus.append→ agent-bound writer.WriteAheadAgentBus.agent(actor)now returns a writer bound to one actor —write(kind, payload?)— so the write-ahead convention no longer restates{ actor, kind, ...(payload === undefined ? {} : { payload }) }at every append.dispatchActionbinds the acting agent once and every intent/failure/completion record flows through it. The bus still knows nothing about any actor; the writer is just currying.judgeDecision.parseremoved. Gates and judges are typed to returnJudgeDecision, and every producer is under our control, so re-parsing their output bought nothing.JudgeDecisionis now a plain"pass" | "fail"union defined next toActionGateindispatch.ts; thejudgeDecisionzod enum is deleted fromschema.tsentirely.Hard-coded strings named once. The
"judge"actor and"agent.decision"kind are module-private constants behind a newrecordDecision(bus, payload)helper, used by bothdispatchActionand the harness'sdecide. The harness's actor names (student/teacher/adversary) and message kinds (agent.propose,agent.assess,agent.challenge,agent.revise-rubric) are likewise spelled once inas consttables. They stay strings rather thanSymbol(...)because bus entries are serialized to storage — a symbol would not survive the round trip.Stray exports trimmed.
decisionKindis no longer exported (fromdispatch.tsor the package index), the redundantexport type { JudgeDecision }re-export indispatch.tsis gone, and thejudgeDecisionzod value export is removed from the index. The newAgentWritertype is exported alongside the bus.Verification
npm run check(typecheck of all packages, full test suite, core build) passes: 15 test files, 82 tests, including a new test covering the bound agent writer.src/providers/harness.ts, which importstype JudgeDecisionfrom the package, still typechecks against the relocated type.🤖 Generated with Claude Code
https://claude.ai/code/session_01BqYWeURqZQYQUKs7tqvEfA
Generated by Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests