← Back to PRs

#7036: Fix evil soul hooks by enforcing env properties

by myberry2026 open 2026-02-02 09:55 View on GitHub →
Updated `resolveSoulEvilConfigFromHook` to strictly use `env` properties if the `env` object is present. This prevents configuration variables from being read from the top-level scope when an environment block is defined, enforcing a cleaner separation of configuration. Test coverage updated to: - Verify usage of `env` properties. - Ensure top-level properties are ignored when `env` is present. - Verify behavior with empty `env` blocks. AI-Assisted: True Testing: Fully tested (unit tests updated and passed). <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR changes `resolveSoulEvilConfigFromHook` to prefer `entry.env` as the sole source of configuration when an `env` block exists, preventing accidental reads from top-level keys. The unit tests were updated to cover env precedence, ignoring top-level keys when `env` exists, and the empty-`env` behavior. This is used by the bundled `soul-evil` hook handler (`src/hooks/bundled/soul-evil/handler.ts`) to parse hook config before applying the SOUL override during agent bootstrap. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge; the behavior change is small and covered by updated tests. - Core change is a localized precedence rule in `resolveSoulEvilConfigFromHook` with added tests. Main remaining concern is the new truthy check for `env` that can mis-handle non-object values, which could confuse users with misconfigured hooks. - src/hooks/soul-evil.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs