Bug: orchestrator-mcp-scan.sh dies with E2BIG (exit 126) once termlink list --json exceeds MAX_ARG_STRLEN
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 53/100
Hướng nghiên cứu
Start by reading agents/audit/orchestrator-mcp-scan.sh, especially the SESSIONS_JSON export and Python heredoc, then run the script with a session list larger than MAX_ARG_STRLEN. The issue includes an example fix that passes the bulk data through a temporary file; verify the scan no longer exits 126 and can report its backlog. The report also mentions a separate non-interactive prompt in lib/upstream.sh:299, which is outside the main bug.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
- Framework version: 1.6.258
- Project: 050-email-archive (shared-tooling mode)
- Reported: 2026-09-25T00:02:17Z
Description
Summary
agents/audit/orchestrator-mcp-scan.sh passes the full output of termlink list --json to
Python through an exported environment variable (SESSIONS_JSON). Linux caps each
individual argv/envp string at MAX_ARG_STRLEN = 32 x PAGE_SIZE = 131,072 bytes,
independently of the much larger total-size limit. Once a fleet's session list crosses that
cap, the execve of python3 fails with E2BIG and the script exits 126 before a single
line of Python runs.
The orchestrator-arc MCP scan is the drift defense for MCP-tool task_id enforcement (T-1646)
— it is the check that notices when a gated MCP tool loses its check_task_governance. When
this fires, that check is not degraded, it is dead.
Why it matters more than a normal probe failure
- It is monotonic, not intermittent. The payload grows with fleet size. Once over the cap
it can never recover on its own, and it gets worse with every session added. - Its death is invisible. The parallel
framework-mcpleg on the same scan still reports
[PASS]in the same audit section, so the section reads healthy. audit.shmislabels the cause. The probe-failure branch (audit.sh:~4623) emits a
hardcoded evidence string —"Cannot reach /opt/termlink via direct read or termlink interact"— for any non-0/1/2 exit. Only$ORCH_EXIT_CAPTUREDis measured. On our host
/opt/termlinkis reachable andtermlink list --jsonworks, so the stated cause is false
and the suggested mitigation ("checkFW_TERMLINK_REPOand TermLink session availability")
sends the reader to two healthy subsystems. Filed separately on our side; flagged here
because the two together are why this sat unfixed.
Measured (framework v1.6.258, 2026-09-25)
$ bash agents/audit/orchestrator-mcp-scan.sh
agents/audit/orchestrator-mcp-scan.sh: line 141: /usr/bin/python3: Argument list too long
EXIT=126
$ termlink list --json | wc -c
186907 # 1.43x over the 131072-byte cap
After the fix, same host
Exit 126 -> exit 1, and the scan reported a real backlog on its first successful run:
tools 260 vs baseline 263; 6 new unclassified tools (termlink_fleet_governor_history,
termlink_fleet_governor_status, termlink_hub_governor_status,
termlink_substrate_history, termlink_substrate_status, termlink_whoami); 12 removed;
TAG-FORMAT-DRIFT on 4 non-canonical prefixes; 347 sessions tag-linted. Restoring this detector
makes the audit louder, which is the point.
Patch (applied to our vendored copy; diff inline, deliberately NOT --attach-patch)
Bulk payload travels by file; only the short path is exported. Note python3 - <<'PYEOF'
already consumes stdin for the script itself, so a temp file is the fix rather than a naive
stdin swap. A guard over the remaining exported values fails loudly naming E2BIG /
MAX_ARG_STRLEN instead of surfacing an opaque 126.
-SESSIONS_JSON=$(probe_sessions_json)
+SESSIONS_JSON_FILE=$(mktemp -t orch-sessions-XXXXXX.json)
+trap 'rm -f "$SESSIONS_JSON_FILE"' EXIT
+probe_sessions_json > "$SESSIONS_JSON_FILE"
-export CURRENT_TOOLS CURRENT_GATED BASELINE LATEST SESSIONS_JSON APPLY_MODE \
+export CURRENT_TOOLS CURRENT_GATED BASELINE LATEST SESSIONS_JSON_FILE APPLY_MODE \
CURRENT_FRAMEWORK_TOOLS CURRENT_FRAMEWORK_GATED FRAMEWORK_BASELINE
+
+ORCH_MAX_ARG_STRLEN=131072
+for _v in CURRENT_TOOLS CURRENT_GATED BASELINE LATEST SESSIONS_JSON_FILE APPLY_MODE \
+ CURRENT_FRAMEWORK_TOOLS CURRENT_FRAMEWORK_GATED FRAMEWORK_BASELINE; do
+ eval "_len=\${#$_v}"
+ if [ "$_len" -ge "$ORCH_MAX_ARG_STRLEN" ]; then
+ echo "ERROR: \$$_v is $_len bytes, at or over MAX_ARG_STRLEN ($ORCH_MAX_ARG_STRLEN)." >&2
+ echo " execve would fail with E2BIG (shell reports exit 126). Pass this value" >&2
+ echo " by file like SESSIONS_JSON_FILE instead of exporting it." >&2
+ exit 2
+ fi
+done
python3 - <<'PYEOF'
-sessions_json = os.environ.get('SESSIONS_JSON', '') or ''
+_sessions_path = os.environ.get('SESSIONS_JSON_FILE', '')
+try:
+ with open(_sessions_path) as _fh:
+ sessions_json = _fh.read()
+except (OSError, ValueError):
+ sessions_json = ''
Suggested generalisation
Any probe output of unbounded size should travel by file or stdin, never export. The guard
above is the cheap version; a shared helper would be better, since CURRENT_TOOLS is on the
same trajectory as the MCP tool inventory grows.
Second, smaller report while here: fw upstream report cannot be driven non-interactively
lib/upstream.sh:299 calls a bare read -r confirm. With no TTY (CI, claude -p, any
scripted caller) the verb hangs indefinitely rather than failing. The only escape is
--force, which also skips the duplicate check — the flag conflates "I am not interactive"
with "do not check for duplicates", so a non-interactive caller is pushed toward disabling a
safety check it has no reason to disable. Suggest either honouring a piped y (works today),
detecting [ ! -t 0 ] and erroring with guidance, or splitting --force into
--yes / --skip-duplicate-check.
Reported from consumer project Pen (050-email-archive), task T-2189, arc-009.
Reported via fw upstream report from field installation
- Ngôn ngữ chính
- Shell
- Star
- 16
- Fork
- 6
- Merge trung bình
- 6 giờ 24 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DimitriGeelen/agentic-engineering-framework
-
area:doctor bug severity:low status:accepted triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DimitriGeelen/agentic-engineering-framework#100 · 3 bình luận ·
-
area:doctor bug severity:medium status:accepted triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
DimitriGeelen/agentic-engineering-framework#97 · 3 bình luận ·
-
area:context bug severity:low status:accepted triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
DimitriGeelen/agentic-engineering-framework#96 · 3 bình luận ·
-
area:cli bug severity:medium status:accepted triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DimitriGeelen/agentic-engineering-framework#95 · 3 bình luận ·
-
area:watchtower bug severity:low status:released triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
DimitriGeelen/agentic-engineering-framework#94 · 4 bình luận ·
Tất cả issue của DimitriGeelen/agentic-engineering-framework
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
phusion/passenger-docker#480 ·
-
Gemini: respect PLANNING_DISABLED=1 in lifecycle context hooksCó thể đã có người làm @AmariAugustin đã nhận hôm nay. Đang mởbug good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
OthmanAdi/planning-with-files#329 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Agents panel: Codex token stats always empty because Codex now writes `*.jsonl.zst` sessionsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 2 ngày
-
headers-parser: `forRegExp` does not escape regexp characters in path segments that contain `*`Có thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
mattpocock/skills#1307 ·
Maintainer thường phản hồi trong vòng 1 ngày