Repository navigation
fix: apply the continue_conversation keep_alive rule to presets - #740
Conversation
The prompt and plugin preset routes skipped the rule POST /v1 enforces for an event trigger with destination continue_conversation: an omitted keep_alive was stored null and keep_alive false was accepted, so the run-complete handler and the watchdog deleted the sandbox holding the conversation the next event continues. The rule now lives in one helper, continue_conversation_keep_alive, used by CreateAutomationRequest, both preset request models, the plugin-spec create and PATCH. Because /v1/validate and drafts validate against the same preset request models, they report the same refusal and materialize keep_alive true. Fixes #734 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwM9ABBZYP9fcggw4R8
|
Warning Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it. |
Git sync stored keep_alive from automation.yaml as given, on both a new import and an update from git. It now goes through continue_conversation_keep_alive: an omitted value becomes true, and keep_alive false with a continue_conversation trigger skips that directory with the same logged warning as any other invalid field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwM9ABBZYP9fcggw4R8
…rsation Cron and dispatch_run event presets store keep_alive exactly as given (omitted, false or true), on both preset routes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwM9ABBZYP9fcggw4R8
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Fresh review of head aff7bba5 (re-confirmed: PR open, head matches, no prior reviews on this commit, all checks green including unit-tests and windows-tests; issue #734 still labeled bug, ready-for-dev, priority:medium).
Scope gate: automation definitions, presets, validation, and git sync are owned by this repository per AGENTS.md; the change belongs here.
Technical review — no material findings:
continue_conversation_keep_aliveinschemas.pyhas identical semantics to the inline rule it replaces onPOST /v1: parsedEventTriggeror stored dict both resolvedestination; anything else passeskeep_alivethrough unchanged;falseraisesValueErrorwith the shared message; omitted/truesettles totrue.- The preset after-validators run after field validation, so
self.triggeris the parsed discriminated union — verified directly againstCreatePromptAutomationRequest,CreatePluginAutomationRequest, andCreateAutomationRequest(omitted→true,false→ValidationErrorwithCONTINUE_CONVERSATION_KEEP_ALIVE_ERROR, cron/non-continuing event triggers store the value as given). create_automation_from_plugin_speckeeps the rule in the handler (the trigger can come from the manifest) and keeps its 400; PATCH's merged-view handling is behavior-preserving (400 onfalse, writestruewhen the merged value differs, no write when alreadytrue).- Git sync applies the helper inside
_validate_and_resolve_fieldsfor both import-create and update-from-git; theValueErrorlands in the cycle'sexcept (ValidationError, ValueError)so the directory is skipped with the standard warning and pending storage deletes roll back. The serializer/export round-trip stays stable (a forcedtruere-imports astrue). - Drafts and
/v1/validateinherit the rule throughFINAL_DRAFT_MODELS; partial draft bodies (draft_schemas) still accept the field as typed, with the refusal surfacing invalidation_errorsat final shape — consistent and tested. - Watchdog and run-complete cleanup are unchanged and correctly rely on
keep_alivealone, now guaranteed for every create path. No schema change, so no migration; pre-existingnull/falserows are addressed in the PR notes.
Tests/evidence: ran the Docker-free portions in the workspace — tests/test_git_sync.py 80 passed (includes the three new continuing import/update tests over real git), tests/test_schemas.py 33 passed, and the preset/validate model-level assertions. The remaining endpoint tests in this workspace error at fixture setup because no Docker daemon is available for the PostgreSQL testcontainer — the same fixtures already error on main's tests here, and the unit-tests CI job passes on this exact head, so this is local-environment, not the change.
✅ APPROVED
|
🚀 Released in 1.33.0. |
Requested by Engel · project thread
I'm an AI agent based on Opus 5.5, helping Engel Nyst (@enyst) with project maintenance.
Summary
POST /v1forceskeep_alive: truefor an event trigger withdestination: continue_conversationand refuseskeep_alive: falsewith 422, butPOST /v1/preset/promptandPOST /v1/preset/pluginskipped that rule: an omittedkeep_alivewas storednullandfalsewas accepted with 201. The run-complete handler and the watchdog delete a sandbox unlesskeep_aliveistrue, so a preset-created automation lost the conversation the next event should continue after every run. The rule now lives in one shared helper that every create and update path uses (including git sync), so the presets answer exactly likePOST /v1.Issue Number
Fixes #734
Changes
schemas.py: newcontinue_conversation_keep_alive(trigger, keep_alive)andCONTINUE_CONVERSATION_KEEP_ALIVE_ERROR, the one place the rule is defined.CreateAutomationRequest's validator now calls it.preset_router.py:CreatePromptAutomationRequestandCreatePluginAutomationRequestgain the same after-validator, so omittedkeep_alivebecomestrueandfalseis a 422 with thePOST /v1message.router.py: the plugin-spec create (its trigger can come from the manifest, so the rule runs in the handler) and PATCH replace their copies of the rule with the helper. Their status codes stay as they were (400).git_sync/loop.py:_validate_and_resolve_fields(import-create and update-from-git) applies the helper. A missingkeep_alivebecomestrue;keep_alive: falsewithcontinue_conversationskips that directory with the usualSkipping invalid automation directorywarning, and the rest of the cycle is unaffected./v1/validate: they diverged only because they validate against the preset request models (FINAL_DRAFT_MODELS), so they now follow the rule with no code change of their own. Partial draft bodies (draft_schemas) still accept the field as typed; the refusal shows up invalidation_errors, like other final-shape errors.tests/test_preset_router.py, including cron and other event presets storingkeep_aliveexactly as sent),/v1/validate(tests/test_capabilities_router.py), preset drafts (tests/test_draft_router.py), git sync import and update (tests/test_git_sync.py).# bug:markers and "known bug" wording fromF06.continue-keep-aliveandF06.continue-keep-alive-false; thefalserecipe checks the 422 message for both presets and that nothing was created. F06 prose/gotcha and the F05 cross-reference updated; README counts viamap check --fix-counts.F13.import-invalid-skippedalso pushes acontinue_conversationdirectory withkeep_alive: falseand checks it is skipped and logged.Evidence
uv run pytest -q tests/test_preset_router.py -k ContinueConversationKeepAlive: 22 passed.tests/test_git_sync.py -k TestImportedAutomationDefaults: 11 passed. Drafts/validate/plugin-spec-k "keep_alive or continu": 16 passed.tests/test_verify_automation_skill.py: 59 passed.uv run pytest -q -n 4: 2903 passed, 7 skipped, 0 failed (the last commit only adds tests, which pass).uv run pre-commit run --files <changed files>: ruff format, ruff lint, pycodestyle, pyright pass.map run --file F06 --only <id> --fresh --repeat 2 --checkout <baseline>: both bullets xfail ×2. Fix with markers present: both xpass ×2. Markers dropped,map run --file F06 --fresh: 16 pass, 0 fail.map run --file F13 --fresh: 30 pass, 0 fail.map run --file F05 --fresh:F05.patch-validationandF05.keep-alive-continuepass; the only fail isF05.tarball-path-errors, map drift on main fixed in docs(verify-automation): correct map drift in F03, F05 and F11 #738.Notes
POST /v1/plugin-specnow call the shared helper with unchanged behavior and status codes (400). Cron and other non-continue_conversationtriggers storekeep_aliveas given.keep_alivenull or false. Any PATCH corrects a null row; a false row refuses PATCH with 400 unless the client also sendskeep_alive: true, as on main.continue_conversationandkeep_alive: falsecould be dispatched before and is now refused, consistent withPOST /v1.🤖 Generated with Claude Code
https://claude.ai/code/session_013ArwwM9ABBZYP9fcggw4R8