fix: restore OpenCode health compatibility for startup (#1542)
This commit is contained in:
@@ -13,6 +13,7 @@ const HEALTH_CHECK_MAX_CONSECUTIVE_FAILURES = parsePositiveInt(
|
||||
);
|
||||
const HEALTH_CHECK_INTERVAL_OVERRIDE_MS = parsePositiveInt(process.env.OPENCHAMBER_OPENCODE_HEALTH_INTERVAL_MS, 0);
|
||||
const HEALTH_CHECK_RESULT_CACHE_MS = parsePositiveInt(process.env.OPENCHAMBER_OPENCODE_HEALTH_CACHE_MS, 750);
|
||||
const OPENCODE_HEALTH_PATH = '/global/health';
|
||||
|
||||
export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
const {
|
||||
@@ -392,7 +393,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(buildOpenCodeUrl('/api/health', ''), {
|
||||
const response = await fetch(buildOpenCodeUrl(OPENCODE_HEALTH_PATH, ''), {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -417,7 +418,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 3000);
|
||||
const base = origin ?? `http://127.0.0.1:${port}`;
|
||||
const response = await fetch(`${base}/api/health`, {
|
||||
const response = await fetch(`${base}${OPENCODE_HEALTH_PATH}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -663,7 +664,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
timeout = setTimeout(() => controller.abort(), HEALTH_CHECK_TIMEOUT_MS);
|
||||
const response = await fetch(buildOpenCodeUrl('/api/health', ''), {
|
||||
const response = await fetch(buildOpenCodeUrl(OPENCODE_HEALTH_PATH, ''), {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json', ...getOpenCodeAuthHeaders() },
|
||||
signal: controller.signal,
|
||||
|
||||
@@ -33,7 +33,7 @@ export const createOpenCodeNetworkRuntime = (deps) => {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
timeout = setTimeout(() => controller.abort(), 3000);
|
||||
const response = await fetch(`${url.replace(/\/+$/, '')}/api/health`, {
|
||||
const response = await fetch(`${url.replace(/\/+$/, '')}/global/health`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
||||
@@ -214,7 +214,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
||||
|
||||
app.get('/api/opencode/health', async (_req, res) => {
|
||||
try {
|
||||
const healthResponse = await fetch(buildOpenCodeUrl('/api/health', ''), {
|
||||
const healthResponse = await fetch(buildOpenCodeUrl('/global/health', ''), {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json', ...getOpenCodeAuthHeaders() },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user