Add ARE Spectacle v2 runtime: core engine, services, storage, API, and tests#1
Add ARE Spectacle v2 runtime: core engine, services, storage, API, and tests#1clairetech2025-max wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b7a11e50c
ℹ️ 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".
| for record in records: | ||
| self.store.append_record(record) | ||
| committed.append(record.record_id) |
There was a problem hiding this comment.
Wrap multi-record writes in a single transaction
WriteBarrier.commit persists each record independently, and SQLiteStore.append_record uses its own connection/transaction per call, so a failure on a later insert leaves earlier inserts committed. In a finalize batch this creates partial turns (for example, only some of the expected durable records exist), which breaks the write-barrier all-or-nothing behavior and can leave provenance/session state inconsistent. Commit the whole batch in one transaction (or roll back on error) instead of per-record commits.
Useful? React with 👍 / 👎.
| @router.post("/prompt-prefix") | ||
| def prompt_prefix(body: QueryBody) -> dict: | ||
| result = engine.run_query(QueryRequest(query=body.query, session_id=body.session_id)) | ||
| return {"trace_id": result["trace_id"], "visor": result["trace"]["events"][-2]} |
There was a problem hiding this comment.
Return the execute payload in /prompt-prefix
This endpoint returns events[-2] as visor, but in TurnEngine.run_query the event order is prepare_turn, execute_turn, governance, finalize_turn, so -2 is the governance event rather than prompt-context data. Clients calling /prompt-prefix therefore receive policy/posture metadata instead of the expected prefix/visor payload and will construct incorrect prompts.
Useful? React with 👍 / 👎.
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
Motivation
Description
TurnEnginepipeline (app/core/turn_engine.py) implementing prepare/execute/finalize stages and integrating classifiers, routers, recall, relevance, planner, visor/rail builders, governance (Sentinel/Lycanthrope), write barrier, and TrailLink edge creation.app/services/(intent classifier, lane router, recall, relevance gate, answer planner, contradiction checker, gyro ARE, sentinel, lycanthrope, traillink, visor builder, intake/scrub/parser, write barrier, recognition rail) used by the engine.app/storage/sqlite_store.pywith schema creation and methods fordurable_records,trail_edges,session_events, andsession_state, plusSessionStoreandGravelStorehelpers, and tracing viaapp/tracing/veritas.py.app/main.pyandapp/api/routes.py) with endpoints (/health,/ingest,/query,/gyro,/prompt-prefix,/trace/{id},/report/{id}), addREADME.mdand.gitignore, and include unit tests intests/test_turn_flow.pywith aconftestpath shim.Testing
pytest -qagainsttests/test_turn_flow.pywhich exercises classification, lane routing, recall and end-to-endTurnEnginebehavior using ephemeral SQLite viatmp_path.tests/test_turn_flow.py(4 tests) passed.Codex Task