fix: add tri-state skill_inject.mode — manual/auto/disabled (PILOT-395)#17
Merged
Conversation
Add tests for: - GetMode/SetMode round-trip through disk (manual/auto/disabled) - Empty config defaults to auto (backward compat) - Legacy enabled format backward compat - Empty/invalid mode defaults to auto - SetMode preserves other config keys - New mode format preferred over legacy format
…led (PILOT-395) Replace the boolean skill_inject.enabled flag with a tri-state mode string (manual | auto | disabled) stored at ~/.pilot/config.json under skill_inject.mode. Behavior: - manual (DEFAULT for new installs): install once on daemon startup + refresh on Pilot update, no 15-min reconcile ticker. - auto: current always-live behavior with 15-min reconcile ticker. - disabled: no ticks, equivalent to the old SetEnabled(false). Backward compatibility: - GetMode() falls back to the legacy EnabledFlag format when no mode is set, so existing installs with skill_inject.enabled keep working. - SetEnabled(bool) is retained as a deprecated shim that maps to SetMode (true -> auto, false -> disabled). - Missing config defaults to ModeAuto (unchanged from before). New API: - GetMode(home) string — returns manual/auto/disabled - SetMode(home, mode) error — persists the mode Closes PILOT-395
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What changed
Replaced the boolean
skill_inject.enabledflag in~/.pilot/config.jsonwith a tri-stateskill_inject.modestring:manual,auto, ordisabled.Files changed:
config.go— AddedGetMode/SetMode, retiredEnabledFlagin favor ofModeFlag, keptIsEnabled/SetEnabledas deprecated backward-compat shimsskillinject.go—Tick()usesGetModeinstead ofIsEnabled;Run()returns after startup tick when mode is manual (no ticker)zz_more_test.go— Added 8 new tests for the mode APIBehavior per mode
manualautodisabledSetEnabled(false)Verification
go build ./...✅go vet ./...✅go test -count=1 ./...✅ (all existing + new tests pass)Backward compatibility
{\\skill_inject\: {\enabled\: true}}are read correctly →ModeAutoSetEnabled(bool)is preserved as a shim →SetModeModeAuto(same as before)Closes PILOT-395