🤖 refactor: auto-cleanup#3589
Conversation
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
56eb58c to
be3ec5b
Compare
|
@codex review Behavior-preserving dedup: extracted the duplicated child-failure abort handling in |
|
To use Codex here, create a Codex account and connect to github. |
6d9c760 to
da799d5
Compare
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
da799d5 to
e7de27b
Compare
|
Failed job: Failing tests:
Root cause: Each failure is a Why it's unrelated to this PR: the cleanup only touches Local verification: the suite passes consistently — 8/8 across 5 consecutive runs on this branch. Recommendation: re-run the failed CI job. No automated fix is warranted since modifying the unrelated test would exceed the cleanup scope. If this test proves persistently flaky under coverage, consider hardening it separately (e.g., a higher |
|
Failing tests (
Why this is a flake, not a regression:
(The Recommendation: re-run the |
e7de27b to
7efa56e
Compare
|
@codex review This pass adds one behavior-preserving cleanup: |
|
To use Codex here, create a Codex account and connect to github. |
7efa56e to
dfafa92
Compare
|
@codex review This pass extracts a shared |
|
To use Codex here, create a Codex account and connect to github. |
dfafa92 to
e6b5f65
Compare
|
To use Codex here, create a Codex account and connect to github. |
|
Root cause: All 15 Windows failures originate in test scaffolding Why this is not caused by the cleanup commit:
Action: No code pushed (the |
|
Failed job: Root cause (environmental):
Why this is not caused by the cleanup commit:
Recommendation: Re-run the Generated with |
e6b5f65 to
0fab59f
Compare
|
@codex review Auto-cleanup pass: rebased onto latest |
|
To use Codex here, create a Codex account and connect to github. |
Extract the thrice-repeated "Attachments cannot be added while editing a message." toast string into a module-level EDIT_MODE_ATTACHMENT_ERROR_MESSAGE const so the three guards surface identical copy and cannot drift. Behavior-preserving.
…itialize Extract the awaiting_report/running candidate filters used by the startup inactive-workflow-owner recovery pass into a single listStartupRecoveryCandidates closure, mirroring the existing listQueuedTasks pattern, so the initial computation and the post-interrupt refresh reuse the exact same status filters. Behavior-preserving cleanup of #3594.
The 'In the plan agent you may only spawn agentId: "explore" tasks.' error string was open-coded twice in task.ts — once in the workspace-turn guard and once in the per-launch agent-id guard. Both now reference a single module-level PLAN_AGENT_EXPLORE_ONLY_ERROR constant. Behavior-preserving (identical string).
0fab59f to
a0a14eb
Compare
|
@codex review This pass: deduped the three private session-file path accessors in |
|
To use Codex here, create a Codex account and connect to github. |
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 (#3559) merged intomain; this is its successor.Auto-cleanup checkpoint: 5dae4a3
This pass
Considered the one new
maincommit since the previous checkpoint — #3602 (fix: keep optimistic goal visible during streaming). That change addsWorkspaceGoalService.getPendingGoalSnapshotand aWorkspaceService.overlayPendingGoalchoke-point overlay so mid-stream goal sets stay visible; the streaming/activity-emit overlay is intricate concurrency-adjacent surface (higher regression risk), so the cleanup was drawn from a small, self-contained duplicated construction in the sameWorkspaceGoalServicefile.Landed one behavior-preserving cleanup in
workspaceGoalService.ts: the three private session-file path accessors (getFilePath/getHistoryFilePath/getBoardFilePath) each open-coded the identicalassert(workspaceId.trim().length > 0, "WorkspaceGoalService requires non-empty workspaceId")guard pluspath.join(this.config.getSessionDir(workspaceId), <FILE_CONST>). All three now delegate to a singleresolveSessionFilePath(workspaceId, fileName)helper. Behavior-preserving: the accessor signatures and their callers are unchanged, and the assert message and join logic are identical at every site.Branch contents (net diff against
main)Cleanups carried by this PR (not yet merged)
workspaceGoalService.ts— dedupe session file path resolution. 🤖 fix: keep optimistic goal visible during streaming #3602's goal-visibility fix touches this file; the three private accessorsgetFilePath/getHistoryFilePath/getBoardFilePatheach open-coded the sameassert(...non-empty workspaceId)guard andpath.join(getSessionDir(...), <FILE_CONST>). All three now delegate to a singleresolveSessionFilePath(workspaceId, fileName)helper. Behavior-preserving (identical guard + join; accessor names and callers unchanged).task.ts— dedupe plan-agent explore-only error. The plan-agent restriction errorIn the plan agent you may only spawn agentId: "explore" tasks.was open-coded twice (the workspace-turn guard and the per-launch agent-id guard). Both now reference a single module-levelPLAN_AGENT_EXPLORE_ONLY_ERRORconstant. Behavior-preserving (identical string output).task_await.ts— dedupe workspace-turn error fallback. 🤖 feat: add workspace turn task handles #3600's new workspace-turn await paths open-coded the fallback error message"Workspace turn failed"three times (<record>.error ?? "Workspace turn failed"). All three now reference a single module-levelWORKSPACE_TURN_DEFAULT_ERRORconstant. Behavior-preserving (identical string output).goalToolUtils.tsx/SetGoalToolCall.tsx— dedupe turn-count pluralization. 🤖 feat: add agent-facing goal setting #3595's new goal toolcards open-coded`${n} turn${n === 1 ? "" : "s"}`in bothformatGoalTurnsand the set_goal toolcard'sformatOptionalTurnCap. Both now call a sharedpluralizeTurns(count)helper. Behavior-preserving (identical string output).heartbeat.ts— dedupe heartbeat tool success result construction. 🤖 feat: add workspace heartbeat tool #3596's newheartbeattool open-coded the same{ success: true, action, configured, settings, summary }success object three times (get/set/unset), each re-callingsummarize({ action, settings }). All three now route through a singlebuildSuccessResult(action, settings)helper that derivesconfiguredfromsettings. Behavior-preserving: the per-branchconfiguredvalues (settings != null,false,true) all equalsettings != nullgiven the non-nullOkpayload type forset.taskService.ts— dedupe startup recovery candidate listing. 🤖 fix: prevent workflow task recovery after interrupts #3594'sTaskService.initializeopen-coded theawaiting_report/runningcandidate filters twice (initial computation and post-interrupt refresh). Both call sites now reuse a singlelistStartupRecoveryCandidates(sourceConfig)closure returning{ awaitingReportTasks, runningTasks }, matching the existinglistQueuedTaskspattern. Behavior-preserving.ChatPane.tsx— dedupe send-queued-immediately in-flight guard clear. 🤖 fix: send queued message with empty Enter #3592 introducedsendQueuedImmediatelyInFlightRefto block duplicate send-now attempts; releasing that guard ("clear it only if it still points at this attempt") was open-coded twice — once after a failed interrupt result and once in thecatcharm. Both call sites now invoke a single callback-local closureclearInFlightGuardIfCurrent(). Behavior-preserving: the failed-result site's combined!interruptResult.success && ref === idbecomesif (!interruptResult.success) clearInFlightGuardIfCurrent()(logically identical); thecatchsite is a verbatim substitution.WorkflowRunner.ts— dedupeparallelAgentschild-failure abort handling into a single batch-local closureapplyChildFailureToBatch(error), shared by the per-run task closure and the bulk-create path.ChatInput/index.tsx— dedupe edit-mode attachment toast string"Attachments cannot be added while editing a message."into a single module-level constantEDIT_MODE_ATTACHMENT_ERROR_MESSAGE, replacing three inline copies across the add-attachment / paste / drop guards.Prior passes (landed via #3559, merged)
WorkflowService.interruptRunOnAbortwith theisTerminalWorkflowRunStatushelper.workspaceId-only metadata JSON Schema repeated by three id-targeted host actions inworkspaceHostActions.tsintoWORKSPACE_ID_ONLY_INPUT_SCHEMA.BlockedBadgecomponent inWorkflowDefinitionToolCall.tsx.argsSchema.properties must be an objecterror string inworkflowArgs.ts.useModelsFromSettings.test.ts.toggleWorkflowExpandedwrapper inWorkflowRunToolCall.tsx.SAVE_AUTOMATION_ERROR_MESSAGE/REMOVE_AUTOMATION_ERROR_MESSAGEinAutomationModal.tsx."wfr_"literal inWorkflowRunner.tswithisWorkflowRunTaskId().Validation
make static-check— ESLint, bothtsgotypecheck configs, and Prettier all pass on the rebased tree. The only failing step isfmt-shell-check, which requiresshfmt(not installed in this environment); no shell scripts were touched, so CI (which hasshfmt) is unaffected.bun test src/node/services/workspaceGoalService.test.ts— 131 pass, 0 fail (covers the goal service file whose path accessors this pass deduped).Generated with
mux• Model:anthropic:claude-opus-4-8• Thinking:xhigh