INNER CODE UNIT · TypeScript

hasFailure

agent-sh/agentsys · adapters/opencode-plugin/index.ts:302

          const hasFailure = FAILURE_INDICATORS.some(p => p.test(outputText))

          if (hasFailure) {
            console.error(`[agentsys] Script failure detected: ${command}. Report to user before manual fallback.`)

            // Record failure in flow.json for workflow tracking
            try {
              const stateDir = getStateDir(directory)
              const flowPath = join(stateDir, "flow.json")

              if (existsSync(flowPath)) {
                const state = JSON.parse(await readFile(flowPath, "utf-8"))
                if (state && typeof state === "object" && !Array.isArray(state)) {
                  state.lastScriptFailure = {
                    command,
                    timestamp: Date.now()
                  }
                  await writeFile(flowPath, JSON.stringify(state, null, 2))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…