🤖 refactor: auto-cleanup#3606
Open
mux-bot[bot] wants to merge 3 commits into
Open
Conversation
Contributor
Author
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
e035f24 to
893fadc
Compare
Contributor
Author
|
@codex review This pass adds one behavior-preserving cleanup: in |
#3605 introduced two near-identical guard blocks that background registered foreground waits when a tool-end message is already queued (one in the workspace-turn wait path, one in the task-await path). Extract a single private helper backgroundForegroundWaitIfQueued() shared by both sites. Behavior-preserving: the helper folds in the requestingWorkspaceId truthiness guard, which is always true at the workspace-turn site (asserted non-empty) and already implied by shouldBackgroundOnQueuedMessage at the task-await site.
The skill:// prefix is already named by SKILL_SCRIPT_PATH_PREFIX and used for parsing; reuse it in the two canonical-path builders instead of re-spelling the literal, so the prefix cannot drift. Behavior-preserving: the constant value is identical to the literal it replaces.
Dedupe the identical inline argument object declared by WorkflowTaskServiceLike.create and createMany into a named WorkflowTaskCreateArgs interface so the agent-task creation shape has a single source of truth. PR #3611 just added onRefusal to both copies, demonstrating the drift risk. Behavior-preserving: pure type-level refactor, no runtime change.
893fadc to
2d77a10
Compare
Contributor
Author
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
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.
Summary
Long-lived auto-cleanup PR maintained by the Auto-Cleanup Agent. Each pass lands at most one extremely low-risk, behavior-preserving cleanup drawn from recently merged
mainactivity, then advances the checkpoint below. The prior long-lived PR (#3589) merged intomain; this is its successor on a freshauto-cleanupbranch.Auto-cleanup checkpoint: 34f8360
This PR currently contains three accumulated cleanups against
main:src/node/services/taskService.ts— dedupe queued-message foreground backgrounding into a private helper.src/node/services/workflows/workflowScriptResolver.ts— reuse theSKILL_SCRIPT_PATH_PREFIXconstant for canonical-path construction.src/node/services/workflows/WorkflowTaskServiceAdapter.ts— extract the duplicated agent-task creation arg shape into a sharedWorkflowTaskCreateArgstype.This pass
Considered the three new commits on
mainsince the prior checkpoint:feat: default workflow agents to exec)fix: improve heartbeat modal layout)fix: hide placeholder workflow report buttons)WorkflowTaskServiceLike(inWorkflowTaskServiceAdapter.ts) declared the agent-task creation argument object twice — once inline increate(args: { ... })and again insidecreateMany?(args: Array<{ ... }>)— as byte-identical 10-field shapes (including a nestedworkflowTaskobject). #3611 added theonRefusalfield to both copies, which is exactly the drift risk this duplication invites.Landed one behavior-preserving dedup: extracted a named
WorkflowTaskCreateArgsinterface and referenced it from bothcreateandcreateMany, giving the agent-task creation shape a single source of truth.Behavior-preserving:
create/createManysignatures are unchanged.buildCreateArgscontinues to satisfyParameters<WorkflowTaskServiceLike["create"]>[0].Prior pass — workflowScriptResolver SKILL_SCRIPT_PATH_PREFIX reuse
In
workflowScriptResolver.ts, theskill://prefix is named by the module-level constantSKILL_SCRIPT_PATH_PREFIXand used when parsing incomingskill://paths, but the two canonical-path builders re-spelled the literal`skill://${...}`instead of reusing the constant. Both builders now interpolate${SKILL_SCRIPT_PATH_PREFIX}so the prefix has a single source of truth. Behavior-preserving:SKILL_SCRIPT_PATH_PREFIXis exactly"skill://", so the interpolation is byte-identical.Prior pass — taskService queued-message dedup
Considered #3605 (
fix: background foreground waits for prequeued messages), which open-coded the same queued-message guard at twoTaskServicewait-registration sites (waitForWorkspaceTurnand the task-await path). Both sites now delegate to a single private helperbackgroundForegroundWaitIfQueued(shouldBackgroundOnQueuedMessage, requestingWorkspaceId)placed next tobackgroundForegroundWaitsForWorkspace. Behavior-preserving: the helper folds in therequestingWorkspaceIdtruthiness guard (always true at the workspace-turn site; a verbatim match at the task-await site), and the pushed call is unchanged.Validation
make static-checkpasses locally for the touched code: ESLint, both TypeScript configs (tsconfig+tsconfig.main.json), and Prettier are green. The only non-passing step isfmt-shell-check, which fails solely because theshfmtbinary is not installed in this environment; no shell files are touched by any change.Risks
Minimal. All changes are pure local extractions/constant reuse within a single file each; no logic, types, or call semantics change. The latest pass is a type-only dedup with no runtime effect.
Generated with
mux• Model:anthropic:claude-opus-4-8• Thinking:xhigh