-
Notifications
You must be signed in to change notification settings - Fork 167
feat: Add message observing status API #89
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?
Conversation
|
The Message model has a session_task_process_status field, which is used to track the processing status of messages:
|
- Query existing session_task_process_status field from messages table
- Map values: success→observed, running→in_process, pending→pending
- Implement Go API endpoint: GET /session/{id}/observing-status
- Add Python SDK method: messages_observing_status()
- Add TypeScript SDK method: messagesObservingStatus()
- Returns counts of observed, in_process, pending messages
Backend (Go):
- Model layer: MessageObservingStatus response type
- Repository layer: Direct query on messages table
- Service layer: Business logic wrapper
- Handler layer: HTTP endpoint with unit tests
- Router: URL registration
- Dependency injection: Full wiring
Python SDK:
- Type: MessageObservingStatus (Pydantic)
- Method: sessions.messages_observing_status()
TypeScript SDK:
- Schema: MessageObservingStatusSchema (Zod)
- Type: MessageObservingStatus
- Method: sessions.messagesObservingStatus()
Tests:
- Handler tests with mocks (all passing)
Note: Uses existing session_task_process_status field. No database migration needed.
989aca8 to
55dd818
Compare
Updated ImplementationChanged the approach how @gus asked: What Changed:
The |
|
I tested in Docker env and tested the endpoints, everythings works as expected |
gusye1234
left a comment
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.
Let's not introduce a new handler for this api, just use the session handler please.
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.
I think you missed the async session client
| ArtifactHandler: artifactHandler, | ||
| TaskHandler: taskHandler, | ||
| ToolHandler: toolHandler, | ||
| MessageObservingHandler: messageObservingHandler, |
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.
There is no need to introduce a new handler just for this api, this api belongs to session handler
okey, gonna keep session-related endpoints togerther, will move to method to SessionHandler later this day. but should i keep the service/repo layers separate or consolidate to session service/repo too? yeah forgot to add async version in async_sessions.py ngl missed that. will update and push later this day. thanks |
Oops, miss this. I don't think you need to add new files in modules/repo and modules/model, those are for ORM. You can just simply add this function and the struct in @GenerQAQ , can you look up this PR and back me up? I think we have no need to add new file in /repo and /model in this PR, right? |
Summary
Implements API endpoint to return message observing status counts (observed, in_process, pending) for sessions.
Following team feedback, architecture uses a separate
message_observing_trackingtable decoupled from messages table, with foreign key binding for data integrity.API Endpoint:
GET /api/v1/session/{session_id}/observing-statusResponse Example:
{ "observed": 10, "in_process": 5, "pending": 3, "updated_at": "2025-12-17T10:30:00Z" }Why we need this PR?
Users need visibility into message processing status to:
Changes
Backend (Go):
MessageObservingStatus(response),MessageObservingTracking(DB table)/session/{id}/observing-statusPython SDK:
MessageObservingStatus(Pydantic BaseModel)client.sessions.messages_observing_status(session_id)TypeScript SDK:
MessageObservingStatusSchema(Zod validation)MessageObservingStatus(TypeScript interface)client.sessions.messagesObservingStatus(sessionId)Database:
002_create_message_observing_tracking.sqlmessage_observing_trackingwith FK tomessages(id)ON DELETE CASCADEmessage_idandobserving_statusfor query performanceImpact Areas
Which part of Acontext would this feature affect?
Implementation Tasks
Testing
Completed:
Pending:
Note: Awaiting guidance on running migrations in development environment for full integration testing.
Key Files:
src/server/api/go/internal/modules/handler/message_observing_handler.gosrc/server/api/go/internal/modules/repo/message_observing_repo_impl.gosrc/client/acontext-py/src/acontext/resources/sessions.pysrc/client/acontext-ts/src/resources/sessions.tssrc/server/core/migrations/002_create_message_observing_tracking.sqlQuestions for Reviewers