Commit cc7ea5a
committed
fix: don't leak the wrapper's own internal state into the child process
appmap-python is a plain Python script, so it gets self-instrumented at
interpreter startup via appmap.pth (AppMap instruments any process by
default), before runner.py's own code has computed the environment the
target command should actually run with. That incidental self-init
writes internal, process-scoped state under _APPMAP*-prefixed env var
names using whatever it inherited — notably _APPMAP_MESSAGES_SHOWN, the
once-per-process guard around the startup config-dump log lines.
Since os.execvpe inherits the current environment, that stale marker
carried into the exec'd child, so anyone using the wrapper (e.g.
`appmap-python --enable-log flask run`) never saw the config-dump log
lines, even with everything else configured correctly: the wrapper's
own throwaway initialization had already tripped the "already shown"
guard before the child process's real initialization ran.
Strip all _APPMAP*-prefixed env vars before exec'ing the child and let
the already-computed envvars re-set whatever it actually needs, so the
child always starts from a clean slate regardless of what the wrapper's
incidental self-init happened to do.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Nw1eEFHvABs5hdjMej5bf1 parent 1264fd4 commit cc7ea5a
2 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | 145 | | |
136 | 146 | | |
| |||
0 commit comments