-
Notifications
You must be signed in to change notification settings - Fork 0
The QA runner's home is not the repo, and a claim PIN is not a repo file #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| API server management for QA testing. | ||
| """ | ||
|
|
||
| import tempfile | ||
| import asyncio | ||
| import hashlib | ||
| import json | ||
|
|
@@ -829,11 +830,28 @@ def start(self) -> bool: | |
| if not self.config.mock_llm: | ||
| env.pop("CIRIS_MOCK_LLM", None) # Remove if present | ||
|
|
||
| # Set CIRIS_HOME for verifier_singleton (required for audit hash chain) | ||
| # CIRIS_HOME for verifier_singleton (required for audit hash chain). | ||
| # | ||
| # NOT the repo root. Pointing home at the checkout makes the node write its | ||
| # data dir, logs, secrets, `ciris_engine.db` and — on a first run — the | ||
| # one-time `claim_pin` INTO the working tree. Two failures follow: | ||
| # | ||
| # 1. Anything that reads home at the PRODUCT default looks somewhere else | ||
| # and finds nothing. A first-run claim then fails with the PIN sitting | ||
| # in the repo, written by the same run that could not find it. This is | ||
| # the shape that just cost a desktop first-run setup (CIRISAgent's | ||
| # `server_manager` had the identical `setdefault(CIRIS_HOME, root)`). | ||
| # 2. A one-time claim SECRET lands in a git checkout. | ||
| # | ||
| # A per-run temp dir instead: isolated between runs, cleaned by the OS, and | ||
| # it cannot disagree with a product default because nothing else claims it. | ||
| # An explicit CIRIS_HOME from the caller still wins — that is the knob for | ||
| # pointing a run at a real home on purpose. | ||
| if "CIRIS_HOME" not in env: | ||
| project_root = Path(__file__).parent.parent.parent | ||
| env["CIRIS_HOME"] = str(project_root) | ||
| self.console.print(f"[dim]Setting CIRIS_HOME={project_root}[/dim]") | ||
| qa_home = Path(tempfile.mkdtemp(prefix="ciris-qa-home-")) | ||
| env["CIRIS_HOME"] = str(qa_home) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the handler or CIRISNode modules run, this redirects the agent's state to Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the standalone Useful? React with 👍 / 👎. |
||
| self._qa_home = qa_home | ||
| self.console.print(f"[dim]Setting CIRIS_HOME={qa_home} (per-run temp)[/dim]") | ||
|
|
||
| # Set CIRIS_ADAPTER environment variable (supports comma-separated adapters) | ||
| # This allows loading modular services like Reddit alongside built-in adapters | ||
|
|
@@ -1186,6 +1204,15 @@ def stop(self): | |
| self.process = None | ||
| self.pid = None | ||
|
|
||
| # Remove the per-run temp home, but ONLY one we created. A home | ||
| # supplied by the caller is theirs and may hold a real node. | ||
| qa_home = getattr(self, "_qa_home", None) | ||
| if qa_home is not None: | ||
| import shutil as _sh | ||
|
|
||
| _sh.rmtree(qa_home, ignore_errors=True) | ||
|
Comment on lines
+1209
to
+1213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If startup raises after Useful? React with 👍 / 👎. |
||
| self._qa_home = None | ||
|
|
||
| # Close PTY master fd | ||
| if hasattr(self, "_pty_master_fd"): | ||
| try: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
CIRIS_HOMEis pointed at the checkout—the exact fallback scenario these rules are meant to protect—the database is written todata/ciris_engine.db, not the repository root:ServerConfig::from_homesetsdata_dir = home.join("data")anddb_path()appendsciris_engine.db(src/config.rs:204,251-252), which also matchesserver.py:574. Consequently these root-only patterns do not match the database or its WAL/SHM files, andgit addcan still stage the node store. Add specific/data/ciris_engine.db*exclusions while leaving the tracked mesh fixtures visible.Useful? React with 👍 / 👎.