Repository navigation
refactor: share OpenCode payload helpers between the Action and the gateway - #1872
Merged
Merged
Conversation
fro-bot
approved these changes
Oct 19, 2026
fro-bot
left a comment
Owner
There was a problem hiding this comment.
Verdict: PASS
The extraction preserves existing behavior, including own-property reads, null/undefined distinctions, task-notice guards, and tool-completion exemptions. No actionable correctness, security, or public API regression found.
Blocking issues
None
Non-blocking concerns
None
Missing tests
None
Risk assessment (LOW/MED/HIGH): likelihood of regression, security exposure, or blast radius
LOW. Shared helpers retain the original semantics, with focused new unit coverage and existing caller-level regression tests. Review was based on diff, source, and test inspection; build, lint, type checks, and test suites were not run.
Run Summary
| Field | Value |
|---|---|
| Event | pull_request |
| Repository | fro-bot/agent |
| Run ID | 39294639766 |
| Cache | hit |
| Session | ses_eaac5ff39ffe7eDJjgy1QFpZKO |
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.
Problem
The Action and the gateway each kept their own copies of the OpenCode payload helpers: 26 own-property accessors spread over 7 files, the task-notice regex and parser, the event-shape helpers, and the blocking-tool-part check. A comment in
run-core.tssaid it "mirrorsstreaming.tsexactly", but nothing enforced that, so a fix on one side could miss the other.Change
The shared helpers now live once in
@fro-bot/runtime(packages/runtime/src/agent/):payload-accessors.tsownValue,getStringProperty,getNumberProperty,getBooleanProperty,getObjectPropertyevent-shape.tsgetSessionID,getEventKind,getEventPayload,getEventSessionIDtask-notice.tsparseTaskNotice,parseSyntheticNoticePart,TaskNoticemessage-facts.tshasBlockingToolPartstreaming.ts,session-poll.tsandretry.tsimport the shared helpers. The local copies are deleted. The root-session gate aroundparseTaskNoticestays at the call site.run-core.ts,drain-completion.tsand both approvals coordinators import the shared helpers. The local copies and the "mirrors" comments are deleted.Kept separate on purpose:
time.created, the gateway by array order.firstStringinerror-format/provider-failure.ts. It rejects empty strings for classification, while the plain accessors accept them.The consolidation requirements doc now marks the provider-failure classifier (#1869) as delivered. It says a drift guard is needed only while copies remain, and none remain after this PR.
Behaviour
No behaviour change and no contract bump. The function bodies moved as written, and the task-notice regex is byte-identical. The existing Action and gateway suites pass with no test edits.
Verification
bun run check-types,bun run lint,bun run buildall pass.dist/is rebuilt because runtime is bundled into the Action.