Agent loop runtime: spec closure, panel stability, and dist plugin-check hardening - #25
Merged
Merged
Conversation
Greptile SummaryThis PR implements a production-ready agent loop runtime orchestration system with significant architectural improvements. Key Changes
ImpactThe refactoring eliminates duplicated logic, standardizes runtime behavior across trigger types, and provides a stable foundation for async agent execution. DB parameter warnings resolved using safer prepared identifier patterns. Panel behavior improved for long-running jobs with proper progress tracking and stable cursor handling. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Panel as Panel UI
participant ChatAPI as Chat REST API
participant AgentRunner as Agent Runner
participant AgentLoop as Agent Loop Helper
participant Transport as Polling Transport
participant EventStore as Agent Event Store
participant RunStore as Agent Run Store
participant SessionStore as Agent Session Store
participant Provider as AI Provider
User->>Panel: Send message
Panel->>ChatAPI: POST /chat/send
ChatAPI->>SessionStore: create_session()
SessionStore-->>ChatAPI: session_id
ChatAPI->>RunStore: create_run(session_id)
RunStore-->>ChatAPI: run_id
ChatAPI->>RunStore: claim_run(run_id, worker_id)
RunStore-->>ChatAPI: lock_token
ChatAPI->>SessionStore: claim_session(session_id)
SessionStore-->>ChatAPI: lease_token
ChatAPI->>AgentLoop: run_turn(turn_request)
AgentLoop->>Transport: emit(agent.run.started)
Transport->>EventStore: insert_event()
AgentLoop->>Provider: generateText()
Provider-->>AgentLoop: assistant_text + tool_calls
AgentLoop->>Transport: emit(agent.tool_call)
Transport->>EventStore: insert_event()
AgentLoop->>Transport: emit(agent.run.finished)
Transport->>EventStore: insert_event()
AgentLoop-->>ChatAPI: result
ChatAPI->>RunStore: complete_run(run_id, lock_token)
ChatAPI->>SessionStore: update_release(session_id, lease_token)
ChatAPI-->>Panel: response + events_cursor
Note over Panel,EventStore: Polling Phase
loop Poll for progress
Panel->>ChatAPI: GET /agent/runs/{run_id}/events?after={cursor}
ChatAPI->>EventStore: get_events(run_id, after)
EventStore-->>ChatAPI: events[]
ChatAPI-->>Panel: events + next_cursor
Panel->>Panel: Update UI with tool calls
Panel->>ChatAPI: GET /agent/runs/{run_id}
ChatAPI->>RunStore: get_run(run_id)
RunStore-->>ChatAPI: run status
ChatAPI-->>Panel: run status
alt Status is terminal
Panel->>Panel: Stop polling, display final result
else Status is running
Panel->>Panel: Continue polling
end
end
Last reviewed commit: 66b9ce2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR merges the
agen-loop-runtimeworkstream and follow-up fixes to make the runtime, panel polling UX, and packaging checks production-ready.What changed
trademarked_termfalse positive.PluginCheck.Security.DirectDB.UnescapedDBParameterwarnings in store queries using safer prepared identifier patterns and updated wpdb test stubs accordingly.Validation
npm run lint:php./bin/plugin-check(dist mode)Latest dist plugin-check run reports no remaining warnings/errors (with
trademarked_termignored per current false-positive policy).