symphony-linear 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.gnosis/entries.jsonl +3 -0
  2. symphony_linear-0.4.0/.release-please-manifest.json +1 -0
  3. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/AGENTS.md +21 -13
  4. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/CHANGELOG.md +28 -0
  5. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/PKG-INFO +59 -26
  6. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/README.md +58 -25
  7. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/config.yaml.example +25 -4
  8. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/pyproject.toml +1 -1
  9. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/__init__.py +1 -1
  10. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/cli.py +9 -0
  11. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/config.py +63 -1
  12. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/github.py +20 -24
  13. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/github_tracker.py +58 -21
  14. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/linear.py +0 -20
  15. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/linear_tracker.py +4 -7
  16. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/opencode.py +86 -15
  17. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/orchestrator.py +219 -161
  18. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/tracker.py +20 -11
  19. symphony_linear-0.4.0/symphony_linear/webhook.py +290 -0
  20. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/workspace.py +89 -10
  21. symphony_linear-0.4.0/tests/fixtures/opencode_events_multi_step.jsonl +6 -0
  22. symphony_linear-0.4.0/tests/test_cli.py +102 -0
  23. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_config.py +279 -27
  24. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_github.py +129 -36
  25. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_github_tracker.py +230 -40
  26. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_linear.py +5 -32
  27. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_linear_tracker.py +8 -14
  28. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_opencode.py +103 -1
  29. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_orchestrator.py +758 -67
  30. symphony_linear-0.4.0/tests/test_tracker.py +39 -0
  31. symphony_linear-0.4.0/tests/test_webhook.py +445 -0
  32. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_workspace.py +215 -9
  33. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/uv.lock +1 -1
  34. symphony_linear-0.3.0/.release-please-manifest.json +0 -1
  35. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.github/workflows/pre-commit.yml +0 -0
  36. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.github/workflows/publish-pypi.yml +0 -0
  37. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.github/workflows/release-please.yml +0 -0
  38. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.gitignore +0 -0
  39. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.pre-commit-config.yaml +0 -0
  40. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/.symphony/setup +0 -0
  41. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/LICENSE +0 -0
  42. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/misc/screenshot1.png +0 -0
  43. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/misc/screenshot2.png +0 -0
  44. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/release-please-config.json +0 -0
  45. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/__main__.py +0 -0
  46. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/logging.py +0 -0
  47. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/project_config.py +0 -0
  48. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/provisioning.py +0 -0
  49. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/sandbox.py +0 -0
  50. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/symphony_linear/state.py +0 -0
  51. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/__init__.py +0 -0
  52. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/fixtures/opencode_events.jsonl +0 -0
  53. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/fixtures/opencode_events_tool_use.jsonl +0 -0
  54. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/fixtures/smoke_test.sh +0 -0
  55. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_project_config.py +0 -0
  56. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_provisioning.py +0 -0
  57. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_sandbox.py +0 -0
  58. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_sandbox_extra_rw.py +0 -0
  59. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_sandbox_path.py +0 -0
  60. {symphony_linear-0.3.0 → symphony_linear-0.4.0}/tests/test_state.py +0 -0
@@ -3,3 +3,6 @@
3
3
  {"id":"ddcnmt","topics":["architecture","configuration","workflow-templates"],"text":"We explicitly rejected the WORKFLOW.md-style configurable prompt template approach that the openai/symphony SPEC.md describes. The system prompt and ticket prompt format are hardcoded in the orchestrator. Reasoning: this tool is built for solo personal use with stable workflow needs; adding a YAML-front-matter + Liquid-template loader and a file watcher would have multiplied the complexity for no concrete benefit at MVP scope. If users start wanting per-repo prompt customization, the cleanest reintroduction is to look for a `.symphony/prompt.md` in the repo at bootstrap time and use it instead of the hardcoded one. Don't bring back hot-reload or front-matter unless there's a real second use case driving it.","related":null,"created_at":"2026-05-12T15:48:11.107405301Z","updated_at":"2026-05-12T15:48:11.107405301Z"}
4
4
  {"id":"zqgxcm","topics":["qa-serve","workspace-lifecycle"],"text":"QA-on-missing-workspace deliberately does not auto-reclone. When _reconcile_serve picks a winner whose workspace was deleted (typical cause: the ticket was previously moved out of an active state, which triggers cleanup), we comment+transition out of QA rather than running prepare() to clone fresh.\n\nReason: the agent never git-pushes (sandbox hides credentials by design — see AGENTS.md). The agent's commits therefore live ONLY in the local workspace clone. If we re-cloned for QA, _git_switch_branch would fall through to 'git switch -c' against the remote default branch, and .symphony/serve would silently run against base-branch code — i.e. QA would 'start' but serve the wrong thing. Refusing to start is the safer failure.\n\nThe supported flow is to QA *before* moving the ticket to Done. Done→QA isn't recoverable in the current architecture.\n\nThis would only become a sensible feature if push-from-agent becomes the norm (so the branch is reachable from the remote). The user has separately mentioned wanting Symphony to optionally not auto-create per-ticket branches (push target/creds/PR being out of Symphony's scope) — that change, if it lands, may revisit this decision.","related":null,"created_at":"2026-05-13T02:29:08.183427176Z","updated_at":"2026-05-13T02:29:08.183427176Z"}
