fix(jobs): block create only on live duplicate id (#11)#24
Merged
Conversation
Job creation was gated by the generic per-turn write-dedup guard, which refused brand-new job ids with 'already fulfilled'. Exempt manage_jobs from that guard and instead block a create only when the same job id is already active/paused, both in the agent tool and the jobs.py CLI. Done/cancelled ids and auto-generated ids are free to (re)create. Fixes #11
Repoint the generic write-dedup test to send_email (manage_jobs is now exempt) and add cases: brand-new id never blocked after a prior create, recreating a live id is blocked with an id-based message (not the generic guard), and a cancelled id can be recreated.
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
Agent job creation was sometimes refused with "Request already fulfilled; not repeating write actions" — even for a brand-new job id (e.g.
flight-monitor-lx1272). The job was never created, so recurring/one-shot monitors could not be scheduled reliably.Root cause
Two issues, both off the job id:
core/agent._execute_toolran every write through a per-turn dedup guard keyed on tool + params. Amanage_jobscreate that ran earlier in the same turn blocked any later create, regardless of id._tool_manage_jobscreate never checked id existence at all — it silently upserted over a live job; there was no correct id-based guard to take the generic one's place.tools/jobs.pyCLI blocked recreation of any existing id, includingdone/cancelledones.Fix
Match the issue's expected behavior exactly — block a create only when a job with the same id already exists and is
active/paused:manage_jobsfrom the generic per-turn write-dedup guard._tool_manage_jobscreate onjob_id+ status: explicit live id → blocked with an id-based message;done/cancelledids and auto-generated ids are free to (re)create.active/paused-only rule in thejobs.pyCLI.Tests
tests/test_tools.py:send_email.Full suite: 326 passed.
Closes #11