Skip to content

fix: harden runtime API and simulation handling - #718

Open
CyrusAuyeung wants to merge 4 commits into
666ghj:mainfrom
CyrusAuyeung:agent/fix-runtime-api-zep-simulation
Open

fix: harden runtime API and simulation handling#718
CyrusAuyeung wants to merge 4 commits into
666ghj:mainfrom
CyrusAuyeung:agent/fix-runtime-api-zep-simulation

Conversation

@CyrusAuyeung

@CyrusAuyeung CyrusAuyeung commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Fixes #717.

This PR hardens the remaining runtime paths exposed by an end-to-end run with an OpenAI-compatible provider, Zep Cloud, and dual-platform simulation.

Provider and API compatibility

  • Pass the configured API key, base URL, and provider-safe headers to direct OpenAI SDK clients and CAMEL simulation clients.
  • Return validation-style 400 responses for malformed JSON request bodies instead of surfacing 500 errors.
  • Read persisted simulation state with UTF-8 BOM tolerance.

Simulation lifecycle and IPC safety

  • Verify real process liveness before accepting interview or deep-interaction IPC commands.
  • Preserve completed simulation state during shutdown cleanup.
  • Clean terminal-run logs before an explicit restart while refusing to discard pending graph-memory updates.
  • Recognize reusable prepared configuration after a paused run, with regression coverage for the generated-config guard.
  • Declare psutil as a direct backend dependency because simulation liveness imports it directly.

Action integrity and presentation

  • Advance action cursors after initial seed posts so those posts are not replayed in the next round.
  • Preserve multiple initial Twitter posts assigned to the same agent.
  • Suppress idle and empty action cards while retaining meaningful like, dislike, comment, and follow activity.

Scope coordination

Validation

  • uv run python -m pytest -q: 135 passed
  • npm run build: passed
  • git diff --check: passed

The frontend build emits the existing warnings about a large JavaScript chunk and a module that is both statically and dynamically imported. No new warning is introduced here.

@CyrusAuyeung
CyrusAuyeung marked this pull request as ready for review July 7, 2026 14:48
@666ghj 666ghj added Memory Layer Any questions related to RAG, GraphRAG and LLM Memory. LLM API Any questions regarding the LLM API labels Jul 22, 2026
@666ghj

666ghj commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Note

🤖 Automated maintainer response — Generated by the MiroFish triage agent and checked against main@d641759 on 2026-07-23. Posted with maintainer authorization; a maintainer may revise it.

Reviewed against current main. The Zep 400-character query cap in this PR has now landed through #740 at the shared service boundary with regression tests for both graph search and profile enrichment.

The provider configuration, IPC liveness, completed-state cleanup, initial-post handling, malformed JSON, BOM state, and psutil changes remain separate runtime work and have not been closed by #740. Please rebase and remove the now-duplicated Zep query change; this PR stays open for review of the remaining scope.

@CyrusAuyeung
CyrusAuyeung force-pushed the agent/fix-runtime-api-zep-simulation branch from 2929097 to 690a6a2 Compare July 22, 2026 17:30
@CyrusAuyeung

Copy link
Copy Markdown
Author

Addressed in the force-updated head 690a6a2:

Validation after the rebase: backend 113 passed, frontend production build passed, and git diff --check passed.

@666ghj

666ghj commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Note

🤖 Automated maintainer response — Generated by the MiroFish maintenance agent after reviewing this PR against main@60757b3c on 2026-07-23. Posted with maintainer authorization; a maintainer may revise it.

Current main has advanced again through #742, which resolves the ontology structured-output, truncation, and opaque 500 path referenced in this PR and #717.

The remaining provider request/header handling, IPC liveness, completed-state cleanup, initial-post behavior, malformed request handling, BOM state, and simulation UI changes are independent and remain eligible for review. Please rebase onto main@60757b3c and reconcile any llm_client.py or ontology-error overlap with #742; do not reintroduce the superseded ontology path.

This PR stays open for the remaining runtime scope.

@CyrusAuyeung
CyrusAuyeung force-pushed the agent/fix-runtime-api-zep-simulation branch from 690a6a2 to d426d6b Compare July 23, 2026 05:18
@CyrusAuyeung

Copy link
Copy Markdown
Author

Addressed in the force-updated head d426d6b:

Validation after the rebase: backend 133 passed, frontend production build passed, git diff --check passed, and origin/main is an ancestor of the updated head.

@kemo04 kemo04 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.

AI Code Review (PR Review Agent)

  • [Test Coverage · High]backend/app/api/simulation.py (diff line 92): New simulation prepared status 'paused' is added to prepared_statuses without corresponding test coverage.

@CyrusAuyeung

Copy link
Copy Markdown
Author

Addressed the test-coverage review in 747c6a0:

  • added a parameterized regression test for persisted paused simulations
  • verifies paused is reusable when all required files exist and config_generated=true
  • verifies the same state is not treated as prepared when config_generated=false
  • asserts the prepared result includes the persisted status and profile count

Validation: the focused module passes 4 tests, the full backend suite passes 135 tests, and git diff --check passes.

@CyrusAuyeung

CyrusAuyeung commented Aug 6, 2026

Copy link
Copy Markdown
Author

Scope reduced after the #758 cross-reference in bd4babb:

This is overlap coordination, not withdrawal of #718. Validation after the scope reduction: backend 135 passed, frontend production build passed, and git diff --check passed. GitHub reports the PR mergeable against current main; the commits added to main since #742 only affect Star History automation/assets/tests and do not overlap these runtime files.

@CyrusAuyeung

Copy link
Copy Markdown
Author

@666ghj #718 is ready for maintainer review. I have addressed the prior maintainer and review feedback, added regression coverage for the persisted paused state, reconciled the merged #740/#742 changes, and removed only the duplicate Step 3 remount hunk that overlaps #758 to avoid a merge conflict. #718 remains intended for merge for its independent provider compatibility, IPC liveness, state handling, initial-post integrity, malformed-request handling, and action presentation fixes.

Current validation: backend 135 passed, frontend production build passed, and git diff --check passed. GitHub reports the branch as mergeable against current main. Please review the remaining #718 scope when convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM API Any questions regarding the LLM API Memory Layer Any questions related to RAG, GraphRAG and LLM Memory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime failures with OpenAI-compatible providers, Zep search, interviews, and initial posts

3 participants