JacobLinCool Codex commited on
Commit
be083b8
·
verified ·
1 Parent(s): c4383f3

fix: show startup index failures

Browse files

Co-authored-by: Codex <noreply@openai.com>

Files changed (1) hide show
  1. static/app.js +26 -1
static/app.js CHANGED
@@ -38,7 +38,7 @@ let turnWatchdog = null;
38
  let sawTurnToken = false;
39
  let bootstrapData = null;
40
 
41
- bootstrap();
42
 
43
  form.addEventListener("submit", async (event) => {
44
  event.preventDefault();
@@ -141,6 +141,7 @@ async function runTurn(message) {
141
 
142
  async function bootstrap() {
143
  const response = await fetch("/api/bootstrap");
 
144
  const data = await response.json();
145
  bootstrapData = data;
146
  const rawProfiles = Array.isArray(data.target_profiles) ? data.target_profiles : [];
@@ -157,6 +158,30 @@ async function bootstrap() {
157
  renderWhitespace(data.whitespace || []);
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  function defaultSession(data = bootstrapData) {
161
  return {
162
  profile: {},
 
38
  let sawTurnToken = false;
39
  let bootstrapData = null;
40
 
41
+ bootstrap().catch(handleBootstrapError);
42
 
43
  form.addEventListener("submit", async (event) => {
44
  event.preventDefault();
 
141
 
142
  async function bootstrap() {
143
  const response = await fetch("/api/bootstrap");
144
+ if (!response.ok) throw new Error(`project index failed with ${response.status}`);
145
  const data = await response.json();
146
  bootstrapData = data;
147
  const rawProfiles = Array.isArray(data.target_profiles) ? data.target_profiles : [];
 
158
  renderWhitespace(data.whitespace || []);
159
  }
160
 
161
+ function handleBootstrapError(error) {
162
+ bootstrapData = null;
163
+ currentArtifact = null;
164
+ session = {};
165
+ submit.disabled = true;
166
+ input.disabled = true;
167
+ setCommandDisabled(true);
168
+ ink.textContent = `The project index could not be opened: ${error.message}`;
169
+ ink.classList.remove("thinking", "gold");
170
+ ink.classList.add("bleed");
171
+ corrections.textContent = "Reload the page to try again.";
172
+ provenanceEl.textContent = "index unavailable";
173
+ renderScore(null);
174
+ verdictEl.textContent = "UNWRITTEN";
175
+ overallEl.textContent = "0.0";
176
+ renderWoodMap(null);
177
+ renderTargets([]);
178
+ renderProfile({});
179
+ renderIdeas([]);
180
+ renderProjects([]);
181
+ renderWhitespace([]);
182
+ renderPlan([]);
183
+ }
184
+
185
  function defaultSession(data = bootstrapData) {
186
  return {
187
  profile: {},