Repository navigation
AHBG: consume native UCHC input across runtime, queries, replay, and full-corpus CI - #91
Conversation
…ce and tamper refusal
…se unpublished UCHC operations
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…files without changing historical consumer
…struction identities
…itions, compose and replay
…eld before consumer acceptance
…atory in dedicated acceptance
…atory in dedicated acceptance
…nd game observation bridge
…ative input operations
…alid requests and remote refusal
There was a problem hiding this comment.
💡 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".
| 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))) |
There was a problem hiding this comment.
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 👍 / 👎.
| "structural_artifact_source_commit": "c18d984438bc30764edb05fd5ccc05691958a24e", | ||
| "structural_artifact_lock": "ahbg/integration/UCHC_STRUCTURAL.json" |
There was a problem hiding this comment.
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 👍 / 👎.
| 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, |
There was a problem hiding this comment.
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 👍 / 👎.
| if uchc is not None and bind not in {"127.0.0.1", "::1", "localhost"}: | ||
| raise ValueError("UCHC HTTP endpoint requires loopback binding") |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 |
There was a problem hiding this comment.
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 👍 / 👎.
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.uchc-input.ymlnow runs AHBG against the very same clean-installed pinned producer and complete database; runtime CI triggers on integration changes.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.0a2structural profile, ordinal geometry, Hilbert bridge, binary draft, and later language/semantic graduation are not asserted available by the historical0.1.0a1wheel. They require separate producer identities and admissions rather than fabricated substitutes. This PR does not merge or deploy itself.