Conversation
- Adds more middleware hooks. - Remove use of AgentInternal from realtime-server.ts. Add declarations to Agent as needed. This had fallout such as accounting for `agent` possibly being null by type when checking things like `context.agent?.clientId`. - Changed some error messaging from saying the op, to just the op path. This information flows into the activity logs. - Some Byte size measuring is now being done in realtime usage of the server, not just upon intermittent SIGUSR2 request. - Clarified typing for agent.connectSession resulted in some null guards + throw being added. - ResourceMonitor now cares if it's "enabled", because if so it will build up some information over time to flush out on request. - ResourceMonitor logs some additional information to a new file, `resource-usage.jsonl`, alongside existing .csv files. - The change to resource-monitor.ts subscribedDocsCount is a fix from incorrect behaviour. - An AGENTS.md file was placed alongside our sharedb typings to give specific instructions to AI on how to treat these. - sharedb typings received various enhancements. Including declaring our custom property, `connectSession`.
|
Labeling as "do not merge" so I can be involved in the timing, and able to watch when the code starts to be used on the staging server. But I do want the PR to be reviewed :). |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4093 +/- ##
==========================================
+ Coverage 80.94% 80.97% +0.02%
==========================================
Files 664 664
Lines 42152 42308 +156
Branches 6916 6993 +77
==========================================
+ Hits 34120 34258 +138
Misses 6882 6882
- Partials 1150 1168 +18 ☔ View full report in Codecov by Harness. |
|
Note: AI code review identifies various cracks in the design of the logging and resource usage reporting system. I've sought to make it work well, and defend against various situations, but it's less important that the reporting system work flawlessly and more important that we get more reporting. |
|
I marked this PR as testing not required. The testing I want to see (beyond what I've done) is the E2E test pass, and usage on QA by the test team. |
|
📸 Screenshot diff deployed! (1 change) View the visual diff at: https://pr-4093--sf-screenshot-diffs.netlify.app |
|
The motivation for this PR is to add lots more information to the RealtimeServer activity log, to aid in understanding what is happening when we see the resource usage increasing. |
pmachapman
left a comment
There was a problem hiding this comment.
@pmachapman reviewed 15 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on marksvc).
declarations to Agent as needed. This had fallout such as accounting
for
agentpossibly being null by type when checking things likecontext.agent?.clientId.path. This information flows into the activity logs.
server, not just upon intermittent SIGUSR2 request.
guards + throw being added.
build up some information over time to flush out on request.
resource-usage.jsonl, alongside existing .csv files.incorrect behaviour.
specific instructions to AI on how to treat these.
our custom property,
connectSession.Open in Devin Review
This change is