[Fix] Flatten submit_automation_work_items to one work item per call - #116
Merged
Merged
Conversation
Automation scans (e.g. ci-failure-triage on staging) were getting stuck in long retry loops because some models cannot reliably emit this tool's nested arguments: the workItems array was sent as a JSON string, fields were dropped, reasoning text leaked into optional fields, and the act-item requirements only surfaced as an opaque platform-API 400 after the round trip. Same failure class as the manage_environments fix (#8): the cure is a simpler schema, not stricter validation. - The tool now takes one flat work item per call (scalar params only) and is called once per work item; the worker wraps it into the platform API's existing workItems array - executionPrompt, targetRepositoryFullName, and targetEnvironmentId are required in the advertised schema, so models see the real contract instead of a post-hoc 400 - disposition is retained as an optional enum(['act']) for prompt compatibility and hardcoded to act in the handler; workspaceReadiness and readinessMessage are removed entirely -- the platform derives readiness from targetEnvironmentId and rejects bare_repo for act items, so those fields could never be legitimately set (readinessMessage was the field that wedged the staging loop) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
daniel-lxs
force-pushed
the
fix/harden-automation-work-items-tool
branch
from
July 10, 2026 19:18
7c87e9e to
0b4699a
Compare
This was referenced Jul 10, 2026
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.
Problem
Staging ci-failure-triage task
0urhx5qrifwj7(grok-4.5 on opencode-server) correctly diagnosed the GHCR CI failure, then failed ~15 consecutivesubmit_automation_work_itemscalls and looped for over an hour without submitting anything. Slack report: https://roomote-dev.slack.com/archives/C0AJZ8TR6T1/p1783709608450479The failed calls cycled through:
readinessMessagerejected astoo_big(>500 chars) — reasoning monologue leaked into the optional field, and one bad optional field rejected the whole submissionworkItemssent as a JSON string instead of an array, items missing required fields"Act automation work items must include executionPrompt."from the platform API — the tool schema marksexecutionPromptoptional, so the requirement only surfaced as a generic post-round-trip errorSame failure class as the
manage_environmentsempty-arguments fix (#8): some models can't reliably emit deeply nested tool arguments. The fix that worked there was simplifying the schema, not validating harder.Change
submit_automation_work_itemsnow takes one flat work item per call — scalar params only, called once per work item. The worker wraps the item into the platform API's existingworkItemsarray; the API contract is unchanged.executionPrompt,targetRepositoryFullName, andtargetEnvironmentIdare required in the advertised schema, so models see the real contract up front instead of a post-hoc 400workspaceReadinessandreadinessMessageare removed: the platform derives readiness fromtargetEnvironmentIdand rejectsbare_repofor act items, so an automation could never legitimately set them —readinessMessage(the field that wedged the staging loop) was pure dead weight on this tooldispositionstays as an optionalenum(['act'])because the scan prompts instruct models to pass it; the handler hardcodesact(andsuggestnow fails with a crisp enum error)Testing
automation-work-items-tool-schema.test.ts: valid item accepted, every field is a flat string/enum (regression guard against re-nesting), the act-item requirements are schema-required, disposition compat, uuid validation, and the params→API mappingsubmit-automation-work-items.test.tsandtool-descriptions.test.tspass unchanged;tsc --noEmit, prettier, eslint cleanFollow-ups (not in this PR)
disposition/suggestion-rejection wording could be cleaned up per the prompt-editing policysubmit_task_suggestionskeeps the old nested array shape and could get the same flattening🤖 Generated with Claude Code