MemOS icon indicating copy to clipboard operation
MemOS copied to clipboard

feat(reward): sentinel-based exchange-count bypass for cron episodes

Open chiefmojo opened this issue 6 months ago • 0 comments

Summary

Adds a config-driven bypass so cron-initiated episodes can be scored even when they fall below the minExchangesForCompletion threshold.

Problem

Scheduled agent jobs produce single-exchange episodes (the cron prompt + agent response). With the default minExchangesForCompletion: 1 floor these score fine, but tighter settings — or multi-turn flows that cron fires as one composite turn — hit the "too few exchanges" skip condition. The cron session produces real work worth scoring but the exchange-count gate silently discards it.

Solution

RewardConfig.cronSentinels: string[] — an array of substrings. If any user message in the episode starts with one of these strings, the exchange-count check (gate 1) is bypassed. All other quality gates (content length, triviality, tool-heavy ratio) remain active.

The default is an empty array ([]), so behavior is unchanged for existing deployments. Operators who run scheduled agent jobs add their sentinel string to config.yaml:

algorithm:
  reward:
    cronSentinels: ["[IMPORTANT: You are running as a scheduled cron job"]

Design notes

  • Only gate 1 (exchange count) is bypassed — content and triviality gates still apply.
  • Sentinel match is prefix-based (message.startsWith(sentinel)).
  • The bypass is transparent in logs: skipped-by-cron episodes show a distinct log tag.

Test plan

  • [ ] Episode with 1 exchange and matching sentinel: passes exchange-count gate, other gates still apply
  • [ ] Episode with 1 exchange and no matching sentinel: still skipped by exchange-count gate (default behavior)
  • [ ] Empty cronSentinels array: no change to existing behavior
  • [ ] Trivial cron episode (matching sentinel but trivial content): still skipped by content gate

🤖 Generated with Claude Code

chiefmojo avatar Jun 01 '26 01:06 chiefmojo