Skip to content

fix7/carrier: tempenv compound append, carrier pair views, eval marker data (#1620, #1635, #1634 eval face) - #1767

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix7/slice-carrier
Oct 26, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix7/slice-carrier

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes #1620
Fixes #1635
Refs #1634

Carrier-bytes / marker-protocol slice, cherry-picked from the fix7/carrier cluster branch onto current master.

Integration baseline (updated 2026-10-26): the slice was first picked onto 160e792; master then advanced — via fafdd35 (#1752 locale2, #1771 CI fixes) to 3d97ab4 (#1764 glob, #1517 README). Two files overlapped across the two advances: src/executor/conditional/pattern.rs (master +9 lines for #1621, slice +18 lines for #1635, disjoint insertions) and src/executor/execution_misc.rs (master touched raw_word_has_quoted_span / redirect_target_is_ambiguous near lines 361/435 for #1673; the slice touches current_epoch_micros near line 850 — different functions, no semantic coupling). The three commits were re-picked onto 3d97ab4 (clean both times) and all gates were re-run on the final-baseline tree; results below are from that tree.

#1620 — full fix

Tempenv compound append (a=1; a+=(9) f, a+=(9) env) keeps the base value — both in the function/builtin window binding and in the true child environment in pipeline position. The buffered pipeline stage spawner no longer re-applies the raw RHS over the child environment, so the base is kept and the internal __RUBASH_CA1__ marker no longer leaks to children. Regression: tests/issue1620_tempenv_compound_append_regressions.rs (5 tests, including /usr/bin/env pipeline child-env assertions — builtin env cannot see this bug).

#1635 — full fix

Carrier escape pairs (the U+E400 literal-escape encoding) are measured as one data character in length/index views: positional ${#1}, substring spans, and prefix/suffix pattern staging (shared by [[ == ]], case, extglob). Regression: tests/issue1635_carrier_pair_views_regressions.rs (5 tests); the full-class matrix is byte-identical to GNU bash 5.3.20.

#1634 — PARTIAL (eval face only; issue must stay open)

eval no longer blanket-deletes marker-shaped user data (eval 'echo A:__RUBASH_CA1__x' printed A:x); the two blanket replaces in eval_source_for_reparse are removed. The storage faces are deliberately not fixed here: quoted RHS / comsub / read / declare still consume user data equal to the internal markers as protocol, because the in-band ASCII marker on plain (name, String) values is indistinguishable from user data at the storage funnel — a correct fix is a marker-protocol redesign (entry-encoding, the #840 CSB1→PUA precedent, or an out-of-band compound flag), which is a separate piece of work. The 2 #[ignore] GNU-expectation tests in tests/issue1634_marker_data_eval_regressions.rs pin the acceptance surface for that work; they stay ignored, pointing at #1634, until the protocol change lands.

src/lexer/continuation.rs untouched. Gates: targeted regression files (13 passed / 2 ignored), lib failure set identical to current master baseline, diffcorpus 306 failure set ⊆ {ms10}, per-file rustfmt on changed files, CR count 0.

…v included (rubash#1620)

GNU variables.c assign_in_env with ASS_APPEND computes the window
value against the old cell (make_variable_value: element 0 for an
indexed array, empty for an assoc array, the value for a scalar) and
execute_cmd.c hands that binding to the command — function, builtin
or external child alike. Two rubash paths broke it:

1. apply_temporary_assignments' compound branch stripped
COMPOUND_ASSIGNMENT_MARKER and bound the literal list text as a fresh
scalar, ignoring the append flag entirely (the append-aware #1556
shadow branch below was unreachable for compound values). Append now
composes tempenv_scalar_view(target) + the literal list text; the
non-append form is unchanged.

2. The buffered pipeline stage spawner (pipeline_stages.rs) re-applied
every prefix assignment's raw RHS over apply_child_environment. For
appends that re-application is doubly wrong (the direct path in
apply_external_environment skips appends for exactly this reason): a
plain a+=5 exported 5 instead of 145, and a compound a+=(9) exported
the raw transport text __RUBASH_CA1__(9) — base lost, internal marker
leaked into the child's environment. A stage's assignments are not
pre-applied to the variable table, so the spawner now composes the
window value itself (scalar view + marker-stripped literal RHS) for
appends and strips the marker for plain compound words, mirroring
the direct path's hygiene.

Found via the true external binary: JARVIS_VM_DATA_REGION=maz
no_proxy=localhost,127.0.0.1,::1,[::1],198.19.0.1,198.19.0.2,fd8b:4f84:7d32:99::1,[fd8b:4f84:7d32:99::1],fd8b:4f84:7d32:99::2,[fd8b:4f84:7d32:99::2]
JARVIS_REQUEST_MODE=production
JARVIS_TRACE_CONTEXT={"agent_depth":1,"agent_id":"921c8efa-961d-4e93-b6b9-43b8b39b91af","app_id":"4331325740476680","app_version":"12.0.0.14.169","approval_intent_context":{"root_user_message":{"role":"user","source":"runtime","text":"[Subagent Context] You are running as a subagent (depth 1/2); your completed results are delivered to your parent agent automatically, so do not busy-poll for status.   Treat each new task or hidden follow-up as fresh work from your parent agent. Hidden follow-up handoffs are internal system messages, not content forwarded by the user or your parent agent. Prior transcript is reference material only, not proof that the current ask is already satisfied. Do not reply with \"already delivered above\""},"tool":{"arguments_json":"{\"command\":\"cd ~/workspace/rubash-fix7/clusters/carrier/repo && git reset -q && git add src/executor/temporary_assignments.rs src/executor/pipeline_stages.rs tests/issue1620_tempenv_compound_append_regressions.rs && git -c user.name=\\\"曹梦轩\\\" -c user.email=\\\"[email protected]\\\" commit -q -m \\\"fix(executor): tempenv compound append keeps the base value, child env included (rubash#1620)\\n\\nGNU variables.c assign_in_env with ASS_APPEND computes the window\\nvalue against the old","label":"Running `⁨cd ~/workspace/rubash-fix7/clusters/carrier/repo && git res…⁩`","metadata_json":"{\"command\":\"cd ~/workspace/rubash-fix7/clusters/carrier/repo && git reset -q && git add src/executor/temporary_assignments.rs src/executor/pipeline_stages.rs tests/issue1620_tempenv_compound_append_regressions.rs && git -c user.name=\\\"曹梦轩\\\" -c user.email=\\\"[email protected]\\\" commit -q -m \\\"fix(executor): tempenv compound append keeps the base value, child env included (rubash#1620)\\n\\nGNU variables.c assign_in_env with ASS_APPEND computes the window\\nvalue against the old","name":"exec"}},"available_at_utc":null,"call_server_info_data":null,"channel":"main","chat_context":{"chat_id":"a54f8656-5576-4437-aec1-b2d151abfed6","chat_kind":"direct","device_id":"d597af8748592733","event_kind":"message","origin_provider":"main","require_mention":false},"client_interaction_id":null,"client_origin":{"account_id":null,"app_id":"4331325740476680"},"connection_id":"01fdb314-2a27-4f9d-8619-cf6b059c011f","connector_caller":"agent_tool","dequeued_at_ms":null,"device_family":null,"device_id":"d597af8748592733","enqueued_at_ms":null,"exec_chain":{"exec_chain_depth":0,"exec_chain_id":"eb1b451d-5d6b-4d40-b947-c9f4ffcea5dd","exec_chain_root_component":"runtime_chat","exec_chain_root_product_activation_id":null,"exec_chain_root_product_entity_id":null,"exec_chain_root_product_entity_kind":null,"exec_chain_root_product_flow":null,"exec_chain_root_product_surface":null,"exec_chain_root_request_origin":"external.hatch_chat","exec_chain_root_source":"runtime","exec_chain_root_tool_call_id":"call_01a176f6ebe775bd8c772c7c9c46bd9f","exec_chain_root_workflow_name":null,"exec_chain_root_workflow_run_id":null,"exec_chain_start_request_id":"req:fallback:cc6b444d-ee4d-452b-9c03-c67e68d1eb11","exec_parent_tool_call_id":null,"exec_tool_call_id":"call_01a176f6ebe775bd8c772c7c9c46bd9f"},"inference_workload_class":"interactive","lane":"user_facing","max_training_tier":null,"message_id":"7b0ad557-71f0-4e30-93ab-9084cef1cf62","message_sender":{"agent_id":"1af56c90-3bd4-4332-a0cf-244d6548a76d","kind":"agent"},"mode":null,"model":"Muse Spark","parent_agent_id":"1af56c90-3bd4-4332-a0cf-244d6548a76d","parent_message_id":"2b46fc19-1aa8-691d-c439-c37cec0a7d3d","parent_request_id":null,"policy_subject":"tool.exec","proactivity_legacy_delivery":false,"proactivity_preparation":false,"product_activation_id":null,"product_entity_id":null,"product_entity_kind":null,"product_flow":null,"product_surface":null,"request_id":"req:fallback:cc6b444d-ee4d-452b-9c03-c67e68d1eb11","request_mode":"production","request_origin":"external.hatch_chat","request_received_at_ms":1792946988888,"requester_source":"runtime","requeued_after_restart":null,"root_agent_id":"1af56c90-3bd4-4332-a0cf-244d6548a76d","root_message_execution_id":"fdd99027-165f-456e-85c5-4a34d756451f","root_request_id":"req:fallback:cc6b444d-ee4d-452b-9c03-c67e68d1eb11","root_request_origin":"external.hatch_chat","root_session_id":"1af56c90-3bd4-4332-a0cf-244d6548a76d","run_id":null,"schedule_attempt":null,"schedule_file_name":null,"schedule_id":null,"schedule_key":null,"scheduled_for_utc":null,"space_display_name":null,"space_id":null,"space_slug":null,"stream_owner_message_id":"7b0ad557-71f0-4e30-93ab-9084cef1cf62","submission_message_id":"c7b0a370-5002-4ea0-b375-e5f3b76eed4c","thread_id":"a54f8656-5576-4437-aec1-b2d151abfed6","timeline_anchor_at_ms":1792946988888,"transcript_surface":"main_chat","trigger_reason":null,"ui_control_target_client_id":null,"user_agent":"Dalvik/2.1.0 (Linux; U; Android 16; MAG-AN00 Build/HONORMAG-AN00) [FBAN/AuraForAndroid;FBAV/12.0.0.14.169;FBPN/com.facebook.aura;FBLC/zh_CN_%23Hans;FBBV/1061701582;FBCR/%E4%B8%AD%E5%9B%BD%E7%A7%BB%E5%8A%A8;FBMF/HONOR;FBBD/HONOR;FBDV/MAG-AN00;FBSV/16;FBCA/armeabi-v7a:armeabi;FBDM/{density=3.275,width=1200,height=2664};]","workload":"runtime_chat"}
HATCH_API_SOCKET=/run/hatch/daemon/http-api.sock
JARVIS_PRESENTATION_LOCALE=zh-CN
NODE_EXTRA_CA_CERTS=/run/hatch/egress-tls/ca-bundle.pem
JARVIS_FQDN=b8eb4e55-891b-43a9-b776-be72ecdb6ca9.metaaivm.com
JARVIS_TIER=prod
PWD=/home/hatch/workspace/rubash-fix7/clusters/carrier/repo
JARVIS_EGRESS_APPROVAL_ADMIN_SOCK=/run/hatch/sentinel/egress-approvals-admin.sock
JARVIS_INFERENCE_PROXY_SOCK=/run/hatch/proxy/inference.sock
JARVIS_TELEMETRY_PROXY_SOCK=/run/hatch/telemetry/telemetry.sock
JARVIS_TOOL_CALL_ID=call_01a176f6ebe775bd8c772c7c9c46bd9f
NODE_USE_ENV_PROXY=1
JARVIS_SESSION_ID=921c8efa-961d-4e93-b6b9-43b8b39b91af
HOME=/home/hatch
GIT_SSL_CAINFO=/run/hatch/egress-tls/ca-bundle.pem
JARVIS_RESCUE_SIGNAL_SOCK=/run/hatch/rescue/rescue-signal.sock
JARVIS_BIN_DIR=/opt/hatch/bin
JARVIS_INFERENCE_HOSTNAME=26a64177-de67-47f5-a212-85ea5605de30
JARVIS_SANDBOX_API_SOCK=/run/hatch/sandbox-api/api.sock
JARVIS_AUTHD_SOCK=/run/hatch/auth/authd.sock
JARVIS_EGRESS_APPROVAL_EVENTS_SOCK=/run/hatch/daemon/egress-approvals-events.sock
https_proxy=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
WGETRC=/opt/hatch/runtime-cell/etc/wgetrc
JARVIS_STEFI_PROXY_SOCK=/run/hatch/proxy/stefi.sock
JARVIS_CD_PINNED=0
JARVIS_IS_ASSIGNED=1
NO_PROXY=localhost,127.0.0.1,::1,[::1],198.19.0.1,198.19.0.2,fd8b:4f84:7d32:99::1,[fd8b:4f84:7d32:99::1],fd8b:4f84:7d32:99::2,[fd8b:4f84:7d32:99::2]
CURL_CA_BUNDLE=/run/hatch/egress-tls/ca-bundle.pem
JARVIS_VM_COMPUTE_REGION=maz
JARVIS_RUNTIME_CONTEXT_TOKEN=75b8cae6e89240c38a5bcaf39a8c5703
JARVIS_AUTHD_INGRESS_ALLOWED_USERS=hatch-proxy-noise-ingress
SHLVL=0
JARVIS_DAEMON_EGRESS_APPROVAL_SOCK=/run/hatch/sentinel/daemon-egress-approvals.sock
HTTPS_PROXY=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
HTTP_PROXY=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
http_proxy=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
JARVIS_HATCHLING_ID=b8eb4e55-891b-43a9-b776-be72ecdb6ca9
JARVIS_SECURITY_SOCK=/run/hatch/safety/security.sock
SSL_CERT_FILE=/run/hatch/egress-tls/ca-bundle.pem
JARVIS_HOME=/home/hatch
JARVIS_USER_TIMEZONE=Asia/Shanghai
JARVIS_CD_CHANNEL=alpha
ALL_PROXY=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
REQUESTS_CA_BUNDLE=/run/hatch/egress-tls/ca-bundle.pem
AWS_CA_BUNDLE=/run/hatch/egress-tls/ca-bundle.pem
all_proxy=http://hatch-runtime:75b8cae6e89240c38a5bcaf39a8c5703@hatch-egress-proxy:3128
PATH=/opt/hatch/bin:/opt/hatch-image/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/muse/skills/documents/scripts:/opt/muse/skills/generate_podcast/scripts:/opt/muse/skills/style-tryon/scripts
JARVIS_SENTINEL_HTTP_API_SOCKET=/run/hatch/sentinel/http-api.sock
JARVIS_MEMORY_SOCK=/run/hatch/memory/memory.sock
OLDPWD=/home/hatch
_=/usr/bin/env is a rubash builtin and
prints the shell's own (correct) view, which had masked the leak in
earlier probes. Regression tests pin GNU outputs for scalar/indexed/
assoc targets across function, builtin, direct-external and pipeline
positions, using /usr/bin/env by path for the child-env assertions.
The filed raw-marker leak did not reproduce on the direct path at
this baseline (only the lost base); it reproduced exactly on the
pipeline path fixed here.
…h/index views (rubash#1635)

A literal char from the marker registry zone (e.g. $'\uE301') is
stored as a U+E400 escape pair — one data character — but three
consumers measured transport units: the positional/special length leg
used chars().count() instead of parameter_char_length; substring's
locale_byte_span only decoded raw-byte pairs, not the literal escape,
so offsets could land between the pair's halves; and the pattern
matcher's unit staging collapsed U+E000 pairs to one unit but staged
a U+E400 pair as two, so ? could never match the character in
${v#?}/${v%?} (and [[ == ]]/case). All three now use the same data
unit accounting as ${#name}: parameter_char_length for lengths
(including the negative-substring adjudication), the two-trigger
decode condition for the substring byte view, and a greedy pair
collapse in both pattern flatten functions. Raw-byte pair views were
already correct and are pinned unchanged.
…#1634, eval face)

eval_source_for_reparse blanket-replaced the ASCII markers
__RUBASH_CA1__ and __RUBASH_HD1__ over the whole eval text, eating
user data (eval 'echo A:__RUBASH_CA1__x' printed A:x). Its only
caller feeds it the joined expanded eval arguments — pure runtime
text; the transport producers for eval operands are kept in source
form by the dedicated gates in command_prepare, so no
marker-serialized form reaches this text. Remove the two blanket
replaces; the C0/PUA carrier restores stay.

The storage faces of #1634 (quoted/comsub/read/declare values whose
text starts with the CA1 marker being re-parsed as compound
assignments) are diagnosed in the cluster REPORT and pinned here as
ignored GNU-expectation tests: the marker is an in-band ASCII flag on
plain (name, String) values, indistinguishable from data at the
store funnel, so a correct fix requires the marker-protocol change
(entry encoding), not a local patch.
@caomengxuan666
caomengxuan666 merged commit 43f59df into master Oct 26, 2026
8 of 9 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 27, 2026
…s-only) (#1812)

* test(issue1766): forward-port host-env harness drop + upgrade weak compound-append row to exact 1(9)

Forward-port of 35e527a (fix9/carrier-host1766), which missed the
#1779 merge: drop the Executor before unwrapping the capture Arc in
run_host_captures, otherwise all 16 tests panic in try_unwrap before any
assertion runs. Also upgrades the formerly weak top-level compound-append
row (no-marker-leak only) to assert the exact GNU value 1(9); its upgrade
condition is met now that #1767 has merged. The 5 base-clone rows
(marker hits on __RUBASH_LAST/CURRENT_COMMAND, nameref contains_key ref)
are deliberately left untouched pending the parent's ruling on the host
map contract (rescope test invariants vs exported-only host map).

Refs #1766

* fix(executor): drop nameref alias cells from the host env map (rubash#1766)

Adjudication (c) for the last two PR #1812 pins
(issue1766_top/stage_nameref_append_binds_target): the pins are
correct GNU expectations - 'declare -n ref=var; var=orig; ref+=x env'
prints var=origx and NO ref= line - and the product leaked the
nameref cell itself ('ref=var', the target NAME as text) into the
host env map, whose base is a full-table clone.

invoke_host_external_command now removes nameref alias cells from
that base clone, selected by the NAMEREF_VARS attribute set (never
a name blacklist). The target cell stays, so nothing is lost; the
prefix composition below (tempenv_export_name already resolves
prefix names to their targets) is untouched, as is the rest of the
channel contract (the clone still carries unexported non-prefix
cells - issue1766_top_tempenv_restores_after_host_command pins
a=14 in the second capture).

Gate: tests/issue1766_host_env_prefix_regressions.rs 16/16
(was 14/16 on this branch).

---------

Co-authored-by: 曹梦轩 <[email protected]>
@caomengxuan666
caomengxuan666 deleted the fix7/slice-carrier branch October 30, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant