Skip to content

feat(status): group cron sessions for readability - #16831

Closed
puritysb wants to merge 1 commit into
openclaw:mainfrom
puritysb:feat/status-ux-improvement
Closed

puritysb wants to merge 1 commit into
openclaw:mainfrom
puritysb:feat/status-ux-improvement

Conversation

@puritysb

@puritysb puritysb commented Feb 15, 2026 •

Copy link
Copy Markdown

Summary

Implements #16799 — Improve openclaw status UX for cron-heavy setups.

Changes

  • Adds sessionType classification (main/cronJob/cronRun/other) to session entries
  • Adds grouped session buckets to StatusSummary.sessions.grouped:
    • Active: Primary interactive sessions
    • Cron Jobs: Cron job definitions
    • Recent Runs: Individual cron execution history (collapsed when > 20)
    • Other: Everything else
  • Basic unit tests for session type classification

Future Work (out of scope for this PR)

Related

Greptile Summary

Adds session type classification and grouping infrastructure to improve openclaw status UX for cron-heavy setups. Sessions are now categorized as main (interactive), cronJob (definitions), cronRun (execution history), or other, 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.

  • Added sessionType field to SessionStatus with four classification types
  • Added SessionGroups structure with Active/Cron Jobs/Recent Runs/Other buckets
  • Implemented classifySessionType() that delegates to canonical helpers for cron detection
  • Implemented groupSessions() with automatic collapsing when cron runs > 20
  • Added isCronJobSessionKey() helper alongside existing isCronRunSessionKey() in session-key-utils
  • Enhanced isCronRunSessionKey() implementation from regex to explicit part validation
  • Comprehensive unit tests for classification and grouping logic

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with proper separation of concerns, comprehensive test coverage, and addresses previous review feedback. The code uses canonical session-key utilities correctly, includes clear documentation, and follows TypeScript best practices. All changes are additive (new fields are optional), ensuring backward compatibility. The test suite validates both classification logic and grouping behavior including edge cases.
  • No files require special attention

Last reviewed commit: 0d47412

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S size: M and removed size: S labels Feb 15, 2026
@puritysb
puritysb marked this pull request as ready for review February 16, 2026 00:29
@puritysb puritysb changed the title [DRAFT] status: group cron sessions for readability feat(status): group cron sessions for readability Feb 16, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread src/commands/status.test.ts Outdated
Comment on lines +7 to +21
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";
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/commands/status.summary.ts Outdated
Comment on lines +52 to +56
if (/:cron:[^:]+:run:/.test(key)) {
return "cronRun";
}
// Check for cron job pattern: agent:xxx:cron:uuid
if (/:cron:[^:]+$/.test(key)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@puritysb

Copy link
Copy Markdown
Author

Resolved merge conflicts by rebasing onto latest and force-pushed the updated branch. PR is mergeable again; CI is re-running.

@openclaw-barnacle

Copy link
Copy Markdown

Please don’t spam-ping multiple maintainers at once. Be patient, or join our community Discord for help: https://discord.gg/clawd

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Mar 16, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 22, 2026
…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.
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Mar 23, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 30, 2026
@puritysb

Copy link
Copy Markdown
Author

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.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Mar 31, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 5, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

commands Command implementations size: M stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants