Skip to content

AHBG: consume native UCHC input across runtime, queries, replay, and full-corpus CI - #91

Merged
erinepshovel-code merged 35 commits into
mainfrom
feat/ahbg-uchc-native-consumer
Oct 19, 2026
Merged

erinepshovel-code merged 35 commits into
mainfrom
feat/ahbg-uchc-native-consumer

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Contributor

FROM → TO

AHBG could only review UCHC; now its canonical game runtime can install and use the exact UCHC candidate through the existing Stack wheel verifier, with native read-only text/word/definition/replay evidence in agent observations and persisted receipts.

Implemented

  • ahbg/integration/uchc.py: source/lock/wheel/installed-file/database/logical-receipt verification, native UCHC query and recovery API, completeness modes, original order/unknown preservation, CLI, explicit unsupported capability refusals.
  • AHBG runtime/CLI opt-in integration; raw inbox and UCNS geometry/game rules unchanged; per-turn original input/receipt evidence and source provenance persisted.
  • Unit boundary tests and real installed wheel/full-corpus query, recovery, replay, wrong-artifact, unknown and strict-rejection tests.
  • Existing full-corpus uchc-input.yml now runs AHBG against the very same clean-installed pinned producer and complete database; runtime CI triggers on integration changes.
  • Developer usage and hmmm in ahbg/integration/UCHC.md, Stack work graph updated without claiming domain graduation.

DONE WHEN

Both runtime CI and full-corpus UCHC integration pass against this PR head, the native wheel and complete corpus reproduce their immutable lock, and unsupported semantics cannot change gameplay.

hmmm

UCHC's separately forged 0.1.0a2 structural profile, ordinal geometry, Hilbert bridge, binary draft, and later language/semantic graduation are not asserted available by the historical 0.1.0a1 wheel. They require separate producer identities and admissions rather than fabricated substitutes. This PR does not merge or deploy itself.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T17:05:56.218272Z 3bf1ab1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bf1ab13a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ahbg/runtime/server.py
Comment on lines +379 to +382
reader = stack.enter_context(UchcStructuralSession(UchcStructuralSettings(
args.uchc_structural_field,
args.uchc_structural_lock or DEFAULT_STRUCTURAL_LOCK,
args.uchc_require_complete, args.uchc_max_text_bytes)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Open the structural corpus in the HTTP worker thread

When the server is started with --uchc-structural-field, this opens StructuralField and its default SQLite connection on the main thread, then shares it with ThreadingHTTPServer request-handler threads. Consequently, real /uchc/query and /session/{id}/language requests fail with SQLite's cross-thread ProgrammingError and return HTTP 500, although the fake HTTP test does not exercise this constraint. Open a connection per request/thread or route corpus access through the connection-owning thread.

Useful? React with 👍 / 👎.

Comment on lines +52 to +53
"structural_artifact_source_commit": "c18d984438bc30764edb05fd5ccc05691958a24e",
"structural_artifact_lock": "ahbg/integration/UCHC_STRUCTURAL.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Record the new UCHC pin in the stack manifests

This adds a consumed UCHC a2 source identity and changes AHBG's relation to UCHC, but only the AHBG-local work graph is updated; stack-manifest.json and STACK_MANIFEST.md still record only the a1 ZFAE candidate. That leaves the designated machine- and human-readable stack provenance projections inconsistent. Add the AHBG/a2 participant and relation to both projections, recompute work_graph_sha256, and run the consistency gate.

AGENTS.md reference: AGENTS.md:L72-L79

Useful? React with 👍 / 👎.

Comment thread ahbg/runtime/server.py
Comment on lines +487 to +491
if operation in {"english.frame_replay", "english.replay"}:
frame = body.get("frame")
if not isinstance(frame, dict):
raise ProtocolError("UCHC replay requires a native frame object")
recovered = uchc.replay(json.dumps(frame, sort_keys=True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce the input limit on frame replay

For english.frame_replay and english.replay, the gateway validates only that frame is a dictionary and then replays the whole value without the documented 64 KiB transport check. This also bypasses --uchc-max-text-bytes, because both session replay methods delegate directly to the native reader rather than their bounded construction path; a structural frame with a very large source therefore triggers unbounded reconstruction despite either limit. Reject oversized serialized frames or source text before replay.

Useful? React with 👍 / 👎.

Comment thread ahbg/runtime/server.py
Comment on lines +183 to +184
if uchc is not None and bind not in {"127.0.0.1", "::1", "localhost"}:
raise ValueError("UCHC HTTP endpoint requires loopback binding")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use an IPv6-capable server before accepting ::1

When an operator selects --bind ::1, this check explicitly accepts the address as loopback, but ThreadingHTTPServer still uses its default AF_INET socket family. Server construction then fails immediately with gaierror: Address family for hostname not supported, so the advertised IPv6-loopback option cannot start. Either reject ::1 or instantiate an AF_INET6 server for that bind address.

Useful? React with 👍 / 👎.

Comment thread ahbg/runtime/server.py
Comment on lines +291 to +295
messages = (*session.language_messages, {"text": body["text"],
"source": "http-language"})
prefix = f"ahbg:{session.session_id}:turn:{session._field.turn if hasattr(session, '_field') else 0}"
annotated = uchc.annotate_messages(list(messages), source_prefix=prefix)
session.language_messages = messages

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize language updates per live session

When two clients post language to the same session concurrently, both handler threads can read the same session.language_messages, append their own message, and then overwrite the tuple; the last writer wins, so one accepted message disappears from the next observation even though its request may have returned successfully and appended evidence to language.jsonl. Guard the read/annotate/assign/log sequence—and its interaction with step(), which clears these fields—with a per-session lock.

Useful? React with 👍 / 👎.

@erinepshovel-code
erinepshovel-code merged commit faf2654 into main Oct 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant