Commit fdacd32
feat(config): add optional metadata dict to workflow definition (#107)
* feat(config): add optional metadata dict to workflow definition
Add a metadata field to WorkflowDef that allows workflow authors to
attach arbitrary key-value pairs for external tooling. The metadata
is included verbatim in the workflow_started event, enabling
downstream consumers (dashboards, trackers, enrichers) to adapt
behavior without parsing the YAML source.
Example usage in workflow YAML:
workflow:
name: twig-sdlc
metadata:
tracker: ado
project_url: https://dev.azure.com/org/Project
work_item_id_agent: intake
work_item_id_field: epic_id
The field defaults to an empty dict, so existing workflows are
unaffected.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(cli): add --metadata flag for runtime metadata injection
Add --metadata / -m flag to 'conductor run' that accepts key=value
pairs, merged on top of YAML-declared metadata. This enables callers
to inject dynamic values at invocation time:
conductor run twig-sdlc.yaml --metadata work_item_id=1814
CLI metadata is:
- Parsed separately from --input (different binding path)
- Merged on top of YAML metadata (CLI wins on conflicts)
- Forwarded through --web-bg background process spawning
- Included in the workflow_started event alongside YAML metadata
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: add metadata schema and loader tests
7 new tests verifying:
- Schema: metadata defaults to empty dict, accepts arbitrary keys,
independent from input/context fields
- Loader: metadata round-trips through YAML, omission gives empty
dict, nested values preserved, metadata and input are separate
namespaces
All 140 config tests pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: wrap long help string to satisfy E501 line-length lint
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add run_id and log_file for deterministic run linking
Propagate the event log's random hex suffix as a run_id across all
systems:
- EventLogSubscriber: expose run_id property (was already generated)
- WorkflowEngine: accept run_id + log_file params, include in
workflow_started event
- PID files: include run_id + log_file fields
- Web dashboard: add /api/info endpoint returning run_id, log_file,
workflow_name, started_at, metadata
This enables the central dashboard to match per-run dashboards to
event logs by exact run_id instead of fragile name/timestamp heuristics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add system metadata to workflow_started event and checkpoints
Auto-inject runtime diagnostics (PID, platform, Python version, cwd,
conductor version, started_at, run_id, log_file, bg_mode) into the
workflow_started event. Dashboard port/URL included when --web is active;
parent_pid included in --web-bg mode.
System metadata flows through:
- JSONL event log (via EventLogSubscriber)
- Web dashboard /api/info endpoint
- Checkpoint files (for resume context)
PID files are intentionally left unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address PR #107 review feedback
- Guard os.getcwd() with try/except OSError in _build_system_metadata()
- Strip sensitive system info (PID, cwd, log_file) from /api/info endpoint
- Add parse_metadata_flags() to keep metadata values as raw strings (no coercion)
- Use _serialize_value() for metadata in bg_runner to handle nested dicts
- Add public WebDashboard.port property, stop accessing _actual_port externally
- Group informational params (run_id, log_file, dashboard_port, bg_mode) into RunContext dataclass
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* style: apply ruff formatting
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Daniel Green <dangreen@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0ccf1f9 commit fdacd32
12 files changed
Lines changed: 545 additions & 3 deletions
File tree
- src/conductor
- cli
- config
- engine
- web
- tests
- test_config
- test_engine
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
| |||
300 | 311 | | |
301 | 312 | | |
302 | 313 | | |
| 314 | + | |
303 | 315 | | |
304 | 316 | | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
308 | 320 | | |
| 321 | + | |
309 | 322 | | |
310 | 323 | | |
311 | 324 | | |
| |||
350 | 363 | | |
351 | 364 | | |
352 | 365 | | |
| 366 | + | |
353 | 367 | | |
354 | 368 | | |
355 | 369 | | |
| |||
377 | 391 | | |
378 | 392 | | |
379 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
380 | 399 | | |
381 | 400 | | |
382 | 401 | | |
| |||
398 | 417 | | |
399 | 418 | | |
400 | 419 | | |
| 420 | + | |
401 | 421 | | |
402 | 422 | | |
403 | 423 | | |
| |||
422 | 442 | | |
423 | 443 | | |
424 | 444 | | |
| 445 | + | |
425 | 446 | | |
426 | 447 | | |
427 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| 69 | + | |
| 70 | + | |
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
844 | 879 | | |
845 | 880 | | |
846 | 881 | | |
| |||
990 | 1025 | | |
991 | 1026 | | |
992 | 1027 | | |
| 1028 | + | |
993 | 1029 | | |
994 | 1030 | | |
995 | 1031 | | |
| |||
1003 | 1039 | | |
1004 | 1040 | | |
1005 | 1041 | | |
| 1042 | + | |
1006 | 1043 | | |
1007 | 1044 | | |
1008 | 1045 | | |
| |||
1054 | 1091 | | |
1055 | 1092 | | |
1056 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
1057 | 1098 | | |
1058 | 1099 | | |
1059 | 1100 | | |
| |||
1107 | 1148 | | |
1108 | 1149 | | |
1109 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
1110 | 1153 | | |
1111 | 1154 | | |
1112 | 1155 | | |
| |||
1116 | 1159 | | |
1117 | 1160 | | |
1118 | 1161 | | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1119 | 1168 | | |
1120 | 1169 | | |
1121 | 1170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
741 | 748 | | |
742 | 749 | | |
743 | 750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
0 commit comments