Workflow branch store and request-controller operation store grow without bound
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Examine the WP_Agent_Workflow_Branch_Store class and the request controller's operation store to understand their storage mechanisms. Look for the TTL_SECONDS constant and the forget_run() method. Identify where a sweeper could be added, perhaps via Action Scheduler. For the request controller, find the option key and operation array structure to implement pruning or splitting.
Written by the indexing model from the issue text.
Description
Problem
Two workflow stores grow without bound on a long-lived site. On a primary-mode Markdown-backed install used daily, after about two weeks:
WP_Agent_Workflow_Branch_Storeoptions are never swept.- 5,453 options accumulated:
agents_wf_branch_*3,247,agents_wf_branch_ctx_*1,013,agents_wf_branch_index_*1,013,agents_wf_branch_admission_*180. The oldest is from 11 days earlier. - Rows carry
expires(TTL_SECONDS = 7200), but expiry is only honoured on read. Rows are deleted only byforget_run()/forget_reconcile_receipt()when a run terminalizes, so any run that never resumes (stranded branches, crashed workers, a queue that stopped draining) leaves its rows forever.
- 5,453 options accumulated:
- The request controller's operation store has no retention.
- All operations for one controller key live in a single option. For one consumer's key it reached 9.9 MB.
- That option is rewritten on each operation transition. On that backend, a write of this size measured about 1.5 s and a read about 48 ms, on every search the consumer runs.
Both costs scale with option count and size on any backend; they're just most visible on file-backed storage.
Suggested direction
- Branch store: a bounded sweeper (for example, on the existing Action Scheduler recurring hook, or piggy-backed on dispatch) that deletes rows whose
expireshas passed and whose run is terminal or unknown. - Request controller: prune terminal operations past a retention window (and/or cap the count), and consider one option per operation, or a table, instead of one ever-growing array.
Related: storage-side latency fixes in Automattic/markdown-database-integration#429 make these writes cheaper, but don't remove the growth.
AI disclosure: measured and written up by Claude (Anthropic) via OpenCode/Kimaki at Chris Huber's direction.
- Dominant language
- PHP
- Stars
- 33
- Forks
- 8
- Avg merge
- 24m
- Merged PRs (30d)
- 18
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/agents-api
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/agents-api#564 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
Automattic/agents-api#576 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Automattic/agents-api#572 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Automattic/agents-api#560 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Automattic/agents-api#552 ·
Maintainers usually reply within 1 day
All issues in Automattic/agents-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
domain/crm-after-sales Platform(Default) priority/high
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
kind/bug status/to verify
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PHP-CS-Fixer/PHP-CS-Fixer#9867 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days