Repository navigation
Add: force-reset recovery for AICore op-timeout poison (a5 + a2a3) #1016
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
ChaoWao
merged 1 commit into
hw-native-sys:main
from
ChaoWao:feat/a5-device-force-reset-recovery
Jun 9, 2026
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Environment-Variable and Macro Gating | ||
|
|
||
| Environment variables and preprocessor macros that gate *behavior* (feature | ||
| flags, opt-in/opt-out switches, conditional code paths) are configuration | ||
| surface. They are easy to add and hard to remove: each one becomes a | ||
| permutation that must be documented, wired through CI, and reasoned about | ||
| forever. Keep them to a minimum. | ||
|
|
||
| ## 1. Adding a behavior gate requires explicit user permission | ||
|
|
||
| **Before adding any new environment variable or macro that isolates or gates | ||
| behavior, you MUST explicitly ask the user for permission first.** State what | ||
| the flag would be, why you think it's needed, and what the default is — then | ||
| wait for an explicit yes. | ||
|
|
||
| This covers: | ||
|
|
||
| - New `std::getenv(...)` / `os.environ[...]` reads that change what the code | ||
| does. | ||
| - New `#ifdef` / `#if defined(...)` blocks (or `-D` compile flags) that select | ||
| between behaviors. | ||
| - New pytest CLI flags / env vars that toggle a code path. | ||
|
|
||
| It does **not** cover reading an *already-agreed* flag, or env/macros that are | ||
| purely diagnostic (a log-verbosity knob that changes no behavior) — though when | ||
| in doubt, ask. | ||
|
|
||
| Prefer alternatives that need no gate: do the thing unconditionally when it is | ||
| always correct; derive the decision from existing state; or rely on an existing | ||
| project invariant (e.g. onboard work always holds an exclusive `task-submit` | ||
| lock, so a device force-reset on the error path needs no opt-in flag). | ||
|
|
||
| ## 2. Every env/macro touch is a chance to delete one | ||
|
|
||
| Whenever you modify code that reads an environment variable or branches on a | ||
| macro, check whether it can be **removed** — the gate may be dead, redundant, | ||
| or replaceable by unconditional behavior now that the surrounding code has | ||
| changed. If so, delete it (and its CI wiring, docs, and any include added only | ||
| for it). Leaving a stale gate is worse than never adding it: it implies a | ||
| choice that no longer exists. |
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.
Uh oh!
There was an error while loading. Please reload this page.