5
5
  {"id":"ucuwzs","topics":["opencode","configuration"],"text":"We removed the `opencode.model` config option (was at `AppConfig.opencode.model`). The reasoning: OpenCode's own configuration already selects a model, and in the workflows people actually run — multi-step agentic loops, tool use, code edits — overriding the model from Symphony's outer layer doesn't add value. The option was effectively dead config surface.\n\nDon't reintroduce a model selector at the Symphony level without a concrete use case. If model choice ever needs to vary per-ticket (e.g. cheap model for triage, strong model for implementation), the right place is OpenCode's config or a per-project setting, not a single global string in Symphony's config.\n\nThe removal was a breaking change (`feat!:`); existing configs with an `opencode:` section fail loudly at load via pydantic's `extra=\"forbid\"`.","related":null,"created_at":"2026-05-13T17:05:44.803430158Z","updated_at":"2026-05-13T17:05:44.803430158Z"}
6
+ {"id":"rgdtfm","topics":["webhook","handler-pattern"],"text":"WebhookServer injects on_wake by creating a per-server _HandlerWithWake subclass with on_wake as a class attribute. Calling it via self._on_wake() binds 'self' as the first arg (because Python treats functions stored on a class as methods); to invoke the raw callable, use type(self)._on_wake() in BaseHTTPRequestHandler subclasses. This pattern is also used for _webhook_secret (set as a server instance attribute, accessed via self.server._webhook_secret in the handler). If the injection pattern is refactored, audit both call sites — the current shape is slightly unusual but minimal.","related":null,"created_at":"2026-05-15T23:27:26.130947055Z","updated_at":"2026-05-15T23:27:26.130947055Z"}
7
+ {"id":"kdvghj","topics":["self-comment-detection","tracker"],"text":"Daemon-posted comments are tagged with a visible Markdown footer of the form `*Symphony · {kind}*`, appended at the tracker-adapter layer (linear_tracker.py / github_tracker.py) from a `kind` string supplied by the caller (e.g. \"workspace\", \"final\", \"error\", \"context: 37,074 tokens\"). Detection uses the helper `is_bot_comment(body)` in tracker.py, which checks for the substring `*Symphony · ` (middle dot is U+00B7). This replaced the old HTML-comment sentinel (`\u003c!-- symphony:bot --\u003e`) because Linear's renderer does not strip HTML comments, making the previous sentinel visible and ugly in the UI.\n\nTwo alternatives were considered and rejected this round:\n\n1. Invisible zero-width characters as a sentinel (ZWSP / ZWNJ, etc.). Rejected as hacky, fragile, and prone to leaking via copy/paste into human comments.\n\n2. Filtering by token-owner user id via `viewer { id }`. Rejected because when running with a personal API token, this would silently drop comments typed by the same human whose token is used, causing the daemon to ignore genuine human input.\n\nThe marker approach also removes the need for a separate bot user identity (the previous current_user_id / bot_user_id / bot_user_email machinery was all dropped), letting users run the daemon with their own personal API token.","related":["egyecm"],"created_at":"2026-05-22T01:09:51.797388066Z","updated_at":"2026-05-22T01:09:51.797388066Z"}
8
+ {"id":"vqften","topics":["orchestrator","setup-error","retry-loop"],"text":"Setup-error retry loop fires off historical comments when last_seen_comment_id is None. _save_setup_error (and the ProjectConfigError branch of _resume_pipeline) used to persist last_seen_comment_id=None when the error comment couldn't be posted to the tracker. On the next poll tick, _has_new_human_comment(tid, None) returns all comments, so any historical human comment satisfied the 'new comment' gate and re-fired _new_ticket_pipeline every poll interval — symptoms: workspace metadata comment posted multiple times, 'New ticket pipeline starting' repeating every poll. Fix establishes a three-tier baseline hierarchy at both error-save sites: (1) error_comment.id if posted, (2) existing last_seen_comment_id if non-None, (3) most-recent comment id via Tracker.list_comments_since(tid, None) with a graceful None fallback on tracker failure. Whenever you add a new error path that sets setup_error or transitions to failed, preserve this invariant: last_seen_comment_id must never be None when comments exist on the ticket.","related":null,"created_at":"2026-05-24T12:45:52.640571814Z","updated_at":"2026-05-24T12:45:52.640571814Z"}
@@ -0,0 +1 @@
1
+ {".":"0.4.0"}
@@ -54,6 +54,7 @@ symphony_linear/
54
54
  opencode.py run_initial / run_resume; parses OpenCode's NDJSON event stream
55
55
  workspace.py prepare() / remove(): clone, branch switch, .symphony/setup; path-containment check
56
56
  orchestrator.py The brain: poll loop, per-ticket pipelines, ThreadPoolExecutor, cancellation
57
+ webhook.py Optional webhook receiver; wakes poll loop on Linear updates. Absent config means polling only.
57
58
  logging.py stderr logging setup
58
59
  tests/ pytest, mostly unit with mocks; integration tests marked `integration` (shell out to `bwrap`/`git` — they never call the real `opencode` binary or any LLM)
