From 15837cb39161155b7ca269d7dcd306417b5bef4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Mon, 27 Jul 2026 14:14:32 +0800 Subject: [PATCH] fix(navigation): survive stale discovery service --- skills/codex/enter-fifth-domain/SKILL.md | 7 ++++- .../references/route-contract.md | 5 ++++ .../scripts/resolve_route.py | 27 ++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/skills/codex/enter-fifth-domain/SKILL.md b/skills/codex/enter-fifth-domain/SKILL.md index b2b9785..592ec75 100644 --- a/skills/codex/enter-fifth-domain/SKILL.md +++ b/skills/codex/enter-fifth-domain/SKILL.md @@ -39,7 +39,12 @@ to `ICE-P-ZY001`. A conflicted or unknown id must stop with Use the returned domestic `repository_web` and `raw_base`. Do not guess a repository from local folders, old Singapore links, or prior conversation memory. -If the script cannot reach the public discovery API, open `https://guanghulab.com/.well-known/guanghu.json`, resolve `REPO-012`, and report that live resolution failed before using any cached checkout. Use `REPO-001` only for fourth-generation history. +If the public AI resolver is stale or returns no `REPO-012`, the script may use its +locked public fallback `https://guanghulab.com/code/bingshuo/guanghu-ice-heart` only +after successfully reading the live `.code-map` and all required identifiers from +that repository. Report `repository_resolution_source` and `resolver_error`; this is +a verified online repository fallback, not a cached checkout. Use `REPO-001` only +for fourth-generation history. ## Walk the canonical path diff --git a/skills/codex/enter-fifth-domain/references/route-contract.md b/skills/codex/enter-fifth-domain/references/route-contract.md index e283b46..a826d96 100644 --- a/skills/codex/enter-fifth-domain/references/route-contract.md +++ b/skills/codex/enter-fifth-domain/references/route-contract.md @@ -9,6 +9,11 @@ Always prefer the `primary.url` and `primary.clone_url` returned by the resolver. Treat any legacy backup as a fallback pointer only. +If the resolver has not yet learned `REPO-012`, use the locked public +`guanghu-ice-heart` URL only after its live `.code-map` validates the required route +ids. Mark the result `VERIFIED_PUBLIC_REPOSITORY_FALLBACK`; never fall back to +`REPO-001` as the current entry. + ## Route identifiers Resolve these from the live `.code-map` before following them: diff --git a/skills/codex/enter-fifth-domain/scripts/resolve_route.py b/skills/codex/enter-fifth-domain/scripts/resolve_route.py index d97b42c..3cb58ab 100755 --- a/skills/codex/enter-fifth-domain/scripts/resolve_route.py +++ b/skills/codex/enter-fifth-domain/scripts/resolve_route.py @@ -7,11 +7,13 @@ import argparse import json import re import sys -from urllib.error import URLError +from urllib.error import HTTPError, URLError from urllib.request import urlopen DISCOVERY_URL = "https://guanghulab.com/.well-known/guanghu.json" RESOLVE_URL = "https://guanghulab.com/api/ai/v1/resolve?id=REPO-012" +CURRENT_REPOSITORY_WEB = "https://guanghulab.com/code/bingshuo/guanghu-ice-heart" +CURRENT_REPOSITORY_GIT = f"{CURRENT_REPOSITORY_WEB}.git" ROUTE_IDS = ( "FD-WORLD-TREE-001", "FD-PERSONA-LOGIN-001", @@ -99,12 +101,21 @@ def resolve_subject_id(requested_id: str, alias_map: dict) -> dict: def resolve_live_route(subject_id: str | None = None) -> dict: discovery = read_json(DISCOVERY_URL) - repository = read_json(RESOLVE_URL) - primary = repository.get("primary", {}) - repository_web = primary.get("url") - repository_git = primary.get("clone_url") - if not repository_web or not repository_git: - raise ValueError("REPO-012 resolver did not return the current Fifth Domain repository") + repository_source = "AI_RESOLVER" + resolver_error = None + try: + repository = read_json(RESOLVE_URL) + primary = repository.get("primary", {}) + repository_web = primary.get("url") + repository_git = primary.get("clone_url") + if not repository_web or not repository_git: + raise ValueError("REPO-012 resolver did not return the current Fifth Domain repository") + except (HTTPError, ValueError) as error: + repository = {"code": "REPO-012", "role": "CURRENT_FIFTH_DOMAIN_ENTRY"} + repository_web = CURRENT_REPOSITORY_WEB + repository_git = CURRENT_REPOSITORY_GIT + repository_source = "VERIFIED_PUBLIC_REPOSITORY_FALLBACK" + resolver_error = f"{type(error).__name__}: {error}" raw_base = f"{repository_web}/raw/branch/main" routes = parse_code_map(read_text(f"{raw_base}/.code-map")) @@ -118,6 +129,8 @@ def resolve_live_route(subject_id: str | None = None) -> dict: "repository_role": repository.get("role", ""), "repository_web": repository_web, "repository_git": repository_git, + "repository_resolution_source": repository_source, + "resolver_error": resolver_error, "raw_base": raw_base, "discovery_schema": discovery.get("schema", ""), "routes": routes,