Repository navigation
docs(limits): describe how to design admission recovery #6368
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
Merged
+179
−14
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d98f604
fix(reconstruction): dedupe residual unknown ids with uniqueSorted
cursoragent d32e73d
docs(limits): describe how to design admission recovery
cursoragent bad9421
fix(hopper): pass distribution readers into install-host tests
cursoragent ec7c42b
docs(limits): name the parser doctor shares with startup
cursoragent 94caf0d
test: align pcap, storage, and regex fixtures with current contracts
cursoragent 7e48678
chore: merge current main into admission recovery docs
morluto d2761c8
docs: link repository experiments outside the built site
morluto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # Admission limits and recovery | ||
|
|
||
| How to add a REA-owned admission ceiling, budget, or deadline, and what a caller | ||
| does when one is hit. This is a design rule, not an inventory. Ceilings that | ||
| should become settings are tracked in | ||
| [#6176](https://github.com/morluto/rea/issues/6176). Naming honesty for limit | ||
| errors is [#5910](https://github.com/morluto/rea/issues/5910). | ||
|
|
||
| ## Name a default, then a setting when operators need headroom | ||
|
|
||
| Put the number in a named constant with a unit. Do not leave it as a magic | ||
| number at the call site. | ||
|
|
||
| When a workload may need more room, add a setting whose unset value is that | ||
| constant. One module under | ||
| [`src/config/`](https://github.com/morluto/rea/blob/main/src/config) owns the | ||
| default, any floor, the maximum, the schema, the parser, and the recovery | ||
| text. Register that schema on `environmentSchema` in | ||
| [`environment.ts`](https://github.com/morluto/rea/blob/main/src/config/environment.ts). | ||
| `parseConfig` calls `parseEnvironment`. Doctor uses that same parser through | ||
| `nativeAnalysisConfigurationError`, so startup and `rea doctor` accept the | ||
| same values. Add the name to `SELECTED_REGISTRATION_SETTINGS` so `rea setup` | ||
| copies it into the client registration. Unset keeps today's behavior. An | ||
| invalid value is a `ConfigurationError` and projects as `configuration_invalid`. | ||
| Do not fall back to the default. | ||
|
|
||
| [`REA_REGEX_MATCHING_DEADLINE_MS`](https://github.com/morluto/rea/blob/main/src/config/regexMatchingDeadline.ts) | ||
| ([#6267](https://github.com/morluto/rea/pull/6267)) is the reference. Default | ||
| 5000 ms, floor 1 ms, maximum 2147483647 ms, because Node schedules a longer | ||
| `setTimeout` delay as 1 ms. Setup copies the setting. A hit says: | ||
|
|
||
| > The effective REA_REGEX_MATCHING_DEADLINE_MS value is 5000 ms (source default; default 5000 ms, floor 1 ms, maximum 2147483647 ms). Set REA_REGEX_MATCHING_DEADLINE_MS in the environment that starts REA to a positive decimal integer from 1 to 2147483647, then restart REA. The worker old-generation heap does not raise this deadline. | ||
|
|
||
| [`REA_MCP_MAX_RESPONSE_BYTES`](https://github.com/morluto/rea/blob/main/src/config/mcpResponseBudget.ts) | ||
| is the byte-budget shape: a decimal safe integer with a 10 MiB floor | ||
| (`MINIMUM_RESPONSE_BYTES`), the same shared schema, and no silent fallback. A | ||
| change needs a REA restart and a matching client receive buffer. It does not | ||
| raise REA's reserved string limit or Node's string ceiling. The setup | ||
| allowlist does not copy this setting. A new headroom setting should, following | ||
| the regex deadline. | ||
|
|
||
| A per-call budget is not an environment setting. JavaScript `max_heap_mb` | ||
| (CLI `--max-heap-mb`) is an integer from 128 to 16384 MiB, default 1024. It | ||
| applies on the next analysis, which starts a new worker, and does not restart | ||
| REA. It does not raise the parent result budget, transfer ceilings, or fixed | ||
| parser limits. | ||
|
|
||
| Host memory and `NODE_OPTIONS` do not raise a REA admission unless that | ||
| admission's recovery says so. The JavaScript parent result budget is one that | ||
| does: its recovery says to set `NODE_OPTIONS` (for example | ||
| `--max-old-space-size=<MiB>`) on the process that starts REA, then restart | ||
| that process. `max_heap_mb` does not raise it. | ||
|
|
||
| ## Keep a fixed ceiling honest | ||
|
|
||
| If the ceiling must stay fixed, say so in the failure. Name the limit and the | ||
| effective value, say this release has no runtime override, and name what does | ||
| not raise it. Do not invent a setting. | ||
|
|
||
| JSON values stop at `MAX_JSON_DEPTH` (1000) in | ||
| [`jsonValue.ts`](https://github.com/morluto/rea/blob/main/src/domain/jsonValue.ts): | ||
| "JSON value exceeds maximum nesting depth of 1000. This release has no runtime | ||
| override." | ||
|
|
||
| ## Recovery text | ||
|
|
||
| The string the caller sees includes: | ||
|
|
||
| - the limit or setting name | ||
| - the effective value and unit | ||
| - the source (`default` or `setting`) | ||
| - the default, the maximum, and the floor when the setting has one | ||
| - the next action, including where to set it ("in the environment that starts REA") | ||
| - whether a restart is required | ||
| - what the change does not raise | ||
|
|
||
| Invalid settings never take this path. They are `configuration_invalid`. | ||
| Doctor reports `runtime-configuration:<setting>` and says to correct it in the | ||
| shell or the MCP registration, then rerun. | ||
|
|
||
| ## What agents do | ||
|
|
||
| Follow `remediation.action`. Change a request field or a `REA_*` setting only | ||
| when that text recommends the change. Restart only when it says the value is | ||
| read at startup. A sentence that a control does not raise the limit is not a | ||
| request to change it. | ||
|
|
||
| - Dropped MCP connection: retry the call once only when it is safe to repeat | ||
| or known not to have started. If it may already have changed the target, or | ||
| it fails again, tell the user and ask them to restart the MCP client. Do not | ||
| start with `rea doctor` | ||
| ([#6353](https://github.com/morluto/rea/pull/6353)). | ||
| - REA could not start its connection: retry once. If it fails again, tell the | ||
| user and ask them to restart the MCP client, then run `rea doctor`. Do not | ||
| retry a startup that returns the same unchanged result: tell the user REA | ||
| could not start, ask them to restart the MCP client, then run `rea doctor`. | ||
| - Unexpected process-command failure: do not repeat the command. Tell the user | ||
| to check the input files, then run `rea doctor`. | ||
| - `cleanup_incomplete`: the operation is not retryable. Retry that exact | ||
| cleanup owner, named in `details.resources`, and wait until it confirms | ||
| release before admitting new work on those resources | ||
| ([#6357](https://github.com/morluto/rea/pull/6357)). | ||
| - `resource_constraint` for capacity, when `retryable` is true: wait for the | ||
| active admission to finish, then retry within the reported limits. Do not | ||
| restart REA to free the slot. | ||
| - `configuration_invalid`: correct the named setting in the environment that | ||
| starts REA, then start REA again. Run `rea doctor` for the | ||
| `runtime-configuration:` check. Re-run `rea setup` for that client when the | ||
| setting is on the registration allowlist, then reconnect so the new process | ||
| sees it. | ||
| - `invalid_request`: correct the reported fields from the current schema or | ||
| CLI help. Do not repeat the unchanged call. | ||
|
|
||
| A restart is required for an environment setting and for a client still | ||
| running the previous registration. It is not the first step for a transient | ||
| MCP drop, a capacity wait, or retained cleanup. | ||
|
|
||
| ## Tests | ||
|
|
||
| Lock the unset default, one accepted override, rejected floor, maximum, and | ||
| syntax, and the recovery sentence through `parseEnvironment` and `parseConfig`. | ||
| [`regexMatchingDeadline.test.ts`](https://github.com/morluto/rea/blob/main/src/config/regexMatchingDeadline.test.ts) | ||
| is the pattern. Project the failure and assert `configuration_invalid` for a | ||
| bad value and the recovery wording for a hit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
For target-free workflows backed by
ArtifactResourceScope, such asinspect_wasm_artifact,details.resourcescontains descriptive labels rather than callable cleanup owners, and invoking the original tool again is precisely what causesArtifactResourceScope.runto retry retained cleanup before admitting the operation. This guidance therefore gives the agent no callable recovery action while explicitly forbidding the available one, potentially leaving the session blocked aftercleanup_incomplete; direct callers to the returned remediation or the operation-specific cleanup path instead.AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.