Repository navigation
Conversation
bfc1ccb to
f92900f
Compare
| const classifySessionType = (key: string): string => { | ||
| if (/:cron:[^:]+:run:/.test(key)) { | ||
| return "cronRun"; | ||
| } | ||
| if (/:cron:[^:]+$/.test(key)) { | ||
| return "cronJob"; | ||
| } | ||
| if (/^agent:[^:]+:main$/.test(key)) { | ||
| return "main"; | ||
| } | ||
| if (/^agent:[^:]+:[^:]+$/.test(key) && !key.includes(":cron:")) { | ||
| return "main"; | ||
| } | ||
| return "other"; | ||
| }; |
There was a problem hiding this comment.
Tests duplicate logic instead of testing it
The test file copies the classifySessionType function rather than importing it from status.summary.ts. This means the tests validate the copy, not the actual implementation — if the real function is changed (e.g. a regex is fixed or a new session type is added), these tests will still pass while the production code behaves differently.
Consider exporting classifySessionType from status.summary.ts and importing it here, or at minimum adding a note that the function must be kept in sync manually.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/status.test.ts
Line: 7:21
Comment:
**Tests duplicate logic instead of testing it**
The test file copies the `classifySessionType` function rather than importing it from `status.summary.ts`. This means the tests validate the copy, not the actual implementation — if the real function is changed (e.g. a regex is fixed or a new session type is added), these tests will still pass while the production code behaves differently.
Consider exporting `classifySessionType` from `status.summary.ts` and importing it here, or at minimum adding a note that the function must be kept in sync manually.
How can I resolve this? If you propose a fix, please make it concise.| if (/:cron:[^:]+:run:/.test(key)) { | ||
| return "cronRun"; | ||
| } | ||
| // Check for cron job pattern: agent:xxx:cron:uuid | ||
| if (/:cron:[^:]+$/.test(key)) { |
There was a problem hiding this comment.
Looser regex than canonical isCronRunSessionKey
The existing canonical helper isCronRunSessionKey in src/sessions/session-key-utils.ts uses a stricter check: it parses the key with parseAgentSessionKey and then matches rest against ^cron:[^:]+:run:[^:]+$. The regex here (/:cron:[^:]+:run:/) is unanchored and would match non-canonical keys like agent:main:slack:cron:job:run:uuid, which isCronRunSessionKey explicitly rejects (see session-reaper.test.ts:57).
Consider reusing isCronRunSessionKey from src/sessions/session-key-utils.ts or anchoring the regex to match ^agent:[^:]+:cron:[^:]+:run:[^:]+$ to stay consistent with the established pattern.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/status.summary.ts
Line: 52:56
Comment:
**Looser regex than canonical `isCronRunSessionKey`**
The existing canonical helper `isCronRunSessionKey` in `src/sessions/session-key-utils.ts` uses a stricter check: it parses the key with `parseAgentSessionKey` and then matches `rest` against `^cron:[^:]+:run:[^:]+$`. The regex here (`/:cron:[^:]+:run:/`) is unanchored and would match non-canonical keys like `agent:main:slack:cron:job:run:uuid`, which `isCronRunSessionKey` explicitly rejects (see `session-reaper.test.ts:57`).
Consider reusing `isCronRunSessionKey` from `src/sessions/session-key-utils.ts` or anchoring the regex to match `^agent:[^:]+:cron:[^:]+:run:[^:]+$` to stay consistent with the established pattern.
How can I resolve this? If you propose a fix, please make it concise.|
Resolved merge conflicts by rebasing onto latest and force-pushed the updated branch. PR is mergeable again; CI is re-running. |
|
Please don’t spam-ping multiple maintainers at once. Be patient, or join our community Discord for help: https://discord.gg/clawd |
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale due to inactivity. |
…ed UX - Add SessionType (main/cronJob/cronRun/other) for classifying sessions - Add classifySessionType() using canonical isCronJobSessionKey/isCronRunSessionKey - Add groupSessions() for grouped status output with collapsed cron runs - Add SessionGroup/SessionGroups types for structured grouping - Update isCronRunSessionKey to use token-based parsing (no regex) - Add isCronJobSessionKey for detecting cron job definition keys - Include sessionType field in SessionStatus and grouped in StatusSummary Rebased onto main to resolve conflicts.
|
This pull request has been automatically marked as stale due to inactivity. |
|
Still interested in this being merged. The implementation is additive (no breaking changes) and all CI was green after the rebase. Happy to address any feedback if there are concerns. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
Implements #16799 — Improve
openclaw statusUX for cron-heavy setups.Changes
sessionTypeclassification (main/cronJob/cronRun/other) to session entriesStatusSummary.sessions.grouped:Future Work (out of scope for this PR)
openclaw statusprinterRelated
Greptile Summary
Adds session type classification and grouping infrastructure to improve
openclaw statusUX for cron-heavy setups. Sessions are now categorized asmain(interactive),cronJob(definitions),cronRun(execution history), orother, with grouped output buckets that collapse when cron runs exceed 20 entries. The implementation correctly uses canonical session-key utilities (isCronJobSessionKey,isCronRunSessionKey) for cron detection, addressing previous review feedback about regex consistency. Tests properly import the actual classification functions rather than duplicating logic.sessionTypefield toSessionStatuswith four classification typesSessionGroupsstructure with Active/Cron Jobs/Recent Runs/Other bucketsclassifySessionType()that delegates to canonical helpers for cron detectiongroupSessions()with automatic collapsing when cron runs > 20isCronJobSessionKey()helper alongside existingisCronRunSessionKey()in session-key-utilsisCronRunSessionKey()implementation from regex to explicit part validationConfidence Score: 5/5
Last reviewed commit: 0d47412