mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-02 06:54:50 +01:00
A2: render db-unreachable like timeout
gbrain's new db-unreachable status is a transient network failure; a setup run while offline must not strip brain-aware blocks from every skill.
This commit is contained in:
1 parent
5526fca45c
commit
3f3655b925
2 files changed
+20
-2
No files matched your search
@@ -84,8 +84,8 @@ function loadGbrainOverride(respectDetection: boolean): boolean {
|
||||
const stateDir = resolveStateRoot();
|
||||
try {
|
||||
const json = JSON.parse(fs.readFileSync(path.join(stateDir, 'gbrain-detection.json'), 'utf-8'));
|
||||
// Slow, remote, and locked engines are still usable (#1964/#2051/#2456).
|
||||
return ['ok', 'timeout', 'thin-client', 'engine-locked'].includes(json.gbrain_local_status ?? '');
|
||||
// Slow, remote, locked and briefly unreachable engines are still usable (#1964/#2051/#2456, A2).
|
||||
return ['ok', 'timeout', 'db-unreachable', 'thin-client', 'engine-locked'].includes(json.gbrain_local_status ?? '');
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -151,6 +151,24 @@ describe('gbrain detection override → gen-skill-docs', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('with status "db-unreachable" (transient network failure, A2), brain blocks render like "timeout"', () => {
|
||||
const { tmpHome, cleanup } = makeFixture(
|
||||
JSON.stringify({
|
||||
gbrain_local_status: 'db-unreachable',
|
||||
gbrain_on_path: true,
|
||||
gbrain_version: 'test-0.42.26',
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const content = probeUnion(regenAndSnapshot({ respectDetection: true, tmpHome, files: PROBE_FILES }));
|
||||
// An offline setup must not strip brain-aware blocks from every skill.
|
||||
expect(content).toContain('## Save Results to Brain');
|
||||
expect(content).toContain('gbrain put "office-hours/');
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test('with status "engine-locked" (PGLite single-writer, #2456), brain blocks render like "ok"', () => {
|
||||
const { tmpHome, cleanup } = makeFixture(
|
||||
JSON.stringify({
|
||||
|
||||
Reference in new issue
Block a user