Prioritize survival readiness over bot work and model goals
Core tests / core (push) Successful in 36s

This commit is contained in:
Codex
2026-09-24 04:05:48 +12:00
parent 1552e4c165
commit 0731774457
6 changed files with 135 additions and 16 deletions
+20
View File
@@ -40,3 +40,23 @@ test('foreground residents use configured local model',()=>{
assert.equal(route.provider,'ollama');
assert.equal(route.model,state.settings.brains.residentModel);
});
const {DeterministicProvider,LocalLLMProvider}=require('../.test-build/llm/index.js');
test('fresh injury overrides aggressive goals in both brain providers without a model call',async()=>{
const bot=seed().bots[0];
bot.personality.activities=['quest','rest'];bot.personality.aggression=100;
bot.world={at:Date.now()/1000,healthPct:70};
const observation={availableActions:['quest','rest']};
for(const provider of [new DeterministicProvider(),new LocalLLMProvider('ollama','unused',{})]){
const decision=await provider.decide(bot,observation);
assert.equal(decision.action,'rest');assert.match(decision.reason,/Staying alive/);
}
});
test('stale injury and unavailable rest do not override permitted decisions',async()=>{
const bot=seed().bots[0];bot.personality.activities=['quest','rest'];bot.personality.aggression=100;
bot.world={at:Date.now()/1000-120,healthPct:70};
const provider=new DeterministicProvider();
assert.equal((await provider.decide(bot,{availableActions:['quest','rest']})).action,'quest');
bot.world.at=Date.now()/1000;
assert.equal((await provider.decide(bot,{availableActions:['quest']})).action,'quest');
});