refactor(adapter): let workers own protocol-specific prompt notes (#186) - #285
Open
Prithvi1994 wants to merge 1 commit into
Open
Prithvi1994 wants to merge 1 commit into
Prithvi1994 wants to merge 1 commit into
Conversation
…oharness#186) compose_inbound_wakeup_prompt branched on adapter_type == "slack" and rendered Slack guidance from the worker-invented metadata keys `dmTarget` and `isActiveThread`, putting protocol-specific behavior in the host across a Rust/TypeScript boundary. The host now appends any strings the worker supplies in `metadata.promptNotes`, in order, and treats protocol metadata keys as opaque. The Slack worker emits the same guidance it used to trigger, so Slack wakeup prompts are unchanged while the host no longer knows what Slack is. Refs exoharness#186.
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.
Closes #186
Problem
compose_inbound_wakeup_promptin the host branched onadapter_type == "slack"and rendered Slack guidance from two metadata keys (dmTarget,isActiveThread) that the Slack worker invents. That put protocol-specific behavior in the host and coupled it to the worker through untyped string keys across a Rust/TypeScript boundary — against the rule inexo/docs/tools-and-adapters.md:Fix
metadatais already free-form JSON the worker fully controls, so the guidance travels in it:crates/executor/src/adapter/runtime.rs): theadapter_type == "slack"block is replaced by a generic loop that appends every string inmetadata.promptNotes, in array order, and treats all protocol-specific metadata keys as opaque.exo/adapters/slack/worker.ts): emits the same DM-target and active-thread guidance aspromptNotes. Wording and order are unchanged, so Slack wakeup prompts are identical to before.exo/docs/design/adapter-architecture.md): the Worker Protocol section documents themetadata.promptNotescontract.The worker keeps emitting
dmTarget/isActiveThread— they are legitimate facts it owns, anddmTargetstill builds the note. Only the host's interpretation of them is removed.Adding another adapter's guidance is now a worker-only change: no host edit, no new
if adapter_type == …arm.Verification
cargo test -p executor: 117 passed, 0 failedcargo fmt --all -- --checkandcargo clippy --workspace --all-targets -- -D warnings: cleanpnpm check(oxfmt, oxlint, tsgo, vitest): passesNew tests:
wakeup_prompt_appends_worker_prompt_notes_in_orderwakeup_prompt_ignores_metadata_keys_the_host_does_not_own— regression guard:dmTarget/isActiveThreadalone produce no host-authored textwakeup_prompt_ignores_non_string_prompt_noteswakeup_prompt_tolerates_missing_or_non_array_prompt_notesNote
No TS unit test for the Slack worker: it performs a live
slackAuthTest()at module import, so it is not unit-testable without refactoring (unlike Discord's pure helpers). Typecheck/lint cover the change.Related, not addressed here
crates/executor/src/adapter/tools.rsstill has a Slack-specificdm:target validation branch. #186 lists it as an instance of the same pattern but not the subject of the issue.