Repository navigation
feat(triggers): confirm a trigger stop with a configured final check - #1405
Open
jbr-sekoia wants to merge 3 commits into
Open
jbr-sekoia wants to merge 3 commits into
jbr-sekoia wants to merge 3 commits into
Conversation
A versioned stop trigger may carry finalCheck.notePath. Switchboard then runs the global stopCheckCommand argv twice, --sample-final then --check-final with the sampled evidence, rechecks target, idle state, composer and deadline, and only then stops the session. A refusal, an error, a timeout or a missing command returns its own result reason and requests no stop; a stop without finalCheck keeps its current path. The check's process group is killed at the deadline or on output overflow, and the result waits for its close within a 500 ms grace period. scripts/assert-named-test.cjs runs one named node:test test and fails when no executed test matches, for the acceptance commands of this change. Implemented with Codex, reviewed adversarially until no finding remained.
The global setting a stop trigger with finalCheck runs is listed with the settings no field sets, and links to the new "Stop final check" section of the automation guide.
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
A versioned stop trigger can now ask Switchboard to confirm, just before it ends the session, that the session's resume note is committed and its last turn is finished. The trigger carries only
"finalCheck":{"notePath":"<absolute path>"}; the check itself is a command the user configures in the new global settingstopCheckCommand(an argv array, defaultnull). Trigger files can never supply arguments or an executable.stop check refused(first stdout line indetail)stop check failedstop check timed outstop check unavailableNone of these outcomes sets
uncertain, and completedbeforedelivery evidence is kept on refusal. A stop withoutfinalChecktakes exactly the current path. On POSIX the check runs in its own process group, killed at the deadline or on output overflow; the result waits for the child'sclosewithin a 500 ms grace period.scripts/assert-named-test.cjsruns one namednode:testtest and fails when no executed test matches (a bare--test-name-patternthat matches nothing exits 0); it backs the acceptance commands of this change and lives outsidescripts/run-tests.jsselection.Consumer of this contract: JBR's session life-cycle harness (
lifecycle_stop.py --sample-final/--check-final), which will only sendfinalCheckonce a Switchboard release carries this change.Docs
docs/automation.md(new section "Stop final check": stop requestfinalCheck,stopCheckCommand, the two argv forms, result reasons, Windows limits);docs/settings.md(stopCheckCommandamong the settings no field sets).ai/contexts/trigger-watcher.md(trigger-actions entry)Changelog
Entry under
## Unreleased→### New.Tests
node --test test/trigger-actions-stop.test.js test/trigger-actions-schema.test.js test/setting-defaults.test.js: 189 pass, 0 fail (Node 22, Linux).final check overflow keeps its reason past the deadline)node scripts/assert-named-test.cjs '<name>' <file>: all PASS; the timeout control (ASSERT_NAMED_TEST_TIMEOUT_MS=2000 … 'blocked' test/fixtures/assert-named-test-blocked.cjs) exits 1 withFAIL blocked timed out; the missing-name guard passes.task checkatc1b1ed68(Linux, Node 22,LANG=C): exit 0, 14 972 + 495 tests pass, lint 0 errors.Implemented with Codex; four adversarial review rounds (Codex) until no finding remained, each fix proved by a mutation that turns its test red.
🤖 Generated with Claude Code