fix(smithy): sf task merge honors workspace merge.targetBranch config (#63)#4
Open
komoreka wants to merge 1 commit into
Open
fix(smithy): sf task merge honors workspace merge.targetBranch config (#63)#4komoreka wants to merge 1 commit into
komoreka wants to merge 1 commit into
Conversation
The `merge.targetBranch` value in `.stoneforge/config.yaml` was previously only consumed by prompt-builders (sessions, steward scheduler, dispatch daemon) to populate WorkflowPresetContext for agent system prompts. The actual git tooling in the `sf task` CLI commands never loaded it, so setting `merge.target_branch: dev` told agents about the target in their prompts but the merge operations themselves still defaulted to git origin/HEAD (typically `main`). Resolution chain across all merge-related paths is now: task.targetBranch → config.merge.targetBranch → git origin/HEAD → main Wired in: - packages/smithy/src/cli/commands/task.ts (merge handler, sync handler, update --status merged verify path) - packages/smithy/src/services/task-assignment-service.ts (MR-creation path used by sf task complete) A new exported `loadConfigTargetBranch()` helper centralises the config read with safe handling of missing config, missing merge block, null values, and empty strings. Six unit tests in task-target-branch.bun.test.ts cover those cases. Stewards (which cannot own a targetBranch field per the agent type contract) finally have a config-only path to set a project-wide target. Refs stoneforge-ai#63.
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.
Fork-side staging PR for upstream issue stoneforge-ai#63. Will hold for live testing before opening upstream.
Summary
merge.targetBranchin.stoneforge/config.yamlwas previously only consumed by prompt-builders (sessions, steward scheduler, dispatch daemon) to populateWorkflowPresetContextfor agent system prompts. The actual git tooling insf taskCLI commands never loaded it. So settingmerge.target_branch: devtold agents about the target in their prompts, but the merge operations themselves still defaulted to git origin/HEAD (typicallymain).Resolution across all merge-related paths is now:
This unblocks the steward-merge case from stoneforge-ai#63: stewards cannot own a
targetBranchfield by the agent-type contract, so a workspace-level config was always meant to be their fallback. Now it actually works.Files
packages/smithy/src/cli/commands/task.ts— addsloadConfigTargetBranch()helper, threads it into the merge handler, sync handler, andupdate --status mergedverify pathpackages/smithy/src/services/task-assignment-service.ts— same fallback in the MR-creation path used bysf task completepackages/smithy/src/cli/commands/task-target-branch.bun.test.ts— 6 unit tests for the helper covering missing config, null values, empty strings, alternate namesTest plan
bun test src/cli/commands/task-target-branch.bun.test.ts— 6/6 passbun test src(full smithy suite) — 1574 pass, 0 fail, 19 skipturbo typecheck --filter=@stoneforge/smithy— cleanpnpm build— cleanmerge.target_branch: devset in config (next step before upstream PR)Out of scope
The deeper director→task propagation issue Adam mentioned (currently only fires during
assignTaskToWorker) is left as a follow-up. This PR closes the user-visible symptom of stoneforge-ai#63 by making the config workaround actually work end-to-end.