Skip to content

feature(agent): make catalog EWMA alpha configurable - #246

Open
nghiadaulau wants to merge 1 commit into
VersusControl:mainfrom
nghiadaulau:feat/agent-ewma-alpha-config
Open

feature(agent): make catalog EWMA alpha configurable#246
nghiadaulau wants to merge 1 commit into
VersusControl:mainfrom
nghiadaulau:feat/agent-ewma-alpha-config

Conversation

@nghiadaulau

Copy link
Copy Markdown
Member

Summary

Promotes the pattern-baseline EWMA smoothing factor from a hardcoded 0.2
to a configurable agent.catalog.ewma_alpha (default 0.2, range
(0,1]). Each pattern's baseline frequency is
baseline = ewma_alpha·tick + (1−ewma_alpha)·baseline; higher reacts
faster to recent ticks, lower is steadier. Since spike detection compares
the live frequency against this baseline (spike_multiplier), the knob
directly tunes spike sensitivity — previously un-tunable.

Changes

  • AgentCatalogConfig.EwmaAlpha (ewma_alpha), threaded into the worker
    with a 0.2 fallback when unset; catalog.go keeps its defensive
    alpha <= 0 floor.
  • Config triple-touch: struct + clone_config deep-clone +
    config/config.yaml default, with a cloneConfig round-trip test (an
    un-mirrored field silently resets to 0 → the fallback on every
    query-param-overridden request).
  • Docs: src/agent/configuration.md catalog table + CHANGELOG.
  • CONTRIBUTING: documents the config triple-touch rule itself, so
    future config fields don't repeat the omission.

Not in Helm — deliberately

The chart exposes no agent.catalog tuning today (spike_multiplier,
persist_interval, auto_promote_after are all code-default only), so
ewma_alpha follows the same convention rather than being the lone catalog
knob in values.yaml. Happy to add the whole catalog block to the chart in
a follow-up if you'd prefer.

Testing

  • TestNewWorker_EwmaAlphaFromConfig — worker reads the configured value
    and defaults to 0.2 when unset.
  • TestCloneConfigCarriesEwmaAlpha — survives a cloneConfig round-trip.
  • gofmt, go vet, go build ./..., go test -race ./pkg/config ./pkg/agent
    green.

Checklist

  • Table-driven / round-trip tests for the new behavior
  • Config triple-touch (struct + clone_config + config.yaml)
  • Backward compatible (unset = 0.2 default)
  • House conventions (feature: prefix); docs + CHANGELOG + CONTRIBUTING

The EWMA smoothing factor for each pattern's baseline frequency was
hardcoded to 0.2 in the worker. Promote it to agent.catalog.ewma_alpha
(default 0.2, range (0,1]) so operators can tune how fast baselines react
to recent ticks. The baseline is what spike detection compares against, so
this knob tunes spike sensitivity.

- AgentCatalogConfig.EwmaAlpha + clone_config mirror (config triple-touch),
  with a cloneConfig round-trip test.
- worker reads it with a 0.2 fallback when unset; catalog.go keeps its
  defensive alpha<=0 floor.
- config.yaml default + docs.
- CONTRIBUTING: document the config triple-touch rule (struct +
  clone_config + config.yaml) so future fields don't silently drop
  per-request overrides.

Not exposed in the Helm chart: the chart intentionally surfaces no
agent.catalog tuning (spike_multiplier, persist_interval, etc. are all
code-default only), so ewma_alpha follows the same convention.
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.

1 participant