Skip to content

test(runtime): isolate user config in tests - #3981

Merged
Sayt-0 merged 1 commit into
mainfrom
runtime-user-config-test-isolation
Aug 13, 2026
Merged

test(runtime): isolate user config in tests#3981
Sayt-0 merged 1 commit into
mainfrom
runtime-user-config-test-isolation

Conversation

@aheritier

Copy link
Copy Markdown
Collaborator

pkg/runtime tests now isolate the user config directory so local ~/.config/cagent settings cannot affect test outcomes.

Validation:

  • task test passed
  • task lint passed
  • task build passed
  • Targeted runtime tests passed, including with cache_stable_prompts enabled.

TestMain reads userconfig.Get() indirectly via hooks.go's
CacheStablePromptsEnabled() and loop.go's CacheMissWarningsEnabled(),
which resolve through paths.GetConfigDir(). Without an override this
silently loaded the developer's real ~/.config/cagent/config.yaml
(cache_stable_prompts: true), so structured-output tests that assert
on the injected transient-reminder cache marker failed nondeterministically
depending on the machine's local settings.

Extend TestMain to point paths.SetConfigDir at an empty temp directory
for the whole package run, mirroring the pkg/httpclient precedent, so
every runtime test observes library defaults instead of leaking local
preferences.
@aheritier
aheritier requested a review from a team as a code owner August 13, 2026 22:13
@Sayt-0
Sayt-0 merged commit a1deb30 into main Aug 13, 2026
15 checks passed
@Sayt-0
Sayt-0 deleted the runtime-user-config-test-isolation branch August 13, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants