fix: return validator details for bounded retries
This commit is contained in:
parent
75ede28b59
commit
3ff80fa10b
2 changed files with 43 additions and 1 deletions
|
|
@ -213,6 +213,10 @@ test("orientation prompt carries the exact runtime contract required by the vali
|
|||
observedInstructions.zhuyuan_cognition,
|
||||
/protocol_effects必须是对象数组/,
|
||||
);
|
||||
assert.match(
|
||||
observedInstructions.zhuyuan_cognition,
|
||||
/B5\.prior_wrong_route/,
|
||||
);
|
||||
assert.match(
|
||||
observedInstructions.zhuyuan_cognition,
|
||||
/guard_agent_projection\.schema必须等于/,
|
||||
|
|
@ -227,6 +231,38 @@ test("orientation prompt carries the exact runtime contract required by the vali
|
|||
);
|
||||
});
|
||||
|
||||
test("validator details are returned to the model for a bounded retry", async () => {
|
||||
const stateRoot = fs.mkdtempSync(path.join(os.tmpdir(), "bs-tcs-retry-"));
|
||||
const fixture = new FixtureModelClient();
|
||||
let orientationAttempts = 0;
|
||||
let retryError = null;
|
||||
const modelClient = {
|
||||
async generate(request) {
|
||||
if (request.role !== "tcs_event_orientation") {
|
||||
return fixture.generate(request);
|
||||
}
|
||||
orientationAttempts += 1;
|
||||
if (orientationAttempts === 1) {
|
||||
const malformed = await fixture.generate(request);
|
||||
malformed.signals[0] = { why: malformed.signals[0].why };
|
||||
return malformed;
|
||||
}
|
||||
retryError = request.validatorError;
|
||||
return fixture.generate(request);
|
||||
},
|
||||
};
|
||||
const engine = new ControllerEngine({
|
||||
stateRoot,
|
||||
modelClient,
|
||||
modelName: "fixture-model",
|
||||
});
|
||||
engine.initialize();
|
||||
const receipt = await engine.runEvent(bootEvent());
|
||||
assert.equal(receipt.outcome, "PASS");
|
||||
assert.equal(orientationAttempts, 2);
|
||||
assert.match(retryError, /orientation\.signal\.id/);
|
||||
});
|
||||
|
||||
test("an interrupted technical cycle is preserved and restarted in a new state epoch", () => {
|
||||
const stateRoot = fs.mkdtempSync(path.join(os.tmpdir(), "bs-tcs-recovery-"));
|
||||
const first = new ControllerEngine({
|
||||
|
|
|
|||
Loading…
Reference in a new issue