59
60
  ```
@@ -79,11 +80,16 @@ shutting down, or the ticket is no longer triggered — see `_is_still_triggered
79
80
  the ticket is transitioned to `in_progress_state`, the agent runs, the
80
81
  ticket lands in `needs_input_state`, and the existing `_reconcile_serve`
81
82
  logic kills the active serve on the next tick because its owner left QA.
82
- - **The bot's own comments are filtered out** via the bot user id (`viewer.id`
83
- cached on the client). New "human" comments = comments whose
84
- `user_id != bot_user_id`. The `bot_user_email` in the config exists for
85
- documentation; the actual matching is by id. GitHub uses the viewer's node
86
- id — the same filtering logic applies.
83
+ - **The bot's own comments are filtered out** via a visible Markdown footer
84
+ of the form `*Symphony · {kind}*` appended at the tracker-adapter layer
85
+ from a `kind` string supplied by the caller (e.g. `"workspace"`, `"final"`,
86
+ `"error"`, `"context: 37,074 tokens"`). Detection uses the helper
87
+ `is_bot_comment(body)` in `tracker.py`, which checks for the substring
88
+ `*Symphony · ` (middle dot is U+00B7). New "human" comments = comments
89
+ whose body does *not* contain the marker. There is no longer a separate
90
+ bot identity; the daemon can run with the user's personal API token or a
91
+ dedicated bot account — it doesn't care. The `bot_user_email` config field
92
+ has been removed.
87
93
  - **State entry exists ⟺ workspace exists.** `orchestrator._tick` step 3
88
94
  fires cleanup (cancel subprocesses, remove state entry, remove workspace)
89
95
  whenever a tracked ticket is no longer *triggered* — i.e. the trigger label
@@ -131,8 +137,9 @@ shutting down, or the ticket is no longer triggered — see `_is_still_triggered
131
137
  .venv/bin/python -m symphony_linear --validate-config --workspace <dir>
132
138
  ```
133
139
 
134
- There is no linter configured. There is no Makefile. If you add tooling,
135
- update this file.
140
+ A `pre-commit` config runs `ruff` (lint + format) and `mypy` on every commit,
141
+ so there's no need to invoke them manually. There is no Makefile. If you add
142
+ tooling, update this file.
136
143
 
137
144
  Tests heavily use `unittest.mock`. Look at `tests/test_orchestrator.py` for
138
145
  the patterns — fake `LinearClient`, mocked `run_initial`/`run_resume`,
@@ -153,12 +160,13 @@ behaviour, not ours. The NDJSON parser is unit-tested against a fixture.
153
160
  the security-sensitive parts.
154
161
  - Logging is to `stderr` only, via the format set in `logging.py`. Don't add
155
162
  `print()` calls.
