Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
74b8ec0
fix: preserve readable reasoning in 409 history continuation
ranxi2001 Nov 13, 2026
96ba36a
test: repair readable continuation fixtures and evidence gates
ranxi2001 Nov 13, 2026
5d8d14b
test: stage HTTP readable task rebuild transport RED
ranxi2001 Nov 13, 2026
84e47f1
fix: rebuild readable HTTP tasks across unavailable owners
ranxi2001 Nov 13, 2026
0ca5b7a
test: stage scoped future shadow transport recovery
ranxi2001 Nov 13, 2026
de22aee
fix: close HTTP pointer waiver and replay integrity gaps
ranxi2001 Nov 13, 2026
f71b36d
fix: restore bounded future task context after committed HTTP delivery
ranxi2001 Nov 13, 2026
e59321c
Merge origin/production into readable continuation candidate
ranxi2001 Nov 13, 2026
a431cb2
fix: restore historical CI dependencies and install replay Redis fixture
ranxi2001 Nov 13, 2026
faeba37
fix: fence shadow publication and keep recovered context out of audit…
ranxi2001 Nov 13, 2026
74ca49c
test: stage same-client readable WS recovery on five real adapters
ranxi2001 Nov 13, 2026
d023408
Merge remote readable continuation CI fixes without rewriting history
ranxi2001 Nov 13, 2026
0765de3
fix: preserve async audit penalties and strengthen continuation oracles
ranxi2001 Nov 13, 2026
885004f
test: hold shadow invalidation race at the actual restored request bo…
ranxi2001 Nov 13, 2026
04f6149
test: remove unused websocket import from rebuild fixture
ranxi2001 Nov 13, 2026
5e83d0b
merge: integrate production HTTP 400 recovery with readable continuation
ranxi2001 Nov 13, 2026
d1dc5fe
fix: preserve isolated OAuth session for readable rebuilds
ranxi2001 Nov 13, 2026
d7d91ed
feat: continue unsent websocket turns across eligible accounts
ranxi2001 Nov 13, 2026
b5892af
merge: integrate production and pin strict pointer evidence
ranxi2001 Nov 13, 2026
94bb4a5
fix: preserve websocket identity and provider recovery state
ranxi2001 Nov 13, 2026
f6a3b90
Merge production HTTP2 fixes into readable continuation
ranxi2001 Nov 13, 2026
ceed61d
fix: preserve rebuilt websocket tools and bound provider egress
ranxi2001 Nov 13, 2026
3f04572
fix: limit readable tool projection to the HTTP bridge
ranxi2001 Nov 13, 2026
fed6841
ci: preserve bridge type compatibility in historical RED overlays
ranxi2001 Nov 13, 2026
8949202
Merge commit '7827a2f5f900ce50aafa37ab71ca1918dfe7cf8a' into fix/agen…
ranxi2001 Nov 13, 2026
cd38ac2
test: report gateway refusal when ticket fixture connection closes
ranxi2001 Nov 13, 2026
1c6e1b1
fix: refresh native 400 retry snapshot and repair WS evidence fixtures
ranxi2001 Nov 13, 2026
63f4c56
test: capture causal WS refusals and align historical RED fixtures
ranxi2001 Nov 13, 2026
f5e1e9c
ci: provision isolated audit stores for integration tests
ranxi2001 Nov 13, 2026
8e44cf2
test: supply normalized jailbreak categories in penalty fixture
ranxi2001 Nov 13, 2026
afa7dbd
merge: integrate production while preserving readable continuation ev…
ranxi2001 Nov 14, 2026
112d342
merge: preserve readable continuation and selected moderation on prod…
ranxi2001 Nov 14, 2026
3361f06
fix: audit restored WS tasks before dispatch and align historical fix…
ranxi2001 Nov 14, 2026
3db131a
fix: moderate recovered Responses context and match audit close codes
ranxi2001 Nov 14, 2026
878b708
docs: reconcile readable continuation capabilities and historical evi…
ranxi2001 Nov 14, 2026
62bd865
ci: bound Ubuntu package downloads and avoid stalled mirror retries
ranxi2001 Nov 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/scripts/assert-future-shadow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Exact named network evidence for the future-shadow TDD increment."""

import importlib.util
import json
import sys
from collections import Counter
from pathlib import Path


SPEC = importlib.util.spec_from_file_location("shadow_evidence_common", Path(__file__).with_name("assert-readable-continuation.py"))
COMMON = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(COMMON)
ROOT = "TestOpenAI409FutureShadowHTTP"
BOUNDARIES = "TestOpenAI409FutureShadowBoundaries"
LEAVES = {f"{ROOT}/stream={stream}" for stream in ("false", "true")}
BOUNDARY_NAMES = ("other_user", "other_key", "other_group", "other_model", "other_session", "other_task", "expired", "write_failed", "pending_owner", "failed_owner", "conflicted_owner", "off", "fresh_intent")
BOUNDARY_LEAVES = {f"{BOUNDARIES}/stream={stream}/{case}" for stream in ("false", "true") for case in BOUNDARY_NAMES}
RESOURCES = "TestOpenAI409FutureShadowResources"
RESOURCE_LEAVES = {f"{RESOURCES}/stream={stream}/{case}" for stream in ("false", "true") for case in ("capacity_oldest", "capacity_latest", "store_write_failed", "store_read_failed", "oversize", "pending_tool", "pending_output", "conflicting_output", "echoed_task")}
ASSOCIATION = "TestOpenAI409FutureShadowTaskAssociation"
ASSOCIATION_LEAVES = {f"{ASSOCIATION}/stream={stream}" for stream in ("false", "true")}


def validate(phase, code, raw, boundaries=False, resources=False, association=False):
if phase not in ("RED", "GREEN") or ((boundaries or resources) and phase != "GREEN") or sum((boundaries, resources, association)) > 1:
raise ValueError("invalid shadow evidence phase")
COMMON.check_clean(raw)
events = []
for line in raw.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
continue
if not isinstance(event, dict):
raise ValueError("invalid event")
events.append(event)
root, leaves = (BOUNDARIES, BOUNDARY_LEAVES) if boundaries else (ROOT, LEAVES)
if resources:
root, leaves = RESOURCES, RESOURCE_LEAVES
if association:
root, leaves = ASSOCIATION, ASSOCIATION_LEAVES
terminal = "fail" if phase == "RED" else "pass"
if code != (1 if phase == "RED" else 0):
raise ValueError("unexpected exit status")
actions = Counter((event.get("Action"), event.get("Test")) for event in events if event.get("Package") == COMMON.PACKAGE)
for name in leaves | {root}:
if actions["run", name] != 1:
raise ValueError(f"missing or duplicate named run: {name}")
for name in leaves | {root, None}:
if actions[terminal, name] != 1 or actions["pass", name] + actions["fail", name] != 1:
raise ValueError(f"incorrect terminal event: {name}")
for event in events:
if event.get("Action") == "fail" and (phase == "GREEN" or event.get("Package") != COMMON.PACKAGE or event.get("Test") not in leaves | {root, None}):
raise ValueError("unrelated failure")
if phase == "RED":
for name in leaves:
output = "".join(event.get("Output", "") for event in events if event.get("Package") == COMMON.PACKAGE and event.get("Test") == name)
required = ("SHADOW_TASK_ASSOCIATION_MISMATCH",) if association else ("FUTURE_SHADOW_B_DISPATCH_MISSING", "encrypted_agent_recovery_readable_intent_missing")
if any(marker not in output for marker in required):
raise ValueError(f"missing named shadow business assertion: {name}")


def main():
phase, code, filename, *options = sys.argv[1:]
if options not in ([], ["--boundaries"], ["--resources"], ["--association"]):
raise ValueError("invalid option")
validate(phase, int(code), Path(filename).read_text(), options == ["--boundaries"], options == ["--resources"], options == ["--association"])
leaves = ASSOCIATION_LEAVES if options == ["--association"] else RESOURCE_LEAVES if options == ["--resources"] else BOUNDARY_LEAVES if options else LEAVES
print(f"{phase}: {len(leaves)} named shadow scenarios verified")


if __name__ == "__main__":
try:
main()
except ValueError as error:
raise SystemExit(str(error)) from error
147 changes: 147 additions & 0 deletions .github/scripts/assert-http-task-rebuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
"""Named HTTP task-rebuild TDD evidence; reuse the reviewed pollution gate."""

import importlib.util
import json
import sys
from collections import Counter
from pathlib import Path


SPEC = importlib.util.spec_from_file_location(
"readable_evidence", Path(__file__).with_name("assert-readable-continuation.py")
)
COMMON = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(COMMON)
ROOT = "TestOpenAI409HTTPTaskRebuild"
BOUNDARIES = "TestOpenAI409HTTPRebuildBoundaries"
TOOLS = "TestOpenAI409HTTPToolDefinitionOracle"
MIXED = "TestOpenAI409HTTPMixedDeliveryFences"
NORMALIZATION = "TestOpenAI409HTTPControlNormalization"
POINTER_WAIVER = "TestOpenAI409HTTPUnownedPointerMustDetach"
PACKAGE = COMMON.PACKAGE
LEAVES = {
f"{ROOT}/{account}/stream={stream}/{pointer}/{outcome}"
for account in ("apikey", "oauth")
for stream in ("false", "true")
for pointer in ("intent", "previous", "conversation")
for outcome in ("completed", "rejected", "write_failed")
}
BOUNDARY_LEAVES = {
f"{BOUNDARIES}/{account}/stream={stream}/{boundary}"
for account in ("apikey", "oauth")
for stream in ("false", "true")
for boundary in ("pointer_only", "opaque_only", "delivery_pending", "delivery_failed", "b_disabled")
}
TOOL_LEAVES = {
f"{TOOLS}/{account}/stream={stream}/{mutation}"
for account in ("apikey", "oauth") for stream in ("false", "true")
for mutation in ("drop_tools", "change_schema")
}
MIXED_LEAVES = {
f"{MIXED}/{account}/stream={stream}/{owner}/{state}/{order}"
for account in ("apikey", "oauth") for stream in ("false", "true")
for owner in ("A", "B") for state in ("pending", "failed", "conflict")
for order in ("forward", "reverse")
}
NORMALIZATION_LEAVES = {
f"{NORMALIZATION}/{account}/stream={stream}/{case}"
for account, case in (("apikey", "blank_parts"), ("oauth", "blank_parts"), ("oauth", "nested_choice"), ("apikey", "no_tools_parallel"))
for stream in ("false", "true")
}
POINTER_WAIVER_LEAVES = {f"{POINTER_WAIVER}/setting_error={value}" for value in ("false", "true")}
SUITES = {"boundaries": (BOUNDARIES, BOUNDARY_LEAVES), "tool-oracle": (TOOLS, TOOL_LEAVES), "mixed-fences": (MIXED, MIXED_LEAVES),
"normalization": (NORMALIZATION, NORMALIZATION_LEAVES), "pointer-waiver": (POINTER_WAIVER, POINTER_WAIVER_LEAVES)}
MUTANTS = {
"newest-only": f"{MIXED}/apikey/stream=false/A/failed/forward",
"break-on-owner-mismatch": f"{MIXED}/apikey/stream=false/A/failed/reverse",
}
DIAGNOSTIC = "HTTP_REBUILD_B_DISPATCH_MISSING"
OLD_REFUSALS = (
"encrypted_agent_recovery_owner_unavailable",
"encrypted_agent_recovery_http_previous_response_unsupported",
"encrypted_agent_recovery_wire_changed",
)


def validate(phase, exit_code, transcript, boundaries=False, suite=None, mutant=None):
if boundaries:
suite = "boundaries"
if phase not in {"RED", "GREEN", "MUTANT"} or (suite is not None and (suite not in SUITES or (phase != "GREEN" and not (phase == "RED" and suite in {"normalization", "pointer-waiver"})))):
raise ValueError("invalid task-rebuild phase")
if (phase == "MUTANT") != (mutant in MUTANTS) or (mutant is not None and mutant not in MUTANTS):
raise ValueError("invalid source mutant")
COMMON.check_clean(transcript)
events = []
for line in transcript.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
continue
if not isinstance(event, dict):
raise ValueError("invalid go-test event")
events.append(event)
root, leaves = SUITES[suite] if suite else (ROOT, LEAVES)
if mutant:
root, leaves = MIXED, {MUTANTS[mutant]}
terminal = "pass" if phase == "GREEN" else "fail"
expected_exit = 0 if phase == "GREEN" else 1
if exit_code != expected_exit:
raise ValueError("unexpected go-test exit status")
actions = Counter(
(event.get("Action"), event.get("Test"))
for event in events if event.get("Package") == PACKAGE
)
for name in leaves | {root}:
if actions["run", name] != 1:
raise ValueError(f"missing/repeated named test: {name}")
for name in leaves | {root, None}:
if actions[terminal, name] != 1 or actions["pass", name] + actions["fail", name] != 1:
raise ValueError(f"missing or incorrect test/package terminal: {name}")
for event in events:
if event.get("Action") == "fail" and (
phase == "GREEN" or event.get("Package") != PACKAGE or event.get("Test") not in leaves | {root, None}
):
raise ValueError("unexpected failure outside named task-rebuild RED")
if phase != "GREEN":
for name in leaves:
output = "".join(
event.get("Output", "") for event in events
if event.get("Package") == PACKAGE and event.get("Test") == name
)
if phase == "MUTANT":
if "HTTP_REBUILD_FENCE_BYPASSED" not in output or "coding-task-complete" not in output:
raise ValueError(f"missing actual extra-generation counterexample: {name}")
elif suite == "pointer-waiver":
if "UNOWNED_POINTER_WAIVER_LEAK" not in output:
raise ValueError(f"missing actual unowned-pointer dispatch: {name}")
elif suite == "normalization":
marker = "automatic next tool turn must finish" if name.endswith("/no_tools_parallel") else DIAGNOSTIC
code = "encrypted_agent_recovery_readable_intent_missing" if name.endswith("/blank_parts") else "encrypted_agent_recovery_wire_changed"
if marker not in output or code not in output:
raise ValueError(f"missing normalization business refusal: {name}")
elif DIAGNOSTIC not in output or not any(code in output for code in OLD_REFUSALS):
raise ValueError(f"missing named B-dispatch refusal assertion: {name}")


def main():
phase, code, filename, *options = sys.argv[1:]
if len(options) > 1:
raise ValueError("unknown option")
suite, mutant = None, None
if options:
if options[0].startswith("--mutant="):
mutant = options[0].split("=", 1)[1]
else:
suite = options[0].removeprefix("--")
if suite not in SUITES:
raise ValueError("unknown suite")
validate(phase, int(code), Path(filename).read_text(), suite=suite, mutant=mutant)
count = 1 if mutant else len(SUITES[suite][1] if suite else LEAVES)
print(f"{phase}: {count} named task-rebuild scenarios verified")


if __name__ == "__main__":
try:
main()
except ValueError as exc:
raise SystemExit(str(exc)) from exc
119 changes: 119 additions & 0 deletions .github/scripts/assert-readable-continuation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"""CI-only evidence gate: compilation failures, skips and empty runs are not RED."""

import json
import re
import sys
from collections import Counter
from pathlib import Path


ROOT = "TestOpenAI409ReadableContinuationHTTP"
PACKAGE = "github.com/Wei-Shaw/sub2api/internal/handler"
LEAVES = {
f"{ROOT}/{fixture}/stream={stream}/{outcome}"
for fixture in ("summary", "content", "stored_content")
for stream in ("false", "true")
for outcome in ("completed", "rejected", "write_failed")
}
POLLUTION = re.compile(
r"panic|data\s+race|race\s+detected|race\s+detector|ThreadSanitizer|"
r"fatal\s+(?:error|runtime)|runtime\s+error|runtime:\s*out of memory|"
r"SIG(?:SEGV|ABRT|BUS|ILL|QUIT)|segmentation\s+(?:fault|violation)|"
r"stack\s+overflow|core\s+dumped|crash|test\s+timed\s+out|"
r"signal:\s*(?:killed|aborted|terminated|interrupt)|\bKilled\b|"
r"build\s+failed|setup\s+failed|undefined:|no\s+tests\s+to\s+run|"
r"---\s*SKIP:|\[SKIP\]",
re.IGNORECASE,
)


def check_clean(transcript):
# Inspect raw stderr AND decoded go-test Output. A recovered panic can be
# a structured application log inside JSON, even with exit=0 and PASS.
outputs = []
for line in transcript.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
continue
if isinstance(event, dict):
if event.get("Action") == "skip":
raise ValueError("skipped tests cannot prove RED/GREEN")
output = event.get("Output", "")
if isinstance(output, str):
outputs.append(output)
if POLLUTION.search(transcript) or POLLUTION.search("".join(outputs)):
raise ValueError("contaminated evidence: runtime/build/skip diagnostic")


def validate(phase, exit_code, transcript):
if phase not in {"RED", "GREEN"}:
raise ValueError("unknown phase")
check_clean(transcript)
events = []
for line in transcript.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
# Raw stderr was scanned above. Required test/package terminal
# events below reject truncated and compilation-only evidence.
continue
if not isinstance(event, dict):
raise ValueError("invalid go-test event")
events.append(event)

actions = Counter(
(event.get("Action"), event.get("Test"))
for event in events
if event.get("Package") == PACKAGE
)
for name in LEAVES | {ROOT}:
if actions["run", name] != 1:
raise ValueError("missing or repeated named HTTP behavior test")
if actions["pass", name] + actions["fail", name] != 1:
raise ValueError("missing or repeated test terminal event")
for event in events:
if event.get("Action") == "fail" and (
event.get("Package") != PACKAGE or event.get("Test") not in LEAVES | {ROOT, None}
):
raise ValueError("unrelated failure in HTTP evidence")
expected = "pass" if phase == "GREEN" else "fail"
if actions[expected, None] != 1 or actions["pass", None] + actions["fail", None] != 1:
raise ValueError("missing or incorrect package terminal event")

if phase == "GREEN":
if exit_code != 0 or actions["pass", ROOT] != 1:
raise ValueError("candidate HTTP regression did not pass")
if not all(actions["pass", name] == 1 for name in LEAVES):
raise ValueError("not all candidate HTTP scenarios passed")
if any(event.get("Action") == "fail" for event in events):
raise ValueError("unexpected failure in GREEN evidence")
else:
if exit_code != 1 or actions["fail", ROOT] != 1:
raise ValueError("pinned production did not fail the behavior test")
for fixture in ("summary", "content", "stored_content"):
for stream in ("false", "true"):
name = f"{ROOT}/{fixture}/stream={stream}/completed"
output = "".join(
event.get("Output", "") for event in events
if event.get("Package") == PACKAGE and event.get("Test") == name
)
if actions["fail", name] != 1 or "encrypted_agent_recovery_wire_changed" not in output:
raise ValueError(f"missing named input-integrity business failure: {name}")


def main():
if len(sys.argv) == 3 and sys.argv[1] == "--clean-log":
check_clean(Path(sys.argv[2]).read_text())
print("No runtime/build/skip contamination found")
return
phase, exit_code, filename = sys.argv[1:]
validate(phase, int(exit_code), Path(filename).read_text())
print(f"{phase}: named HTTP JSON/SSE behavior evidence accepted ({len(LEAVES)} scenarios)")


if __name__ == "__main__":
try:
main()
except ValueError as exc:
raise SystemExit(str(exc)) from exc
Loading
Loading