refactor(sim): verhaltensneutrales OASIS-Runner-Refactoring (Single-Platform) - #962
Conversation
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ad15ccaeb
ℹ️ 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".
| *, | ||
| db_filename: str, | ||
| interview_action_type: Any, | ||
| manual_action_cls: Any, |
There was a problem hiding this comment.
Preserve the re-exported IPCHandler constructor
When existing callers import IPCHandler from either runner and instantiate it using the established IPCHandler(simulation_dir, env, agent_graph[, redis_bridge]) contract, this replacement raises TypeError because three new keyword-only arguments are mandatory. Since both entry points explicitly re-export the class for compatibility, preserve their old platform-specific constructors (for example with thin wrappers supplying the database name and OASIS symbols) rather than exposing the incompatible shared constructor.
Useful? React with 👍 / 👎.
| | Kategorie | Anzahl | Methode | | ||
| |---|---|---| | ||
| | Backend Tests (collected) | 3854 | `cd backend && uv run pytest --collect-only -q` | | ||
| | Backend Tests (collected) | 3880 | `cd backend && uv run pytest --collect-only -q` | |
There was a problem hiding this comment.
Add the delivered refactor to CHANGELOG
When this commit is included in a release, the release history will omit the delivered backend runtime refactor because only the generated test count in STATUS.md was synchronized and CHANGELOG.md remains untouched. Record the change in the changelog in the same slice as required by the repository workflow.
AGENTS.md reference: AGENTS.md:L41-L45
Useful? React with 👍 / 👎.
Sichert das Datei-/Redis-IPC-Verhalten des aus den Single-Platform-Runnern zu extrahierenden IPCHandler-Netzwerks: Response-Format, Command-Dedup gegen den Redis-Bus, Interview-Dispatch, _execute_command-True/False-Matrix (Close-Env -> False) und _get_interview_result (db_filename-Pfad). Oasis-Symbole (ManualAction, ActionType.INTERVIEW) werden als Fakes injiziert, sodass die Tests ohne die torch-abhangige Oasis-Laufzeit laufen. RED-Commit: sim_runtime.ipc existiert noch nicht -> Import fehlschlagt, bis der folgende Refactor-Commit das Modul extrahiert.
Extrahiert den in run_twitter_simulation.py und run_reddit_simulation.py duplizierten IPC-Block (Konstanten, CommandType, IPCHandler) in das neue Paket backend/scripts/sim_runtime/ipc.py. Beide Runner importieren nun die gemeinsame Implementierung; die IPCHandler-Konstruktion injiziert db_filename, interview_action_type (ActionType.INTERVIEW) und manual_action_cls (ManualAction) als Keyword-Argumente. Verhaltensidentisch: Datei-IPC-Layout, Response-Format, Command-Dedup (seen_command_ids) und die _execute_command-Ruckgabematrix bleiben unverandert. Oasis-Symbole werden injiziert statt auf Modulebene importiert, damit sim_runtime.ipc ohne torch-abhangige Oasis-Laufzeit importierbar bleibt und im Test-Tree charakterisierbar ist. Erhaltungsanker: _sim_common bleibt eigenstandiges Modul (importlib-Tests); create_model/ModelFactory bleiben Attribute von run_parallel_simulation (test_oasis_provider_dispatch); die LLM_MAX_OUTPUT_TOKENS/--num-agents/ --num-rounds-Literale bleiben in den Entry-Points.
Basis-Runner-Klasse (oasis-abhängig) parametrisiert über Klassen-Attribute (PLATFORM_NAME/SLUG, PROFILE_FILENAME, DB_FILENAME, PLATFORM_TYPE, AVAILABLE_ACTIONS/NAMES, GRAPH_GENERATOR) und die Template-Method _assign_initial_action (Twitter überschreibt, Reddit appended an Listen). Extrahiert verhaltensneutral aus run_twitter_simulation.py / run_reddit_simulation.py; setup_signal_handlers + _shutdown_event/ _cleanup_done wandern mit in die Basis. Entry-Points nutzen die Basis noch nicht (folgende Commits); das Modul ist neu und ändert kein bestehendes Verhalten. Ruff clean, help-smoke + characterization-Tests grün (45 passed). Co-Authored-By: Claude <noreply@anthropic.com>
…class TwitterSimulationRunner erbt __init__, _load_config, _create_model, _get_active_agents_for_round, run, setup_signal_handlers aus der Basis; der Entry-Point behält Modul-Setup (_sim_common-Side-Effects, _install_runtime_profile mit apply_camel_context_floor-Aufruf, help-guard), den oasis-/IPC-/agent_tools-Import als Modul-Attribut-Quelle und main. _shutdown_event wird in main() auf dem Basis-Modul gesetzt, weil run dort das Modul-Global liest. test_run_simulation_default_tokens-SCRIPTS auf sim_runtime/platform_runner.py umgestellt (neue SSoT für den 16384-Default). Verhaltensneutral: ruff clean, help-smoke + tokens + floor + IPC + simulation_runtime (test_all_runners_apply_camel_context_floor) grün (52 passed). Co-Authored-By: Claude <noreply@anthropic.com>
…lass RedditSimulationRunner erbt die Runner-Logik aus der Basis; einziger Verhaltensunterschied zu Twitter bleibt erhalten als _assign_initial_action- Override (Reddit appended mehrere Initial-Posts pro Agent an eine Liste statt zu überschreiben). Entry-Point behält Modul-Setup, oasis-/IPC-/ agent_tools-Import und main. Verhaltensneutral: ruff clean, help-smoke + tokens + floor + IPC + simulation_runtime (52 passed). Slice 2 (Twitter/Reddit-Dedup) lokal komplett — netto ca. −950 LOC Duplikation. Co-Authored-By: Claude <noreply@anthropic.com>
…ization +26 collected tests (27 IPCHandler characterization tests in test_sim_runtime_ipc.py). Pre-Push-Gate sync-status --check war rot. Co-Authored-By: Claude <noreply@anthropic.com>
…(PR #962) AGENTS.md L41-L45 verlangt CHANGELOG.md-Update im selben Slice. Codex PR-Review #962 P1 wies darauf hin, dass nur STATUS.md synchronisiert wurde. Refactor-Eintrag dokumentiert Slice 1+2 ohne Verhaltensänderung: - neues Paket backend/scripts/sim_runtime/ (ipc.py, platform_runner.py) - IPC-Dedup (~280 LOC pro Runner) - Runner-Dedup (Twitter/Reddit reduziert auf SinglePlatformRunner-Subklassen) - ~1.084 LOC netto Reduktion - P4 (Parallel-Extraktion) bewusst uebersprungen (create_model Patch-Constraint, ParallelIPCHandler kein Dedup) Co-Authored-By: Claude <noreply@anthropic.com>
1ad15cc to
9bb3e50
Compare
|
Replying to Codex P1 (CHANGELOG) and P2 (IPCHandler constructor) — please see the inline replies below. P1 CHANGELOG: Done — added P2 IPCHandler constructor: Audit ergab — kein externer Caller verwendet die alte positionsbasierte Signatur |
Summary
Verhaltensneutrales Refactoring der OASIS-Single-Platform-Runner-Familie. Keine sichtbaren Verhaltensänderungen, keine neuen öffentlichen Schnittstellen, keine Konfigurationssemantik-Änderung. Neues Paket
backend/scripts/sim_runtime/hält die geteilte Laufzeit; dierun_*_simulation.py-Entry-Points bleiben kompatible Einstiegspunkte.Slices
Slice 1 — IPC-Extraktion (
b347270cRED,d0e0e95fGREEN)sim_runtime.ipcmitIPCHandler(Konstruktor-Injektion vondb_filename/interview_action_type/manual_action_cls) → Modul bleibt oasis-frei und auf macOS/Py3.14 ohne torch-Crash charakterisierbar.test_sim_runtime_ipc.py.Slice 2 — Twitter/Reddit-Runner-Dedup (
22fae122,28f57344,4254fd48)sim_runtime.platform_runner.pymitSinglePlatformRunner-Basis (oasis-abhängig), parametrisiert über Klassen-Attribute (PLATFORM_NAME/SLUG,PROFILE_FILENAME,DB_FILENAME,PLATFORM_TYPE,AVAILABLE_ACTIONS/NAMES,GRAPH_GENERATOR) + Template-Method_assign_initial_action._install_runtime_profilemitapply_camel_context_floor-Aufruf, help-guard,_sim_common-Side-Effects,main).test_run_simulation_default_tokensaufsim_runtime/platform_runner.pyumgestellt (neue SSoT für den 16384-Default).Verifikation
Lokal (macOS): ruff clean, 52 passed (help-smoke, default-tokens, default-floor, IPC-characterization,
test_simulation_runtimemittest_all_runners_apply_camel_context_floor).armserver (arm64 Linux, echtes oasis/torch): Branch via git bundle + worktree nach
/home/alex/agora-verifysynchronisiert.tests/scripts/220 passed, 9 skipped (parallel-Runner-Segfault, pre-existing), 1 failed (test_oasis_preflight, pre-existing). Echter oasis-Smoke:--helpfür beide Runner, Import ohne Segfault,_assign_initial_action-Verhaltensunterschied mit echtemManualActionverifiziert, Klassen-Attribute +PLATFORM_TYPEkorrekt.Pre-Push-Gate backend: ALL GREEN (contracts, schemas 47, ruff, mypy, sync-status).
Harte Erhaltungsregeln (Spec)
_create_modelmaskiertbase_url(base_url[:40]…), keine API-Keys in Prints.os.environ-Sets in Subprozess-Pfaden, nur die bestehenden CAMEL-Guards (OPENAI_API_KEY/GOOGLE_API_KEY).Nicht umgesetzt (bewusst)
P4 (Parallel-Extraktion) übersprungen nach User-Sign-off:
create_modeldarf nicht extrahiert werden —test_oasis_provider_dispatchpatchtrps.ModelFactory; der Patch greift nur, solangecreate_modelimrun_parallel_simulation-Namespace lebt.ParallelIPCHandler(~440 Zeilen) teilt sich nicht mit single-platformIPCHandler(redis-integriert, andere Methoden) → eine Modul-Verschiebung brächte kein echtes Dedup.Test-Plan
bash scripts/pre-push-gate.sh backend→ ALL GREEN (lokal ausgeführt).🤖 Generated with Claude Code