156
- - Commit messages MUST follow Conventional Commits (https://www.conventionalcommits.org/).
157
- Common prefixes: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:`, `test:`,
158
- `ci:`, `build:`, `perf:`, `style:`. Breaking changes: append `!` after type
159
- (`feat!: ...`) or add `BREAKING CHANGE:` footer. Release Please uses these
160
- to compute the next version — `fix:` → patch, `feat:` → minor, breaking →
161
- major.
163
+ - Commit messages MUST follow Conventional Commits (https://www.conventionalcommits.org/),
164
+ with the description starting with a capital letter (e.g. `feat: Add new
165
+ feature`, not `feat: add new feature`). Common prefixes: `feat:`, `fix:`,
166
+ `chore:`, `docs:`, `refactor:`, `test:`, `ci:`, `build:`, `perf:`, `style:`.
167
+ Breaking changes: append `!` after type (`feat!: ...`) or add
168
+ `BREAKING CHANGE:` footer. Release Please uses these to compute the next
169
+ version — `fix:` → patch, `feat:` → minor, breaking → major.
162
170
 
163
171
  ## Knowledge and tickets
164
172
 
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.0](https://github.com/skorokithakis/symphony/compare/v0.3.0...v0.4.0) (2026-05-24)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * The 'bot_user_email' field in the Linear config section has been removed. Configs that still set it will fail to load.
9
+
10
+ ### Features
11
+
12
+ * Add clone_protocol option to GitHub backend for HTTPS cloning ([54b9612](https://github.com/skorokithakis/symphony/commit/54b961257d91f344bdc4fc45a341c631e4244fa1))
13
+ * add optional webhook receiver to wake the poll loop on Linear updates ([571f5e8](https://github.com/skorokithakis/symphony/commit/571f5e8e8de1c26600577cc4e05c07b492d628cb))
14
+ * Append context-tokens footer to tracker comments ([cdf6c34](https://github.com/skorokithakis/symphony/commit/cdf6c347023ed414535461d277be9eed34292893))
15
+ * Identify daemon comments by sentinel instead of bot user identity ([e5fc532](https://github.com/skorokithakis/symphony/commit/e5fc53248baa20aa7913f4d7d5e608d9ac051958))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Auto-recover workspace on git fetch failure when clean ([d9394f0](https://github.com/skorokithakis/symphony/commit/d9394f08a6fad7b5f061f7a635ac8af89a676c16))
21
+ * Baseline last_seen_comment_id when error comment post fails ([2983210](https://github.com/skorokithakis/symphony/commit/298321057c8d088ff782c82af06b4bfaf9b61c5d))
22
+ * Tolerate per-item GraphQL errors when listing GitHub project items ([336161a](https://github.com/skorokithakis/symphony/commit/336161a4278cc7da28894dd7ea60b90a2305185d))
23
+
24
+
25
+ ### Documentation
26
+
27
+ * Document clone_protocol option in config.yaml.example ([f7deceb](https://github.com/skorokithakis/symphony/commit/f7deceb1570821920956c8d99582de4eb076d8c4))
28
+ * Note pre-commit tooling in AGENTS.md ([d05a97e](https://github.com/skorokithakis/symphony/commit/d05a97e2f0f5d8443d95dfd73456317fb05fb03d))
29
+ * Require capitalized description in commit messages ([4d0053f](https://github.com/skorokithakis/symphony/commit/4d0053faed8adfecc131abe7ecf250fa890e8f6a))
30
+
3
31
  ## [0.3.0](https://github.com/skorokithakis/symphony/compare/v0.2.0...v0.3.0) (2026-05-15)
4
32
 
5
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: symphony-linear
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: AI-powered ticket orchestration daemon
5
5
  Project-URL: Source, https://github.com/skorokithakis/symphony
6
6
  License: MIT
@@ -49,7 +49,6 @@ mkdir ~/symphony && cd ~/symphony
49
49
  cat > config.yaml <<'YAML'
50
50
  linear:
51
51
  api_key: ${LINEAR_API_KEY}
52
- bot_user_email: you+symphony@example.com
53
52
  YAML
54
53
  # Or for GitHub Projects v2 (everything else has sensible defaults):
55
54
  cat > config.yaml <<'YAML'
@@ -130,17 +129,14 @@ This is the one-off plumbing that connects Symphony to your Linear workspace.
130
129
  You do it once per workspace, plus a small per-repo step for each project
131
130
  you want the agent to touch.
132
131
 
133
- ### Create a bot user
134
-
135
- Create a separate Linear user for the bot so its comments and state changes
136
- are easy to spot. Gmail aliases work: `yourname+symphony@gmail.com`. Invite
137
- the bot into your workspace.
138
-
139
132
  ### Generate a Personal API key
140
133
 
141
- Sign into Linear as the bot. Open **Settings** → **API** → **Personal API
142
- keys**, create a key, and keep it somewhere safe; this is the value you'll
143
- supply as `LINEAR_API_KEY`.
134
+ Sign into Linear with the account you want the daemon to use. This can be
135
+ your own user account or a dedicated bot account — the daemon recognises its
136
+ own comments by a hidden sentinel, not by user identity, so a separate bot
137
+ user is optional. Open **Settings** → **API** → **Personal API keys**,
138
+ create a key, and keep it somewhere safe; this is the value you'll supply
139
+ as `LINEAR_API_KEY`.
144
140
 
145
141
  ### Add a "Needs Input" workflow state
146
142
 
@@ -179,16 +175,14 @@ This is the one-off plumbing to connect Symphony to a GitHub project. You do
179
175
  it once per project. The daemon uses the GitHub Projects v2 (beta) API; the
180
176
  older Projects v1 is not supported.
181
177
 
182
- ### Create a bot account
183
-
184
- Create a separate GitHub user for the bot so its comments and state changes
185
- are easy to spot. Add the bot as a collaborator (with at least read access)
186
- to every repository the bot should clone.
178
+ ### Token
187
179
 
188
- ### Generate a token
189
-
190
- The bot needs read/write access to Issues, Projects, and read access to
191
- repository Contents:
180
+ The daemon needs a token with read/write access to Issues, Projects, and
181
+ read access to repository Contents. This token can belong to your own
182
+ GitHub account or to a dedicated bot account — the daemon recognises its
183
+ own comments by a hidden sentinel, so a separate bot user is optional.
184
+ Add the token owner as a collaborator (with at least read access) to
185
+ every repository the daemon should clone.
192
186
 
193
187
  - **Classic personal access token.** Enable the `repo` and `project`
194
188
  scopes.
@@ -245,7 +239,25 @@ removing the trigger label on Linear.
245
239
 
246
240
  GitHub Projects v2 can contain items from any repository that the project
247
241
  references. Each issue remembers its own repository; Symphony clones from
248
- that repo's SSH URL. There is no per-project "Repo" link to configure.
242
+ that repo's URL. By default it uses the SSH URL (`git@github.com:...`).
243
+
244
+ ### Clone protocol
245
+
246
+ Set `github.clone_protocol` to `https` to clone via HTTPS instead of SSH.
247
+ This is useful when your organisation enforces MFA and SSH is not practical.
248
+
249
+ ```yaml
250
+ github:
251
+ token: ${GITHUB_TOKEN}
252
+ project: orgs/my-org/projects/1
253
+ clone_protocol: https
254
+ ```
255
+
256
+ HTTPS cloning requires the operator to have git credentials set up on the
257
+ host (e.g. via `gh auth login` or a credential helper), because clone runs
258
+ outside the sandbox with the daemon user's identity.
259
+
260
+ The default is `ssh`; omit the field to keep the current behaviour.
249
261
 
250
262
  ### Identifier convention
251
263
 
@@ -268,7 +280,6 @@ For Linear:
268
280
  ```yaml
269
281
  linear:
270
282
  api_key: ${LINEAR_API_KEY}
271
- bot_user_email: yourname+symphony@gmail.com
272
283
  ```
273
284
 
274
285
  For GitHub:
@@ -296,14 +307,12 @@ documented there side by side.
296
307
 
297
308
  # Choose exactly one backend — linear or github.
298
309
  linear:
299
- # REQUIRED. Linear Personal API key from the bot account.
310
+ # REQUIRED. Linear Personal API key.
300
311
  # Use ${LINEAR_API_KEY} to read from the environment, or omit this field
301
312
  # entirely and the daemon will fall back to the LINEAR_API_KEY env var.
313
+ # The key can belong to your own account or a dedicated bot account.
302
314
  api_key: ${LINEAR_API_KEY}
303
315
 
304
- # REQUIRED. Email address of the bot user in Linear.
305
- bot_user_email: yourname+symphony@gmail.com
306
-
307
316
  # Name of the label that triggers the bot (default: Agent).
308
317
  trigger_label: Agent
309
318
 
@@ -348,6 +357,30 @@ turn_timeout_seconds: 1800
348
357
 
349
358
  A copy of this example lives at `config.yaml.example` in the repo root.
350
359
 
360
+ ### Webhook (optional)
361
+
362
+ A webhook receiver cuts poll latency from up to `poll_interval_seconds` to
363
+ ~1 second; polling continues as a safety net. The feature is opt-in — omit the
364
+ `webhook:` block to stay on polling only.
365
+
366
+ ```yaml
367
+ webhook:
368
+ port: 8080
369
+ linear_secret: ${WEBHOOK_SECRET}
370
+ ```
371
+
372
+ `linear_secret` is the HMAC-SHA256 signing secret. If the field is absent or
373
+ empty the daemon falls back to the `SYMPHONY_LINEAR_WEBHOOK_SECRET` environment
374
+ variable.
375
+
376
+ In Linear's UI: **Settings** → **API** → **Webhooks** → **Create webhook**.
377
+ Set the URL to `http://<your-host>:<port>/webhooks/linear/`, paste the same
378
+ signing secret, and subscribe to **Issue** and **Comment** events.
379
+
380
+ Symphony does not do TLS. Terminate TLS upstream (nginx, Caddy, Cloudflare)
381
+ if exposing the port publicly. Linear can deliver to either plain HTTP or
382
+ HTTPS, but production deployments should use HTTPS.
383
+
351
384
  ## Running
352
385
 
353
386
  ```bash
@@ -34,7 +34,6 @@ mkdir ~/symphony && cd ~/symphony
34
34
  cat > config.yaml <<'YAML'
35
35
  linear:
36
36
  api_key: ${LINEAR_API_KEY}
37
- bot_user_email: you+symphony@example.com
38
37
  YAML
39
38
  # Or for GitHub Projects v2 (everything else has sensible defaults):
40
39
  cat > config.yaml <<'YAML'
@@ -115,17 +114,14 @@ This is the one-off plumbing that connects Symphony to your Linear workspace.
115
114
  You do it once per workspace, plus a small per-repo step for each project
116
115
  you want the agent to touch.
117
116
 
118
- ### Create a bot user
119
-
120
- Create a separate Linear user for the bot so its comments and state changes
121
- are easy to spot. Gmail aliases work: `yourname+symphony@gmail.com`. Invite
122
- the bot into your workspace.
123
-
124
117
  ### Generate a Personal API key
125
118
 
126
- Sign into Linear as the bot. Open **Settings** → **API** → **Personal API
127
- keys**, create a key, and keep it somewhere safe; this is the value you'll
128
- supply as `LINEAR_API_KEY`.
119
+ Sign into Linear with the account you want the daemon to use. This can be
120
+ your own user account or a dedicated bot account — the daemon recognises its
121
+ own comments by a hidden sentinel, not by user identity, so a separate bot
122
+ user is optional. Open **Settings** → **API** → **Personal API keys**,
123
+ create a key, and keep it somewhere safe; this is the value you'll supply
124
+ as `LINEAR_API_KEY`.
129
125
 
130
126
  ### Add a "Needs Input" workflow state
131
127
 
@@ -164,16 +160,14 @@ This is the one-off plumbing to connect Symphony to a GitHub project. You do
164
160
  it once per project. The daemon uses the GitHub Projects v2 (beta) API; the
165
161
  older Projects v1 is not supported.
166
162
 
167
- ### Create a bot account
168
-
169
- Create a separate GitHub user for the bot so its comments and state changes
170
- are easy to spot. Add the bot as a collaborator (with at least read access)
171
- to every repository the bot should clone.
163
+ ### Token
172
164
 
173
- ### Generate a token
174
-
175
- The bot needs read/write access to Issues, Projects, and read access to
176
- repository Contents:
165
+ The daemon needs a token with read/write access to Issues, Projects, and
166
+ read access to repository Contents. This token can belong to your own
167
+ GitHub account or to a dedicated bot account — the daemon recognises its
168
+ own comments by a hidden sentinel, so a separate bot user is optional.
169
+ Add the token owner as a collaborator (with at least read access) to
170
+ every repository the daemon should clone.
177
171
 
178
172
  - **Classic personal access token.** Enable the `repo` and `project`
179
173
  scopes.
@@ -230,7 +224,25 @@ removing the trigger label on Linear.
230
224
 
231
225
  GitHub Projects v2 can contain items from any repository that the project
232
226
  references. Each issue remembers its own repository; Symphony clones from
233
- that repo's SSH URL. There is no per-project "Repo" link to configure.
227
+ that repo's URL. By default it uses the SSH URL (`git@github.com:...`).
228
+
229
+ ### Clone protocol
230
+
231
+ Set `github.clone_protocol` to `https` to clone via HTTPS instead of SSH.
232
+ This is useful when your organisation enforces MFA and SSH is not practical.
233
+
234
+ ```yaml
235
+ github:
236
+ token: ${GITHUB_TOKEN}
237
+ project: orgs/my-org/projects/1
238
+ clone_protocol: https
239
+ ```
240
+
241
+ HTTPS cloning requires the operator to have git credentials set up on the
242
+ host (e.g. via `gh auth login` or a credential helper), because clone runs
243
+ outside the sandbox with the daemon user's identity.
244
+
245
+ The default is `ssh`; omit the field to keep the current behaviour.
234
246
 
235
247
  ### Identifier convention
236
248
 
@@ -253,7 +265,6 @@ For Linear:
253
265
  ```yaml
254
266
  linear:
255
267
  api_key: ${LINEAR_API_KEY}
256
- bot_user_email: yourname+symphony@gmail.com
257
268
  ```
258
269
 
259
270
  For GitHub:
@@ -281,14 +292,12 @@ documented there side by side.
281
292
 
282
293
  # Choose exactly one backend — linear or github.
283
294
  linear:
284
- # REQUIRED. Linear Personal API key from the bot account.
295
+ # REQUIRED. Linear Personal API key.
285
296
  # Use ${LINEAR_API_KEY} to read from the environment, or omit this field
286
297
  # entirely and the daemon will fall back to the LINEAR_API_KEY env var.
298
+ # The key can belong to your own account or a dedicated bot account.
287
299
  api_key: ${LINEAR_API_KEY}
288
300
 
289
- # REQUIRED. Email address of the bot user in Linear.
290
- bot_user_email: yourname+symphony@gmail.com
291
-
292
301
  # Name of the label that triggers the bot (default: Agent).
293
302
  trigger_label: Agent
294
303
 
@@ -333,6 +342,30 @@ turn_timeout_seconds: 1800
333
342
 
334
343
  A copy of this example lives at `config.yaml.example` in the repo root.
335
344
 
345
+ ### Webhook (optional)
346
+
347
+ A webhook receiver cuts poll latency from up to `poll_interval_seconds` to
348
+ ~1 second; polling continues as a safety net. The feature is opt-in — omit the
349
+ `webhook:` block to stay on polling only.
350
+
351
+ ```yaml
352
+ webhook:
353
+ port: 8080
354
+ linear_secret: ${WEBHOOK_SECRET}
355
+ ```
356
+
357
+ `linear_secret` is the HMAC-SHA256 signing secret. If the field is absent or
358
+ empty the daemon falls back to the `SYMPHONY_LINEAR_WEBHOOK_SECRET` environment
359
+ variable.
360
+
361
+ In Linear's UI: **Settings** → **API** → **Webhooks** → **Create webhook**.
362
+ Set the URL to `http://<your-host>:<port>/webhooks/linear/`, paste the same
363
+ signing secret, and subscribe to **Issue** and **Comment** events.
364
+
365
+ Symphony does not do TLS. Terminate TLS upstream (nginx, Caddy, Cloudflare)
366
+ if exposing the port publicly. Linear can deliver to either plain HTTP or
367
+ HTTPS, but production deployments should use HTTPS.
368
+
336
369
  ## Running
337
370
 
338
371
  ```bash
@@ -5,9 +5,10 @@
5
5
  # remove the block you are not using.
6
6
 
7
7
  linear:
8
- # REQUIRED. Linear Personal API key from the bot account.
8
+ # REQUIRED. Linear Personal API key.
9
9
  # Use ${LINEAR_API_KEY} to read from the environment (or set LINEAR_API_KEY
10
10
  # env var — the daemon falls back to it if this field is missing or empty).
11
+ # The key can belong to your own account or a dedicated bot account.
11
12
  api_key: ${LINEAR_API_KEY}
12
13
 
13
14
  # Name of the label that triggers the bot (default: Agent).
@@ -26,9 +27,6 @@ linear:
26
27
  # Omit to disable the feature entirely.
27
28
  # qa_state: QA
28
29
 
29
- # REQUIRED. Email address of the bot user in Linear.
30
- bot_user_email: yourname+symphony@gmail.com
31
-
32
30
 
33
31
  # ---------------------------------------------------------------------------
34
32
  # GitHub Projects v2 backend (comment out the `linear:` block above and
@@ -67,6 +65,13 @@ linear:
67
65
  # # ticket into this status bumps the previous one back to needs_input_status.
68
66
  # # Omit to disable the feature entirely.
69
67
  # # qa_status: QA
68
+ #
69
+ # # Protocol used to clone repositories (default: ssh). Set to https if
70
+ # # your organization enforces MFA on SSH. HTTPS requires the operator
71
+ # # to have git credentials set up on the host (e.g. via `gh auth login`
72
+ # # or a credential helper) since git ops run outside the sandbox under
73
+ # # the daemon user's identity.
74
+ # # clone_protocol: ssh
70
75
 
71
76
  sandbox:
72
77
  # Paths to conceal inside the sandbox (defaults shown below).
@@ -89,6 +94,22 @@ sandbox:
89
94
  # - ~/projects/shared-tools
90
95
 
91
96
 
97
+ # ---------------------------------------------------------------------------
98
+ # Optional webhook server (Linear only, no GitHub support).
99
+ # Uncomment to enable a lightweight HTTP server that listens for Linear
100
+ # webhook events so the daemon can react to ticket updates immediately
101
+ # instead of waiting for the next poll cycle.
102
+ # ---------------------------------------------------------------------------
103
+ # webhook:
104
+ # # REQUIRED when the webhook block is present. Port for the webhook server.
105
+ # port: 4000
106
+ #
107
+ # # REQUIRED when the webhook block is present. Linear webhook secret to
108
+ # # verify incoming HMAC signatures. Use ${SYMPHONY_LINEAR_WEBHOOK_SECRET}
109
+ # # to read from the environment (or set SYMPHONY_LINEAR_WEBHOOK_SECRET
110
+ # # env var — the daemon falls back to it if this field is missing or empty).
111
+ # linear_secret: ${SYMPHONY_LINEAR_WEBHOOK_SECRET}
112
+
92
113
  # Seconds between tracker poll cycles (default: 30, minimum: 1).
93
114
  poll_interval_seconds: 30
94
115
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "symphony-linear"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "AI-powered ticket orchestration daemon"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,3 +1,3 @@
1
1
  """symphony-lite: AI-powered ticket orchestration daemon."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.4.0"
@@ -16,6 +16,7 @@ from symphony_linear.logging import get_logger, setup_logging
16
16
  from symphony_linear.orchestrator import Orchestrator
17
17
  from symphony_linear.state import load_state
18
18
  from symphony_linear.tracker import Tracker
19
+ from symphony_linear.webhook import WebhookServer
19
20
 
20
21
  logger = get_logger(__name__)
21
22
 
@@ -89,6 +90,13 @@ def main(argv: list[str] | None = None) -> None:
89
90
  orchestrator = Orchestrator(
90
91
  config=config, state=state, tracker=tracker, workspace=workspace
91
92
  )
93
+ if config.webhook is not None:
94
+ webhook_server = WebhookServer(
95
+ port=config.webhook.port,
96
+ linear_secret=config.webhook.linear_secret,
97
+ on_wake=orchestrator.wake,
98
+ )
99
+ orchestrator.set_webhook_server(webhook_server)
92
100
  orchestrator.run()
93
101
 
94
102
 
@@ -107,6 +115,7 @@ def _create_tracker(config: AppConfig) -> Tracker:
107
115
  in_progress_status=config.github.in_progress_status,
108
116
  needs_input_status=config.github.needs_input_status,
109
117
  qa_status=config.github.qa_status,
118
+ clone_protocol=config.github.clone_protocol,
110
119
  )
111
120
  return GitHubTracker(client=github_client, config=github_tracker_config)
112
121
  # The model_validator guarantees this is unreachable, but be defensive.
@@ -75,6 +75,8 @@ def _expand_values(obj: Any) -> Any:
75
75
 
76
76
 
77
77
  class _LinearConfig(BaseModel):
78
+ model_config = ConfigDict(extra="forbid")
79
+
78
80
  api_key: str = Field(..., description="Linear API key (bearer token)")
79
81
  trigger_label: str = Field("Agent", description="Label that triggers the bot")
80
82
  in_progress_state: str = Field(
@@ -87,7 +89,6 @@ class _LinearConfig(BaseModel):
87
89
  None,
88
90
  description="Optional Linear state for QA; polled in addition to in_progress and needs_input",
89
91
  )
90
- bot_user_email: str = Field(..., description="Email of the bot user in Linear")
91
92
 
92
93
 
93
94
  # Compile once to share between config-level and tracker-level validation.
@@ -118,6 +119,17 @@ class _GitHubConfig(BaseModel):
118
119
  None,
119
120
  description="Optional status option name for QA; polled in addition to in_progress and needs_input",
120
121
  )
122
+ clone_protocol: str = Field(
123
+ "ssh",
124
+ description="Protocol for cloning repositories: 'ssh' (default) or 'https'",
125
+ )
126
+
127
+ @field_validator("clone_protocol")
128
+ @classmethod
129
+ def _validate_clone_protocol(cls, v: str) -> str:
130
+ if v not in ("ssh", "https"):
131
+ raise ValueError(f"clone_protocol must be 'ssh' or 'https', got {v!r}")
132
+ return v
121
133
 
122
134
  @field_validator("project")
123
135
  @classmethod
@@ -142,6 +154,19 @@ class _SandboxConfig(BaseModel):
142
154
  )
143
155
 
144
156
 
157
+ class _WebhookConfig(BaseModel):
158
+ """Optional webhook server configuration (Linear only)."""
159
+
160
+ port: int = Field(..., gt=0, le=65535, description="Port for the webhook server")
161
+ linear_secret: str = Field(
162
+ ...,
163
+ description=(
164
+ "Linear webhook secret for HMAC signature verification. "
165
+ "Fall back to SYMPHONY_LINEAR_WEBHOOK_SECRET env var if empty/missing."
166
+ ),
167
+ )
168
+
169
+
145
170
  class AppConfig(BaseModel):
146
171
  """Top-level application configuration.
147
172
 
@@ -157,6 +182,9 @@ class AppConfig(BaseModel):
157
182
  None, description="GitHub Projects v2 backend configuration block"
158
183
  )
159
184
  sandbox: _SandboxConfig = Field(default_factory=_SandboxConfig)
185
+ webhook: _WebhookConfig | None = Field(
186
+ None, description="Optional webhook server configuration"
187
+ )
160
188
  poll_interval_seconds: int = Field(
161
189
  30, gt=0, description="Seconds between poll cycles"
162
190
  )
@@ -182,6 +210,8 @@ class AppConfig(BaseModel):
182
210
  if isinstance(data, dict):
183
211
  if "sandbox" in data and data["sandbox"] is None:
184
212
  del data["sandbox"]
213
+ if "webhook" in data and data["webhook"] is None:
214
+ del data["webhook"]
185
215
  return data
186
216
 
187
217
  @model_validator(mode="after")
@@ -197,6 +227,11 @@ class AppConfig(BaseModel):
197
227
  "No tracker backend configured. "
198
228
  "Add either a 'linear:' or 'github:' block to config.yaml."
199
229
  )
230
+ if self.webhook is not None and self.linear is None:
231
+ raise ValueError(
232
+ "webhook block requires a 'linear:' backend; "
233
+ "GitHub webhooks are not supported."
234
+ )
200
235
  return self
201
236
 
202
237
 
@@ -239,6 +274,23 @@ def _apply_github_env_fallback(expanded: dict[str, Any], path: Path) -> None:
239
274
  )
240
275
 
241
276
 
277
+ def _apply_webhook_env_fallback(expanded: dict[str, Any], path: Path) -> None:
278
+ """If a webhook block is present but has no linear_secret, fill it from env."""
279
+ webhook = expanded.get("webhook")
280
+ if webhook is None:
281
+ return
282
+ if isinstance(webhook, dict) and not webhook.get("linear_secret", ""):
283
+ env_key = os.environ.get("SYMPHONY_LINEAR_WEBHOOK_SECRET", "")
284
+ if env_key:
285
+ webhook["linear_secret"] = env_key
286
+ else:
287
+ raise ValueError(
288
+ f"Webhook secret not set. Provide it in {path} "
289
+ f"(webhook.linear_secret) or via the SYMPHONY_LINEAR_WEBHOOK_SECRET "
290
+ f"environment variable."
291
+ )
292
+
293
+
242
294
  # ---------------------------------------------------------------------------
243
295
  # Public API
244
296
  # ---------------------------------------------------------------------------
@@ -282,6 +334,7 @@ def load_config(workspace_dir: Path) -> AppConfig:
282
334
  if isinstance(expanded, dict):
283
335
  has_linear = expanded.get("linear") is not None
284
336
  has_github = expanded.get("github") is not None
337
+ has_webhook = expanded.get("webhook") is not None
285
338
  if has_linear and has_github:
286
339
  raise ValueError(
287
340
  "Both 'linear' and 'github' blocks are set in config.yaml. "
@@ -292,6 +345,14 @@ def load_config(workspace_dir: Path) -> AppConfig:
292
345
  "No tracker backend configured. "
293
346
  "Add either a 'linear:' or 'github:' block to config.yaml."
294
347
  )
348
+ # Run the webhook+linear-only check BEFORE the secret-fallback so that
349
+ # github+webhook configs produce the scope error, not a misleading
350
+ # "missing webhook secret" error from the env fallback.
351
+ if has_webhook and not has_linear:
352
+ raise ValueError(
353
+ "webhook block requires a 'linear:' backend; "
354
+ "GitHub webhooks are not supported."
355
+ )
295
356
 
296
357
  # Environment variable fallbacks: if the config block is present but its
297
358
  # credential is missing or empty, fall back to the appropriate env var.
@@ -300,6 +361,7 @@ def load_config(workspace_dir: Path) -> AppConfig:
300
361
  if isinstance(expanded, dict):
301
362
  _apply_linear_env_fallback(expanded, path)
302
363
  _apply_github_env_fallback(expanded, path)
364
+ _apply_webhook_env_fallback(expanded, path)
303
365
 
304
366
  try:
305
367
  return AppConfig.model_validate(expanded)