1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Re-exec envelope hygiene.
//!
//! When a CLI `execute` handler exec's a detached child of this CLI
//! (via the SDK's `BinaryExecutor`) by copying its own request onto
//! the child, the child must NOT inherit the parent's output
//! transform or token budget. Only the originating top-level
//! invocation carries those.
//!
//! The rule, applied identically at every such re-exec:
//!
//! | base field | child inherits? | why |
//! |-----------------|-----------------|------------------------------|
//! | `jq` | NO (stripped) | output transform, parent-only |
//! | `python` | NO (stripped) | output transform, parent-only |
//! | `max_tokens` | NO (stripped) | token budget, parent-only |
//! | `timeout_seconds` | YES (kept) | the one cap a child honors |
//!
//! Two deliberate non-participants:
//! - `tools run` / `plugins run` launch foreign tool/plugin binaries
//! (not a re-exec of this CLI) and pass the envelope through
//! verbatim.
//! - `tasks run` re-enters `crate::run` with a fired schedule's own
//! stored argv — that command's flags are its own configuration,
//! not an inherited parent envelope, so they propagate as-is.
use RequestBase;
/// Strip the parent-only envelope fields (`jq`, `python`,
/// `max_tokens`) from a typed child request's base, leaving
/// `timeout_seconds` intact. Called at every `BinaryExecutor`
/// re-exec site on the child request before it's handed to the
/// executor.