@misterhuydo/sentinel 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2929,23 +2929,30 @@ async def _run_tool(name: str, inputs: dict, cfg_loader, store, slack_client=Non
|
|
|
2929
2929
|
f"Question / Task: {question}"
|
|
2930
2930
|
)
|
|
2931
2931
|
from .fix_engine import _is_auth_error
|
|
2932
|
-
|
|
2932
|
+
skip_perms = os.getuid() != 0
|
|
2933
|
+
# OAuth attempt: no --bare so the stored OAuth session is used naturally
|
|
2934
|
+
oauth_cmd = (
|
|
2935
|
+
[cfg.claude_code_bin, "--dangerously-skip-permissions", "--print", prompt]
|
|
2936
|
+
if skip_perms else
|
|
2937
|
+
[cfg.claude_code_bin, "--print", prompt]
|
|
2938
|
+
)
|
|
2939
|
+
# API key fallback: --bare forces API-key-only auth (no OAuth/hooks)
|
|
2940
|
+
api_cmd = (
|
|
2933
2941
|
[cfg.claude_code_bin, "--dangerously-skip-permissions", "--bare", "--print", prompt]
|
|
2934
|
-
if
|
|
2942
|
+
if skip_perms else
|
|
2935
2943
|
[cfg.claude_code_bin, "--bare", "--print", prompt]
|
|
2936
2944
|
)
|
|
2937
2945
|
run_kwargs = dict(capture_output=True, text=True, timeout=300,
|
|
2938
2946
|
cwd=str(local_path), stdin=subprocess.DEVNULL)
|
|
2939
2947
|
try:
|
|
2940
|
-
|
|
2941
|
-
r = subprocess.run(cmd, env=env, **run_kwargs)
|
|
2948
|
+
r = subprocess.run(oauth_cmd, env=env, **run_kwargs)
|
|
2942
2949
|
output = (r.stdout or "").strip()
|
|
2943
2950
|
auth_failed = _is_auth_error(output) or _is_auth_error(r.stderr or "")
|
|
2944
2951
|
|
|
2945
|
-
# Silent fallback: retry with API key
|
|
2952
|
+
# Silent fallback: OAuth session expired — retry with API key
|
|
2946
2953
|
if auth_failed and api_env:
|
|
2947
2954
|
logger.warning("ask_codebase/%s: OAuth session issue — retrying with API key", repo_name)
|
|
2948
|
-
r = subprocess.run(
|
|
2955
|
+
r = subprocess.run(api_cmd, env=api_env, **run_kwargs)
|
|
2949
2956
|
output = (r.stdout or "").strip()
|
|
2950
2957
|
|
|
2951
2958
|
logger.info("Boss ask_codebase %s mode=%s rc=%d len=%d", repo_name, mode, r.returncode, len(output))
|