Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(agent): preserve the cognition signing-key reference (#8516)
Wolf Mermelsteinf7cff2c3eb42
diff --git a/docs/guides/consolidate-agent-services.md b/docs/guides/consolidate-agent-services.mdindex d04bdfa5ad..9c89ac25ce 100644--- a/docs/guides/consolidate-agent-services.md+++ b/docs/guides/consolidate-agent-services.md@@ -42,6 +42,9 @@ It restores the existing Pipedream webhook URL from the cognition config, includits secret query parameter. Public URLs do not change when the process moves.Preserve the preview SSH host key and MCP credential encryption key; replacingthem breaks pinned clients and stored credentials.+The cognition CloudFront signer setting must retain its Secrets Manager+reference, replacing any obsolete inline harness value under that name. The+AI tool context uses the separate `_SECRET_NAME` setting for the same key.`MCP_PUBLIC_URL` is the original `https://mcp-server[-dev].macro.com` serverbase. `MCP_CLIENT_PUBLIC_URL` is the original@@ -178,7 +181,11 @@ Copy each running service image by digest into the existing harness ECRrepository under a unique rollback tag, including the previous harness image,and verify each destination digest. Old repositories use `forceDelete`, sotheir tags are not a rollback backup. Save the deployed refresh Lambda ZIP and-archive non-empty CloudWatch log groups before their retirement.+archive non-empty CloudWatch log groups or retain them in AWS before retirement.+For retention, set `retainOnDelete` on all six existing log-group resources+after the DNS handoff and verify it in fresh stack exports immediately before+retirement. An intervening update from the old source can reset that metadata.+Verify the groups remain after retirement; their existing retention periods apply.For the hostname handoff, restore the saved DNS aliases to the old ALBs whilethose endpoints are still healthy, and wait for DNS caches to expire before@@ -194,7 +201,8 @@ Do not retire old compute until the routed checks pass.After retiring a service, move the harness rules back to verified unusedtemporary priorities if their final priorities have already been applied. Restorethe pre-cutover stack revision, copying preserved images back into recreated-repositories first. Recreate task definition revisions from the saved definitions+repositories first. Import retained CloudWatch log groups into the restored stack+instead of attempting to create them again. Recreate task definition revisions from the saved definitionsrather than assuming deregistered revisions remain usable. Wait for healthy targets before removing thetemporary harness rules to return traffic.diff --git a/services/agent_harness_service/AGENTS.md b/services/agent_harness_service/AGENTS.mdindex 68a89a7c6e..733661b86c 100644--- a/services/agent_harness_service/AGENTS.md+++ b/services/agent_harness_service/AGENTS.md@@ -82,6 +82,9 @@ server origin (`mcp-server[-dev].macro.com`); `MCP_CLIENT_PUBLIC_URL` is theintegrations callback origin (`document-cognition[-dev].macro.com`). The sharedgateway preserves these hostnames and internally rewrites cognition paths. Both settings are required; keep them separate. `POSTHOG_API_KEY` and `POSTHOG_HOST` remainavailable for feature flags and future analytics; MCP emits no analytics events.+In deployed configs, `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY`+is cognition's Secrets Manager reference; AI tools resolve the separate+`DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME` reference.The shared Postgres pool defaults to 30 connections (`DATABASE_MAX_CONNECTIONS`).Routine dispatch waits for the shared HTTP listener and calls its loopbackdiff --git a/tooling/scripts/consolidate-agent-config.py b/tooling/scripts/consolidate-agent-config.pyindex b2ec8f65ed..2948a508d8 100644--- a/tooling/scripts/consolidate-agent-config.py+++ b/tooling/scripts/consolidate-agent-config.py@@ -37,6 +37,14 @@ def main():merged["MCP_CLIENT_PUBLIC_URL"] = f"https://document-cognition{suffix}.macro.com"if sources["document-cognition"].get("PIPEDREAM_WEBHOOK_URI"):merged["PIPEDREAM_WEBHOOK_URI"] = sources["document-cognition"]["PIPEDREAM_WEBHOOK_URI"]+ # Cognition resolves this setting through Secrets Manager in deployed+ # environments. An old, unused harness PEM under the same name must not+ # override that reference; AI tools use the separate *_SECRET_NAME setting.+ signer = "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY"+ signer_reference = sources["document-cognition"].get(signer)+ if not signer_reference:+ raise SystemExit("Cognition signer reference is missing or empty.")+ merged[signer] = signer_referenceupdates = {key: value for key, value in merged.items() if target.get(key) != value}print(f"agent-harness-service/{args.config}: {len(updates)} keys to merge")print(", ".join(sorted(updates)))diff --git a/tooling/scripts/test_consolidate_agent_config.py b/tooling/scripts/test_consolidate_agent_config.pyindex f4825aa8d8..10333d6c0f 100644--- a/tooling/scripts/test_consolidate_agent_config.py+++ b/tooling/scripts/test_consolidate_agent_config.py@@ -10,6 +10,30 @@ from unittest.mock import patchclass ConsolidateAgentConfigTest(unittest.TestCase):+ def test_missing_signer_reference_aborts_without_uploading(self):+ spec = importlib.util.spec_from_file_location(+ "consolidate_agent_config",+ Path(__file__).with_name("consolidate-agent-config.py"),+ )+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ key = "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY"+ for source in ({}, {key: ""}):+ with self.subTest(source=source):+ def download(project, config):+ if project == "agent-harness-service":+ return {key: "obsolete-private-fixture"}+ return source if project == "document-cognition" else {}++ with (+ patch.object(module, "download", side_effect=download),+ patch.object(module.subprocess, "run") as upload,+ patch("sys.argv", ["consolidate-agent-config.py", "--config", "dev", "--apply"]),+ self.assertRaisesRegex(SystemExit, "missing or empty"),+ ):+ module.main()+ upload.assert_not_called()+def test_existing_empty_values_are_preserved_and_missing_values_are_copied(self):spec = importlib.util.spec_from_file_location("consolidate_agent_config",@@ -21,6 +45,8 @@ class ConsolidateAgentConfigTest(unittest.TestCase):"OPTIONAL_INTEGRATION": "","EXISTING_SECRET": "private-fixture","MCP_PUBLIC_URL": "https://old.example",+ "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY": "private-pem-fixture",+ "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME": "signer-key-secret",}sources = {"document-cognition": {@@ -29,6 +55,7 @@ class ConsolidateAgentConfigTest(unittest.TestCase):"MISSING_SETTING": "first-source","PIPEDREAM_WEBHOOK_URI": "https://old.example/webhook?secret=fixture","PORT": "8085",+ "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY": "signer-key-secret",},"mcp-server": {"MISSING_SETTING": "later-source"},"agent-schedule-service": {},@@ -55,6 +82,14 @@ class ConsolidateAgentConfigTest(unittest.TestCase):self.assertEqual(target["OPTIONAL_INTEGRATION"], "")self.assertEqual(target["EXISTING_SECRET"], "private-fixture")+ self.assertEqual(+ target["DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY"],+ "signer-key-secret",+ )+ self.assertEqual(+ target["DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME"],+ "signer-key-secret",+ )self.assertEqual(target["MISSING_SETTING"], "first-source")self.assertNotIn("PORT", target)self.assertEqual(target["MCP_PUBLIC_URL"], "https://mcp-server-dev.macro.com")@@ -66,6 +101,7 @@ class ConsolidateAgentConfigTest(unittest.TestCase):self.assertNotIn("private-fixture", output.getvalue())self.assertNotIn("replacement-fixture", output.getvalue())self.assertNotIn("secret=fixture", output.getvalue())+ self.assertNotIn("private-pem-fixture", output.getvalue())if __name__ == "__main__":