Repository navigation
feat: label and narrate the delegation state notices - #44
Merged
Merged
Conversation
Bloop's threads read Spanish for every narrated progress note while "Started.", "Failed." and "Outcome unknown." stayed English, because the delegation route builds them from a hardcoded map and never reaches the narration path. The tests pin the labels config with its blank and absent fallbacks, the labelled line a deployment without narration posts, the turn that carries the label and the runner's note when narration is configured, and the labelled line that still goes out when that turn cannot start, so the change that follows has a witness that fails without it.
A deployment that sets progress narration reads Spanish in every thread, while the delegation state notices stayed English: the route built them from a hardcoded map and posted them itself. Delegation config now carries running, failed and unknown labels with today's English strings as defaults, a missing or blank value falling back to them, and a configured narration hands the labelled notice to the narration path a milestone already takes, keyed delegation:<task id>:<state> so a retried state never reaches the thread twice, with the labelled line as that turn's fallback. Without narration the notice is posted directly as before. The narration turn now carries the idempotency key its host must dispatch under, because a turn keyed only by a milestone id cannot tell a delegation notice from a milestone of the same id.
The delegation section listed the config keys and the state notices, so it now says which words the labels name, that a blank value keeps the default, and that a configured narration turns the notice into a narrated reply with the labelled line as its fallback.
Review P1: the contract says a deployment with progress narration hands each delegation state notice to the narration path and posts nothing directly, yet the only wiring that does so lives in the worker entry, which no test reached. Dropping narrateNotice from configuredDelegation in index.ts left every test green while a narrated deployment went back to posting English lines itself. The new worker test loads the entry with delegation labels and narration configured, reports a running state over the real route, and demands one turn dispatched under delegation:<task id>:running with the labelled fallback and no Slack call. The migrated SQLite D1 stand-in moves to a shared test module so the worker test can seed the task the route transitions.
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.
A deployment that sets
progress.narrationreads Spanish in every thread, but the delegation state notices stayed English:packages/core/src/delegation.tsbuilt them from a hardcoded map and posted them itself, so no config could change them and no narration turn ever saw them.delegation.labelsnow names the word each notice opens with (running,failed,unknown), missing or blank values keep today's English strings, and a configured narration hands the labelled notice to the same narration path a milestone takes, keyeddelegation:<task id>:<state>, with the labelled line as that turn's fallback. Without narration the notice is posted directly as before.Verify:
a Spanish deployment posts its labelled notice directly, once per stateinapps/slack-agent/test/delegation.test.tsposts["Iniciado.", "Desconocido. Budget ended ", "Fallido. Stop confirmed"]for running, unknown and failed.a narrated deployment hands the labelled notice to the narration turn and posts nothing itselfrecords one notice (conductor: "runner-1",label: "Iniciado",note: "Budget ended ",state: "running"), builds its turn withdelegationNoticeTurn, assertsidempotencyKey === "delegation:task-1:running",binding.fallbackText === "Iniciado. Budget ended ", the shared instruction andStatus: Iniciadoin the body, and thath.postsgrew by zero.a repeated runner state answers 200 once and another runner is still refusedstill expects["Started.", "Failed."]for two running and two failed reports.delegation without labels keeps today's English noticeposts["Started.", "Outcome unknown. Budget ended", "Failed. Stop confirmed"], anddelegation labels resolve from config and fall back when blank or absentasserts a blankfailedresolves toFailedthroughdefineAgentConfig.SyntaxError: Export named 'delegationNoticeTurn' not found in module 'packages/core/src/index.ts', andbun -eagainst base'sdefineAgentConfigwithdelegation.labels = { running: "Iniciado" }printslabels on base: undefined.bun run verifyis green: 376 pass, 0 fail, plusknip,deploy:dryandbun auditclean.Commits, in dependency order:
test: demand Spanish delegation notices and their narrated turnfeat: label and narrate the delegation state noticesdocs: document the delegation notice labels and their narrationNotes:
SlackProgressTurn.milestoneIdbecameidempotencyKey, so the host dispatches under the key the turn carries:progress:<milestone id>for milestones,delegation:<task id>:<state>for notices.apps/slack-agent/test/progress.test.tsandapps/slack-agent/test/worker-stream.test.tsbuild or compare a turn literal and moved with it.apps/slack-agent/src/index.tswires the notice narrator because that is wherenarrateProgressTurnandtrusted.teamIdlive;apps/slack-agent/src/delegation.tsonly forwards the optional callback.Not covered: right-hand's Spanish values (row R1) and the live thread (wave-end pass).